Skip to content

Compiler panic on two-line feature gate #23110

Closed
@hauleth

Description

@hauleth

Compiler panics when I have separate lines for feature gates.

I tried this code:

https://github.com/hauleth/inter/blob/compiler-error/src/lib.rs (sorry for the project link, but I cannot reproduce it in any other environment)

When I try to compile any examples or tests I get (output for cargo test):

       Fresh log v0.2.5
       Fresh rustc-serialize v0.2.15
       Fresh libc v0.1.2
       Fresh rand v0.1.4
       Fresh num v0.1.15
   Compiling inter v0.0.1 (file:///home/hauleth/Workspace/inter)
     Running `rustc src/lib.rs --crate-name inter --crate-type lib -g -C metadata=7a3684a129aeb871 -C extra-filename=-7a3684a129aeb871 --out-dir /home/hauleth/Workspace/inter/target --emit=dep-info,link -L dependency=/home/hauleth/Workspace/inter/target -L dependency=/home/hauleth/Workspace/inter/target/deps --extern num=/home/hauleth/Workspace/inter/target/deps/libnum-05305060c7d6f43b.rlib`
     Running `rustc src/lib.rs --crate-name inter --crate-type lib -g --test -C metadata=5cc7200d4891a42a -C extra-filename=-5cc7200d4891a42a --out-dir /home/hauleth/Workspace/inter/target --emit=dep-info,link -L dependency=/home/hauleth/Workspace/inter/target -L dependency=/home/hauleth/Workspace/inter/target/deps --extern num=/home/hauleth/Workspace/inter/target/deps/libnum-05305060c7d6f43b.rlib`
     Running `rustc examples/sinus.rs --crate-name sinus --crate-type bin -g --out-dir /home/hauleth/Workspace/inter/target/examples --emit=dep-info,link -L dependency=/home/hauleth/Workspace/inter/target -L dependency=/home/hauleth/Workspace/inter/target/deps --extern num=/home/hauleth/Workspace/inter/target/deps/libnum-05305060c7d6f43b.rlib --extern inter=/home/hauleth/Workspace/inter/target/libinter-7a3684a129aeb871.rlib`
     Running `rustc examples/rounding.rs --crate-name rounding --crate-type bin -g --out-dir /home/hauleth/Workspace/inter/target/examples --emit=dep-info,link -L dependency=/home/hauleth/Workspace/inter/target -L dependency=/home/hauleth/Workspace/inter/target/deps --extern num=/home/hauleth/Workspace/inter/target/deps/libnum-05305060c7d6f43b.rlib --extern inter=/home/hauleth/Workspace/inter/target/libinter-7a3684a129aeb871.rlib`
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'assertion failed: bpos.to_usize() >= mbc.pos.to_usize() + mbc.bytes', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libsyntax/codemap.rs:734


Build failed, waiting for other jobs to finish...
Could not compile `inter`.

Caused by:
  Process didn't exit successfully: `rustc examples/sinus.rs --crate-name sinus --crate-type bin -g --out-dir /home/hauleth/Workspace/inter/target/examples --emit=dep-info,link -L dependency=/home/hauleth/Workspace/inter/target -L dependency=/home/hauleth/Workspace/inter/target/deps --extern num=/home/hauleth/Workspace/inter/target/deps/libnum-05305060c7d6f43b.rlib --extern inter=/home/hauleth/Workspace/inter/target/libinter-7a3684a129aeb871.rlib` (exit code: 101)

Code fixup

It is fixed in master by joining feature gates in one call.

Meta

rustc --version --verbose:

rustc 1.0.0-nightly (3b3bb0e68 2015-03-04) (built 2015-03-05)
binary: rustc
commit-hash: 3b3bb0e682c2d252e9f62dd9df5cff9552af91ad
commit-date: 2015-03-04
build-date: 2015-03-05
host: x86_64-unknown-linux-gnu
release: 1.0.0-nightly

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-mediumMedium priority

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions