add test for ICE: min_specialization: Ok(['?0, Const { ty: usize, kind: Leaf(0x0000000000000000) }]) is not fully resolved #113045

Fixes https://github.com/rust-lang/rust/issues/113045
This commit is contained in:
Matthias Krüger 2024-03-24 10:19:25 +01:00
parent cdea6d8382
commit b151e06659
2 changed files with 36 additions and 0 deletions

View File

@ -0,0 +1,15 @@
// ICE min_specialization:
// Ok(['?0, Const { ty: usize, kind: Leaf(0x0000000000000000) }]) is not fully resolved
// issue: rust-lang/rust#113045
#![feature(min_specialization)]
trait X {}
impl<'a, const N: usize> X for [(); N] {}
impl<'a, Unconstrained> X for [(); 0] {}
//~^ ERROR the type parameter `Unconstrained` is not constrained by the impl trait, self type, or predicates
//~| ERROR specialization impl does not specialize any associated items
fn main() {}

View File

@ -0,0 +1,21 @@
error[E0207]: the type parameter `Unconstrained` is not constrained by the impl trait, self type, or predicates
--> $DIR/ice-const-not-fully-resolved-113045.rs:11:10
|
LL | impl<'a, Unconstrained> X for [(); 0] {}
| ^^^^^^^^^^^^^ unconstrained type parameter
error: specialization impl does not specialize any associated items
--> $DIR/ice-const-not-fully-resolved-113045.rs:11:1
|
LL | impl<'a, Unconstrained> X for [(); 0] {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: impl is a specialization of this impl
--> $DIR/ice-const-not-fully-resolved-113045.rs:9:1
|
LL | impl<'a, const N: usize> X for [(); N] {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0207`.