Rust: ICE: assertion failed: `(left == right)` in type_of.rs

Created on 13 Jul 2019  路  14Comments  路  Source: rust-lang/rust

I just ran into this ICE:

thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `Size { raw: 404 }`,
 right: `Size { raw: 400 }`', src/librustc_codegen_llvm/type_of.rs:148:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

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: rustc 1.38.0-nightly (71f9384e3 2019-07-12) running on armv7-unknown-linux-gnueabihf

note: compiler flags: -C opt-level=3 --crate-type lib

note: some of the compiler flags provided by cargo are hidden

https://github.com/rust-lang/rust/blob/master/src/librustc_codegen_llvm/type_of.rs#L148

I can't share the code but here are some observations:

  • The ICE occurs in debug mode as well.
  • It does not occur when running cargo check.
  • It does not occur on my MacBook (same nightly, different architecture).


A-async-await A-codegen A-generators AsyncAwait-OnDeck C-bug F-async_await I-ICE I-nominated O-ARM P-high T-compiler regression-from-stable-to-nightly

Most helpful comment

OK, I managed to extract a standalone reproduction:

https://github.com/jbg/rust-ice-repro

All 14 comments

Can you try to isolate the code, e.g. produce some code (not longer than 50 lines) that reproduces this issue?

I have no idea where to even start. Maybe a cargo-bisect-rustc run will help.

How big is the code? You could start by removing 'mod xxx' in your main.rs. Remove types that are not needed. Then if you only have a few files left, merge them into one and remove more things (e.g. not needed functions, structs, enums), try to replace macros with their actual content.

Using cargo-bisect-rustc I have determined that the ICE started to appear with 853f30052d019a8ebe197a5adff3a29d6716a955 (#62407). I'll try to isolate the code now.

i'm hitting this too, will see if i can make a small repro.

building for armv7-unknown-linux-gnueabihf target from a linux x86_64 host.

My project doesn't build for ARM even with rustc 1.37.0-nightly (088b98730 2019-07-03), which casts doubt on the above rollup merge containing the cause, I think. (Also possible that there are two similar bugs introduced at different times.) I'll try to bisect.

thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `Size { raw: 604 }`,
 right: `Size { raw: 600 }`', src/librustc_codegen_llvm/type_of.rs:148:9

My bisect indicates the regression was introduced in 848e0a23f34aaab3e4a974b031c86ef2a4e4fcc1. Armed with this clue I'm trying to figure out which part of my (giant) project is triggering it in order to make a repro.

I've narrowed down the block of code that triggers the regression, and simplified it to the extent possible, but when extracted from the project it no longer causes rustc to panic. In case it's useful:

let line: Bytes = ...;
match inner.current_state {
  _ if line.starts_with(b"+CUSD: ") => {
    let mut remainder = Cursor::new(&line[9..]);
    let mut ussd_bytes: Vec<u8> = Vec::new();
    remainder.read_until(0x2c, &mut ussd_bytes)?;    //  <-----
    inner.handle_ussd().await?;
  },
  // ...
}

If the line with the arrow is commented out, the code compiles. Uncommented, it fails with:

$ cargo build --release --target armv7-unknown-linux-gnueabihf
thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `Size { raw: 604 }`,
 right: `Size { raw: 600 }`', src/librustc_codegen_llvm/type_of.rs:148:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
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: rustc 1.38.0-nightly (dddb7fca0 2019-07-30) running on x86_64-unknown-linux-gnu
note: compiler flags: -C opt-level=3 -C panic=abort -C linker=arm-linux-gnueabihf-gcc --crate-type bin

Will update if I have any success producing a standalone reproduction.

OK, I managed to extract a standalone reproduction:

https://github.com/jbg/rust-ice-repro

cc @tmandry @matthewjasper

I added a comment in the repo; you can make it build or fail to build by just reversing the order of two lines of code.

I updated the repo by folding a minimised implementation of QrwLock into it rather than depending on the crate, since QrwLock seemed to be necessary to trigger the bug. In doing so I updated QrwLock to std::future and the ICE disappeared. Adding .compat().compat() to round-trip the future through a 0.1 Future brings the ICE back. (see comments in src/main.rs)

@rustbot claim

Thanks for reporting this! Fix should be landing soon.

Was this page helpful?
0 / 5 - 0 ratings