summaryrefslogtreecommitdiffstats
path: root/tests/ui/consts/missing_span_in_backtrace.rs
blob: dd2b81c5af2bc93171c26e86d80175aae019bc60 (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
// compile-flags: -Z ui-testing=no
// normalize-stderr-test "alloc[0-9]+" -> "ALLOC_ID"

#![feature(const_swap)]
#![feature(const_mut_refs)]
use std::{
    mem::{self, MaybeUninit},
    ptr,
};

const X: () = {
    let mut ptr1 = &1;
    let mut ptr2 = &2;

    // Swap them, bytewise.
    unsafe {
        ptr::swap_nonoverlapping(
            &mut ptr1 as *mut _ as *mut MaybeUninit<u8>,
            &mut ptr2 as *mut _ as *mut MaybeUninit<u8>,
            mem::size_of::<&i32>(),
        );
    }
};

fn main() {
    X
}