summaryrefslogtreecommitdiffstats
path: root/tests/ui/traits/safety-fn-body.rs
blob: 2cc4fe1b344a494be6ce56714eac35dcd0b9e4d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Check that an unsafe impl does not imply that unsafe actions are
// legal in the methods.

// revisions: mir thir
// [thir]compile-flags: -Z thir-unsafeck

unsafe trait UnsafeTrait : Sized {
    fn foo(self) { }
}

unsafe impl UnsafeTrait for *mut isize {
    fn foo(self) {
        // Unsafe actions are not made legal by taking place in an unsafe trait:
        *self += 1;
        //~^ ERROR E0133
    }
}

fn main() { }