]> git.lizzy.rs Git - rust.git/blob - src/test/ui/traits/safety-fn-body.rs
:arrow_up: rust-analyzer
[rust.git] / src / test / ui / traits / safety-fn-body.rs
1 // Check that an unsafe impl does not imply that unsafe actions are
2 // legal in the methods.
3
4 // revisions: mir thir
5 // [thir]compile-flags: -Z thir-unsafeck
6
7 unsafe trait UnsafeTrait : Sized {
8     fn foo(self) { }
9 }
10
11 unsafe impl UnsafeTrait for *mut isize {
12     fn foo(self) {
13         // Unsafe actions are not made legal by taking place in an unsafe trait:
14         *self += 1;
15         //~^ ERROR E0133
16     }
17 }
18
19 fn main() { }