From 5ae90256daff3442ffe823035b79001b49c28ee1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Fri, 22 Mar 2024 18:36:16 +0100 Subject: [PATCH] add test for ice #90691 ICE: resolution failed during building vtable representation Fixes #90691 --- ...uilding-vtable-representation-ice-90691.rs | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 tests/ui/associated-type-bounds/resolution-failure-building-vtable-representation-ice-90691.rs diff --git a/tests/ui/associated-type-bounds/resolution-failure-building-vtable-representation-ice-90691.rs b/tests/ui/associated-type-bounds/resolution-failure-building-vtable-representation-ice-90691.rs new file mode 100644 index 000000000000..33776809a791 --- /dev/null +++ b/tests/ui/associated-type-bounds/resolution-failure-building-vtable-representation-ice-90691.rs @@ -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 {} + +impl Trait for T +where + T: SuperTrait, + ::Error: TError, +{ +} + +struct SomeTrait(S); +struct BoxedTrait(Box>); + +impl From> for BoxedTrait { + fn from(other: SomeTrait) -> Self { + Self(Box::new(other)) + } +} + +impl SuperTrait for SomeTrait { + type Error = (); +} + +impl From<()> for BoxedTrait { + fn from(c: ()) -> Self { + Self::from(SomeTrait(c)) + } +} + +fn main() { + let _: BoxedTrait = ().into(); +}