Skip to content

Commit

Permalink
Rollup merge of rust-lang#53790 - zilbuz:issue-52060, r=nikomatsakis
Browse files Browse the repository at this point in the history
Add regression test for issue rust-lang#52060

Fix rust-lang#52060
  • Loading branch information
kennytm committed Sep 1, 2018
2 parents fcd76b4 + 251f262 commit 88ebbe9
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 88ebbe9

Please sign in to comment.