Skip to content

Commit

Permalink
Fix lint-unsafe-code test from #22542
Browse files Browse the repository at this point in the history
  • Loading branch information
Manishearth committed Feb 21, 2015
1 parent 59ab2da commit d316a34
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/test/compile-fail/lint-unsafe-code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
}

Expand All @@ -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 {
Expand Down

0 comments on commit d316a34

Please sign in to comment.