Fix lint-unsafe-code test from #22542
This commit is contained in:
parent
59ab2daad3
commit
d316a34ec2
1 changed files with 5 additions and 2 deletions
|
@ -12,13 +12,16 @@
|
|||
#![allow(dead_code)]
|
||||
#![deny(unsafe_code)]
|
||||
|
||||
use std::marker::PhantomFn;
|
||||
|
||||
struct Bar;
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
mod allowed_unsafe {
|
||||
use std::marker::PhantomFn;
|
||||
fn allowed() { unsafe {} }
|
||||
unsafe fn also_allowed() {}
|
||||
unsafe trait AllowedUnsafe {}
|
||||
unsafe trait AllowedUnsafe : PhantomFn<Self> {}
|
||||
unsafe impl AllowedUnsafe for super::Bar {}
|
||||
}
|
||||
|
||||
|
@ -29,7 +32,7 @@ macro_rules! unsafe_in_macro {
|
|||
}
|
||||
|
||||
unsafe fn baz() {} //~ ERROR: declaration of an `unsafe` function
|
||||
unsafe trait Foo {} //~ ERROR: declaration of an `unsafe` trait
|
||||
unsafe trait Foo : PhantomFn<Self> {} //~ ERROR: declaration of an `unsafe` trait
|
||||
unsafe impl Foo for Bar {} //~ ERROR: implementation of an `unsafe` trait
|
||||
|
||||
trait Baz {
|
||||
|
|
Loading…
Add table
Reference in a new issue