blob: b679493eb08ebabe397b4c469c7178670d80d1a3 [file] [log] [blame]
//! Check what happens when the error occurs inside a std function that we can't print the span of.
//@ ignore-backends: gcc
//@ compile-flags: -Z ui-testing=no --diagnostic-width=80
use std::{
mem::{self, MaybeUninit},
ptr,
};
const X: () = {
let mut x1 = 1;
let mut x2 = 2;
// Swap them, bytewise.
unsafe {
ptr::swap_nonoverlapping( //~ ERROR beyond the end of the allocation
&mut x1 as *mut _ as *mut MaybeUninit<u8>,
&mut x2 as *mut _ as *mut MaybeUninit<u8>,
10,
);
}
};
fn main() {
X
}