Skip to content

Commit bf13792

Browse files
committed
Fix lint-unsafe-code test from #22542
1 parent e82cd26 commit bf13792

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/test/compile-fail/lint-unsafe-code.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,16 @@
1212
#![allow(dead_code)]
1313
#![deny(unsafe_code)]
1414

15+
use std::marker::PhantomFn;
16+
1517
struct Bar;
1618

1719
#[allow(unsafe_code)]
1820
mod allowed_unsafe {
21+
use std::marker::PhantomFn;
1922
fn allowed() { unsafe {} }
2023
unsafe fn also_allowed() {}
21-
unsafe trait AllowedUnsafe {}
24+
unsafe trait AllowedUnsafe : PhantomFn<Self> {}
2225
unsafe impl AllowedUnsafe for super::Bar {}
2326
}
2427

@@ -29,7 +32,7 @@ macro_rules! unsafe_in_macro {
2932
}
3033

3134
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
3336
unsafe impl Foo for Bar {} //~ ERROR: implementation of an `unsafe` trait
3437

3538
trait Baz {

0 commit comments

Comments
 (0)