forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add regression test for issue rust-lang#52060
- Loading branch information
Showing
2 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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`. |