Files
rust/tests/ui/consts/missing_span_in_backtrace.rs

27 lines
558 B
Rust
Raw Normal View History

//! 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
2023-10-15 17:00:11 +00:00
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
}