rust/tests/ui/consts/missing_span_in_backtrace.rs
2024-09-15 09:51:32 +02:00

27 lines
445 B
Rust

//@ compile-flags: -Z ui-testing=no
#![feature(const_swap)]
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
}