Skip to content

Commit

Permalink
Add regression test for issue rust-lang#52060
Browse files Browse the repository at this point in the history
  • Loading branch information
zilbuz committed Aug 30, 2018
1 parent ba48850 commit 251f262
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/test/ui/issues/issue-52060.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 17 additions & 0 deletions src/test/ui/issues/issue-52060.stderr
Original file line number Diff line number Diff line change
@@ -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`.

0 comments on commit 251f262

Please sign in to comment.