aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/unsafe8.rs
blob: 03fe4910c979cc9c0b96e546fe8eb3dab110fdfe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
struct S;

impl S {
    unsafe fn foo(self) {}
}

fn main() {
    let s = S;
    s.foo(); // { dg-error "call to unsafe method" }

    unsafe {
        s.foo();
    }
}