]> git.lizzy.rs Git - rust.git/blob - src/test/ui/traits/safety-fn-body.rs
Add 'src/tools/rustfmt/' from commit '7872306edf2e11a69aaffb9434088fd66b46a863'
[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 unsafe trait UnsafeTrait : Sized {
5     fn foo(self) { }
6 }
7
8 unsafe impl UnsafeTrait for *mut isize {
9     fn foo(self) {
10         // Unsafe actions are not made legal by taking place in an unsafe trait:
11         *self += 1;
12         //~^ ERROR E0133
13     }
14 }
15
16 fn main() { }