about summary refs log tree commit diff
path: root/src/tools/miri/tests/pass/issues/issue-miri-3282-struct-tail-normalize.rs
blob: 2a31df83843e64095e8a81aabbba710ae9094dc2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// regression test for an ICE: https://github.com/rust-lang/miri/issues/3282

trait Id {
    type Assoc: ?Sized;
}

impl<T: ?Sized> Id for T {
    type Assoc = T;
}

#[repr(transparent)]
struct Foo<T: ?Sized> {
    field: <T as Id>::Assoc,
}

fn main() {
    let x = unsafe { std::mem::transmute::<fn(&str), fn(&Foo<str>)>(|_| ()) };
    let foo: &Foo<str> = unsafe { &*("uwu" as *const str as *const Foo<str>) };
    x(foo);
}