Skip to content

ICE: "unprintable span" with macro and two files, no backtrace #29084

Closed
@khernyo

Description

@khernyo

Compiling the following two files results in an ICE without a backtrace:

  • lib.rs:
macro_rules! foo {
    ($d:expr) => {{
        fn bar(d: u8) { }
        bar(&mut $d);
    }}
}

mod m;
  • m.rs:
fn f() {
    foo!(0u8);
}

Compiled with the command: rustc lib.rs --crate-type lib

Results in the following output:

lib.rs:4:13: 2:13 error: mismatched types:
 expected `u8`,
    found `&mut u8`
(expected u8,
    found &-ptr) [E0308]
(internal compiler error: unprintable span)
lib.rs:1:1: 6:2 note: in expansion of foo!
m.rs:2:5: 2:15 note: expansion site
lib.rs:4:13: 2:13 help: run `rustc --explain E0308` to see a detailed explanation
error: aborting due to previous error

I could not reproduce it when module m is inlined in lib.rs.
Same result on stable, beta and nightly:

multirust: checking metadata version
multirust: got metadata version 2
rustc 1.3.0 (9a92aaf19 2015-09-15)
binary: rustc
commit-hash: 9a92aaf19a64603b02b4130fe52958cc12488900
commit-date: 2015-09-15
host: x86_64-unknown-linux-gnu
release: 1.3.0
multirust: checking metadata version
multirust: got metadata version 2
rustc 1.4.0-beta.2 (4b9b1f3b0 2015-10-01)
binary: rustc
commit-hash: 4b9b1f3b0fe6cd99e1e929b7def63c37f286f335
commit-date: 2015-10-01
host: x86_64-unknown-linux-gnu
release: 1.4.0-beta.2
multirust: checking metadata version
multirust: got metadata version 2
rustc 1.5.0-nightly (eafe106ef 2015-10-15)
binary: rustc
commit-hash: eafe106ef3dcf35b05edc2fb7c835ea83431fd34
commit-date: 2015-10-15
host: x86_64-unknown-linux-gnu
release: 1.5.0-nightly

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions