Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
itaibn opened this issue Feb 14, 2016 · 2 comments
Closed

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

itaibn opened this issue Feb 14, 2016 · 2 comments

Comments

@itaibn
Copy link

itaibn commented Feb 14, 2016

[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
@fhahn
Copy link
Contributor

fhahn commented Feb 14, 2016

I just tried to reproduce the bug, but it seems to be fixed in nightly. I noticed you are using rustc 1.6, but #31089 landed after 1.6 was released.

@itaibn
Copy link
Author

itaibn commented Feb 15, 2016

I tested it on nightly, but now I just upgrade nightly and tested it again, and I confirm that it works in this case.

@itaibn itaibn closed this as completed Feb 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants