about summary refs log tree commit diff
path: root/tests/ui/rust-2024/unsafe-extern-blocks/unsafe-items.rs
blob: 50c97b51768ee5db554546df5fcc8f079c5e1514 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//@ revisions: edition2021 edition2024
//@[edition2021] edition:2021
//@[edition2024] edition:2024

unsafe extern "C" {
    unsafe static TEST1: i32;
    unsafe fn test1(i: i32);
}

fn test2() {
    unsafe {
        test1(TEST1);
    }
}

fn test3() {
    test1(TEST1);
    //~^ ERROR: call to unsafe function `test1` is unsafe
    //~| ERROR: use of extern static is unsafe
}

fn main() {}