Skip to content

1.18.0 and nightly ICE: /checkout/src/librustc_trans/mir/constant.rs:377: _1 not initialized  #43197

Closed
@zhendongsu

Description

@zhendongsu
$ rustc --version
rustc 1.20.0-nightly (bf0a9e0b4 2017-07-10)
$ 
$ rustc tmp.rs
error[E0080]: constant evaluation error
 --> tmp.rs:3:18
  |
3 |    const B:i32 = A[0];	 
  |                  ^^^^ index out of bounds: the len is 0 but the index is 0

error: internal compiler error: /checkout/src/librustc_trans/mir/constant.rs:378: _1 not initialized
 --> tmp.rs:4:12
  |
4 |    let _ = &B;
  |            ^^

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.20.0-nightly (bf0a9e0b4 2017-07-10) running on x86_64-unknown-linux-gnu

thread 'rustc' panicked at 'Box<Any>', /checkout/src/librustc_errors/lib.rs:437:8
note: Run with `RUST_BACKTRACE=1` for a backtrace.

$ 
$ rustc-1.18.0 tmp.rs
error[E0080]: constant evaluation error
 --> tmp.rs:3:18
  |
3 |    const B:i32 = A[0];	 
  |                  ^^^^ index out of bounds: the len is 0 but the index is 0

error: internal compiler error: /checkout/src/librustc_trans/mir/constant.rs:377: _1 not initialized
 --> tmp.rs:4:12
  |
4 |    let _ = &B;
  |            ^^

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

thread 'rustc' panicked at 'Box<Any>', /checkout/src/librustc_errors/lib.rs:375
note: Run with `RUST_BACKTRACE=1` for a backtrace.

$ 
$ cat tmp.rs
fn main () {
   const A:&[i32] = &[];	
   const B:i32 = A[0];	 
   let _ = &B;
} 
$ 

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)C-bugCategory: This is a bug.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