Skip to content

Commit 3c83bb4

Browse files
committed
add some new ICE
1 parent 734d9d3 commit 3c83bb4

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
trait MyTrait: Copy {
2+
const ASSOC: usize;
3+
}
4+
5+
impl MyTrait for u8 {
6+
const ASSOC: usize = 32;
7+
}
8+
9+
const fn yeet() -> impl MyTrait {
10+
0u8
11+
}
12+
13+
const fn output<T: MyTrait>(_: T) -> usize {
14+
<T as MyTrait>::ASSOC
15+
}
16+
17+
fn main() {
18+
let x = [0u8; output(yeet())];
19+
println!("{:?}", x);
20+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
trait MyTrait: Copy {
2+
const ASSOC: usize;
3+
}
4+
5+
impl MyTrait for u8 {
6+
const ASSOC: usize = 32;
7+
}
8+
9+
const fn yeet() -> impl MyTrait {
10+
0u8
11+
}
12+
13+
const fn output<T: MyTrait>(_: T) -> usize {
14+
<T as MyTrait>::ASSOC
15+
}
16+
17+
#[repr(usize)]
18+
enum Foo {
19+
Bar = output(yeet()),
20+
}
21+
22+
fn main() {
23+
println!("{}", Foo::Bar as usize);
24+
}

0 commit comments

Comments
 (0)