add test for ice: unknown alias DefKind: AnonConst #116710

Fixes https://github.com/rust-lang/rust/issues/116710
This commit is contained in:
Matthias Krüger 2024-04-07 01:20:56 +02:00
parent 7c43bc0378
commit b976142439
2 changed files with 34 additions and 0 deletions

View file

@ -0,0 +1,15 @@
// ICE unknown alias DefKind: AnonConst
// issue: rust-lang/rust#116710
#![feature(generic_const_exprs)]
#![allow(incomplete_features)]
struct A<const N: u32 = 1, const M: u32 = u8>;
//~^ ERROR expected value, found builtin type `u8`
trait Trait {}
impl<const N: u32> Trait for A<N> {}
impl<const N: u32> Trait for A<N> {}
//~^ ERROR conflicting implementations of trait `Trait` for type `A<_>`
pub fn main() {}

View file

@ -0,0 +1,19 @@
error[E0423]: expected value, found builtin type `u8`
--> $DIR/unknown-alias-defkind-anonconst-ice-116710.rs:6:43
|
LL | struct A<const N: u32 = 1, const M: u32 = u8>;
| ^^ not a value
error[E0119]: conflicting implementations of trait `Trait` for type `A<_>`
--> $DIR/unknown-alias-defkind-anonconst-ice-116710.rs:12:1
|
LL | impl<const N: u32> Trait for A<N> {}
| --------------------------------- first implementation here
LL |
LL | impl<const N: u32> Trait for A<N> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `A<_>`
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0119, E0423.
For more information about an error, try `rustc --explain E0119`.