File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 12
12
#![ allow( dead_code) ]
13
13
#![ deny( unsafe_code) ]
14
14
15
+ use std:: marker:: PhantomFn ;
16
+
15
17
struct Bar ;
16
18
17
19
#[ allow( unsafe_code) ]
18
20
mod allowed_unsafe {
21
+ use std:: marker:: PhantomFn ;
19
22
fn allowed ( ) { unsafe { } }
20
23
unsafe fn also_allowed ( ) { }
21
- unsafe trait AllowedUnsafe { }
24
+ unsafe trait AllowedUnsafe : PhantomFn < Self > { }
22
25
unsafe impl AllowedUnsafe for super :: Bar { }
23
26
}
24
27
@@ -29,7 +32,7 @@ macro_rules! unsafe_in_macro {
29
32
}
30
33
31
34
unsafe fn baz ( ) { } //~ ERROR: declaration of an `unsafe` function
32
- unsafe trait Foo { } //~ ERROR: declaration of an `unsafe` trait
35
+ unsafe trait Foo : PhantomFn < Self > { } //~ ERROR: declaration of an `unsafe` trait
33
36
unsafe impl Foo for Bar { } //~ ERROR: implementation of an `unsafe` trait
34
37
35
38
trait Baz {
You can’t perform that action at this time.
0 commit comments