Skip to content

ICE from syntax codemap for particular line counts, perhaps intertwined with macro expansion #18275

Closed
@pnkfelix

Description

@pnkfelix

I was hitting an ICE from the snapshot compiler while trying to build rustc. That's never fun, especially when it cannot provide very clear source location information.

Here is my reduced test case:

// Very

// sensitive
pub struct BytePos(pub u32);

// to particular

// line numberings / offsets

fn main() {
    let x = BytePos(1);

    assert!(x, x);
}

playpen link: http://is.gd/fmyjCb

Now, once you have the test reduced to something this small, its clear what the problem in the above code actually is (namely, we are passing a non-boolean expression that is not overloaded on the !-operator as the first argument to assert!). But the issue is that this causes an ICE in a particularly nasty fashion.

Running the above yields (in both the playpen and my laptop):

<std macros>:8:12: 13:14 error: cannot apply unary operator `!` to type `BytePos`
<std macros>:8         if !$cond {
<std macros>:9             fail!($($arg),+)
<std macros>:10         }
<std macros>:11     );
<std macros>:12 )
error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'index out of bounds: the len is 12 but the index is 12', /build/rust-git/src/rust/src/libsyntax/lib.rs:1

Unfortunately, as the test says, the test is very sensitive to particular choices for where the erroneous lines happen to fall. So it would be good for someone to investigate this at some point against this version of rustc (i'm running rustc 0.13.0-dev (e8cc3f26e 2014-10-21 08:22:09 +0000); I don't know how to find what the playpen is using); if we simply wait a few versions and then re-test, this particular test may start succeeding but a nearby variant may still (or start to) fail.

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