Skip to content

Commit 8ee8d26

Browse files
author
Lukas Markeffsky
committed
miri: normalize struct tail in ABI compat check
1 parent f9304df commit 8ee8d26

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)