about summary refs log tree commit diff
path: root/tests/ui/consts/missing_span_in_backtrace.rs
blob: 09a11c75fd7bd46ddd273a4f6d73b4838dabcca3 (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
//! 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

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
}