File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change 1+ // Regression test for https://github.com/rust-lang/rust/issues/52060
2+ // The compiler shouldn't ICE in this case
3+ static A : & ' static [ u32 ] = & [ 1 ] ;
4+ static B : [ u32 ; 1 ] = [ 0 ; A . len ( ) ] ;
5+ //~^ ERROR [E0013]
6+ //~| ERROR `core::slice::<impl [T]>::len` is not yet stable as a const fn
7+
8+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ error[E0013]: constants cannot refer to statics, use a constant instead
2+ --> $DIR/issue-52060.rs:4:26
3+ |
4+ LL | static B: [u32; 1] = [0; A.len()];
5+ | ^
6+
7+ error: `core::slice::<impl [T]>::len` is not yet stable as a const fn
8+ --> $DIR/issue-52060.rs:4:26
9+ |
10+ LL | static B: [u32; 1] = [0; A.len()];
11+ | ^^^^^^^
12+ |
13+ = help: in Nightly builds, add `#![feature(const_slice_len)]` to the crate attributes to enable
14+
15+ error: aborting due to 2 previous errors
16+
17+ For more information about this error, try `rustc --explain E0013`.
You can’t perform that action at this time.
0 commit comments