From 2e724d4f36d06e07a9d5c52028d683d4d60257b3 Mon Sep 17 00:00:00 2001 From: lcnr Date: Fri, 13 Feb 2026 12:51:47 +0000 Subject: [PATCH] add regression test (cherry picked from commit b4f38c1da4a7aa9d7065253f77a65a482a5a7993) --- .../ui/layout/rigid-alias-due-to-broken-impl.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 tests/ui/layout/rigid-alias-due-to-broken-impl.rs diff --git a/tests/ui/layout/rigid-alias-due-to-broken-impl.rs b/tests/ui/layout/rigid-alias-due-to-broken-impl.rs new file mode 100644 index 000000000000..912c660cb7ca --- /dev/null +++ b/tests/ui/layout/rigid-alias-due-to-broken-impl.rs @@ -0,0 +1,17 @@ +// Make sure we don't ICE if `layout_of` encounters an alias +// which is rigid due to a malformed program. A regression test +// for #152545. +// +// This specific ICE happens in the `KnownPanicsLint` visitor. + +//@ compile-flags: --crate-type=rlib +trait Foo { + type Assoc; +} + +// The trait solver only treats missng associated items +// as rigid if the self-type is known to be unsized. +impl Foo for str {} +//~^ ERROR not all trait items implemented + +fn foo(_: [u32; std::mem::size_of::<::Assoc>()]) {}