Skip to content

Commit a6302b9

Browse files
authored
Rollup merge of #120587 - lukas-code:miri-tail-normalize, r=RalfJung
miri: normalize struct tail in ABI compat check fixes #3282 extracted from rust-lang/rust#120354, see rust-lang/rust#120354 (comment) for context r? ```@RalfJung```
2 parents b33c174 + 8ee8d26 commit a6302b9

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// regression test for an ICE: https://github.com/rust-lang/miri/issues/3282
2+
3+
trait Id {
4+
type Assoc: ?Sized;
5+
}
6+
7+
impl<T: ?Sized> Id for T {
8+
type Assoc = T;
9+
}
10+
11+
#[repr(transparent)]
12+
struct Foo<T: ?Sized> {
13+
field: <T as Id>::Assoc,
14+
}
15+
16+
fn main() {
17+
let x = unsafe { std::mem::transmute::<fn(&str), fn(&Foo<str>)>(|_| ()) };
18+
let foo: &Foo<str> = unsafe { &*("uwu" as *const str as *const Foo<str>) };
19+
x(foo);
20+
}

0 commit comments

Comments
 (0)