Skip to content

Commit 251f262

Browse files
committed
Add regression test for issue #52060
1 parent ba48850 commit 251f262

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/test/ui/issues/issue-52060.rs

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
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() {}

src/test/ui/issues/issue-52060.stderr

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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`.

0 commit comments

Comments
 (0)