Skip to content

Commit 5e65e2b

Browse files
committed
Add a regression test for issue 62187
1 parent 70c14dd commit 5e65e2b

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// run-pass
2+
3+
#![feature(const_generics)]
4+
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
5+
6+
pub trait BitLen: Sized {
7+
const BIT_LEN: usize;
8+
}
9+
10+
impl<const L: usize> BitLen for [u8; L] {
11+
const BIT_LEN: usize = 8 * L;
12+
}
13+
14+
fn main() {
15+
let foo = <[u8; 2]>::BIT_LEN;
16+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
2+
--> $DIR/issue-62187-encountered-polymorphic-const.rs:3:12
3+
|
4+
LL | #![feature(const_generics)]
5+
| ^^^^^^^^^^^^^^
6+
|
7+
= note: `#[warn(incomplete_features)]` on by default
8+
9+
warning: unused variable: `foo`
10+
--> $DIR/issue-62187-encountered-polymorphic-const.rs:15:9
11+
|
12+
LL | let foo = <[u8; 2]>::BIT_LEN;
13+
| ^^^ help: consider prefixing with an underscore: `_foo`
14+
|
15+
= note: `#[warn(unused_variables)]` on by default
16+

0 commit comments

Comments
 (0)