1 #![allow(unused_unsafe)]
11 fn allowed() { unsafe {} }
12 unsafe fn also_allowed() {}
13 unsafe trait AllowedUnsafe { }
14 unsafe impl AllowedUnsafe for super::Bar {}
17 macro_rules! unsafe_in_macro {
19 unsafe {} //~ ERROR: usage of an `unsafe` block
23 unsafe fn baz() {} //~ ERROR: declaration of an `unsafe` function
24 unsafe trait Foo {} //~ ERROR: declaration of an `unsafe` trait
25 unsafe impl Foo for Bar {} //~ ERROR: implementation of an `unsafe` trait
28 unsafe fn baz(&self); //~ ERROR: declaration of an `unsafe` method
29 unsafe fn provided(&self) {} //~ ERROR: implementation of an `unsafe` method
30 unsafe fn provided_override(&self) {} //~ ERROR: implementation of an `unsafe` method
34 unsafe fn baz(&self) {} //~ ERROR: implementation of an `unsafe` method
35 unsafe fn provided_override(&self) {} //~ ERROR: implementation of an `unsafe` method
41 unsafe fn allowed_unsafe(&self);
42 unsafe fn allowed_unsafe_provided(&self) {}
47 unsafe fn baz(&self) {}
48 unsafe fn provided_override(&self) {}
53 unsafe fn baz(&self) {}
54 unsafe fn provided_override(&self) {} //~ ERROR: implementation of an `unsafe` method
65 unsafe fn provided(&self) {} //~ ERROR: implementation of an `unsafe` method
70 unsafe fn baz(&self) {}
71 unsafe fn provided(&self) {} //~ ERROR: implementation of an `unsafe` method
75 unsafe fn baz(&self) {} //~ ERROR: implementation of an `unsafe` method
80 unsafe fn unsafe_provided(&self) {}
86 unsafe {} //~ ERROR: usage of an `unsafe` block