about summary refs log tree commit diff
path: root/tests/ui/consts/const-mut-refs/issue-76510.rs
blob: a6f7540dd59d6ddf3400a121963c3d56b00382ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
use std::mem::{transmute, ManuallyDrop};

const S: &'static mut str = &mut " hello ";
//~^ ERROR: mutable borrows of temporaries

const fn trigger() -> [(); unsafe {
        let s = transmute::<(*const u8, usize), &ManuallyDrop<str>>((S.as_ptr(), 3));
        0
    }] {
    [(); 0]
}

fn main() {}