about summary refs log tree commit diff
path: root/src/tools/clippy/tests/ui/missing_transmute_annotations_unfixable.rs
blob: 08ba3b791ee7677bdcb83f589b7040ac690e533e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//@no-rustfix

fn issue14984() {
    async fn e() {}
    async fn x() -> u32 {
        0
    }
    async fn y() -> f32 {
        0.0
    };
    let mut yy = unsafe { std::ptr::read(&y()) };
    yy = unsafe { std::mem::transmute(std::ptr::read(&x())) };
    //~^ missing_transmute_annotations

    let mut zz = 0u8;
    zz = unsafe { std::mem::transmute(std::ptr::read(&x())) };
    //~^ missing_transmute_annotations

    yy = unsafe { std::mem::transmute(zz) };
    //~^ missing_transmute_annotations

    fn a() -> impl Sized {
        0u32
    }

    let mut b: f32 = 0.0;
    b = unsafe { std::mem::transmute(a()) };
    //~^ missing_transmute_annotations
}