add test for ice #90691 ICE: resolution failed during building vtable representation

Fixes #90691
This commit is contained in:
Matthias Krüger 2024-03-22 18:36:16 +01:00
parent f44ee8f87d
commit 5ae90256da
1 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,41 @@
// ICE #90691 Encountered error `Unimplemented` selecting ...
//@ build-pass
trait TError: std::fmt::Debug {}
impl TError for () {}
trait SuperTrait {
type Error;
}
trait Trait: SuperTrait<Error: TError> {}
impl<T> Trait for T
where
T: SuperTrait,
<T as SuperTrait>::Error: TError,
{
}
struct SomeTrait<S>(S);
struct BoxedTrait(Box<dyn Trait<Error = ()>>);
impl<S: 'static> From<SomeTrait<S>> for BoxedTrait {
fn from(other: SomeTrait<S>) -> Self {
Self(Box::new(other))
}
}
impl<S> SuperTrait for SomeTrait<S> {
type Error = ();
}
impl From<()> for BoxedTrait {
fn from(c: ()) -> Self {
Self::from(SomeTrait(c))
}
}
fn main() {
let _: BoxedTrait = ().into();
}