Skip to content

"unprintable span" compiler error with improper closure in nom macro #31654

Closed
@itaibn

Description

@itaibn

[Note: I believe that this is probably another instantiation of issue #31089]

The macro chain! from the package nom expects at the end a closure with zero arguments. If the closure has more arguments, the compiler emits the error "internal compiler error: unprintable span". Crate to replicate this error:

Cargo.toml

[package]
name = "bug-test"
version = "0.1.0"
authors = ["xxx"]

[dependencies]
nom = "=1.2.0"

src/lib

#[macro_use]
extern crate nom;

use nom::space;

named!(test,
    chain!(space,
        |x| {x}
    )
);

Error message (full path omitted for privacy):

   Compiling bug-test v0.1.0 ($XXX/bug-test)
src/lib.rs:8:9: 119:60 error: this function takes 1 parameter but 0 parameters were supplied [E0057]
(internal compiler error: unprintable span)
<nom macros>:110:1: 110:69 note: in this expansion of chaining_parser! (defined in <nom macros>)
<nom macros>:2:3: 2:54 note: in this expansion of chaining_parser! (defined in <nom macros>)
<nom macros>:20:3: 20:36 note: in this expansion of chain! (defined in <nom macros>)
src/lib.rs:6:1: 10:3 note: in this expansion of named! (defined in <nom macros>)
src/lib.rs:8:9: 119:60 help: run `rustc --explain E0057` to see a detailed explanation
error: aborting due to previous error
Could not compile `bug-test`.

To learn more, run the command again with --verbose.

Version:

$ cargo --version --verbose
cargo 0.7.0-nightly (1af03be 2015-12-08)
$ rustc --version --verbose
rustc 1.6.0 (c30b771ad 2016-01-19)
binary: rustc
commit-hash: c30b771ad9d44ab84f8c88b80c25fcfde2433126
commit-date: 2016-01-19
host: x86_64-unknown-linux-gnu
release: 1.6.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions