rust/tests/ui/traits/safety-fn-body.rs
Matthew Jasper 982b49494e Remove revisions for THIR unsafeck
This is to make the diff when stabilizing it easier to review.
2024-01-05 09:30:27 +00:00

17 lines
362 B
Rust

// Check that an unsafe impl does not imply that unsafe actions are
// legal in the methods.
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() { }