Rollup merge of #53790 - zilbuz:issue-52060, r=nikomatsakis
Add regression test for issue #52060 Fix #52060
This commit is contained in:
commit
88ebbe98bb
8
src/test/ui/issues/issue-52060.rs
Normal file
8
src/test/ui/issues/issue-52060.rs
Normal file
@ -0,0 +1,8 @@
|
||||
// Regression test for https://github.com/rust-lang/rust/issues/52060
|
||||
// The compiler shouldn't ICE in this case
|
||||
static A: &'static [u32] = &[1];
|
||||
static B: [u32; 1] = [0; A.len()];
|
||||
//~^ ERROR [E0013]
|
||||
//~| ERROR `core::slice::<impl [T]>::len` is not yet stable as a const fn
|
||||
|
||||
fn main() {}
|
17
src/test/ui/issues/issue-52060.stderr
Normal file
17
src/test/ui/issues/issue-52060.stderr
Normal file
@ -0,0 +1,17 @@
|
||||
error[E0013]: constants cannot refer to statics, use a constant instead
|
||||
--> $DIR/issue-52060.rs:4:26
|
||||
|
|
||||
LL | static B: [u32; 1] = [0; A.len()];
|
||||
| ^
|
||||
|
||||
error: `core::slice::<impl [T]>::len` is not yet stable as a const fn
|
||||
--> $DIR/issue-52060.rs:4:26
|
||||
|
|
||||
LL | static B: [u32; 1] = [0; A.len()];
|
||||
| ^^^^^^^
|
||||
|
|
||||
= help: in Nightly builds, add `#![feature(const_slice_len)]` to the crate attributes to enable
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0013`.
|
Loading…
Reference in New Issue
Block a user