]> git.lizzy.rs Git - rust.git/commitdiff
Fix lint-unsafe-code test from #22542
authorManish Goregaokar <manishsmail@gmail.com>
Sat, 21 Feb 2015 05:11:52 +0000 (10:41 +0530)
committerManish Goregaokar <manishsmail@gmail.com>
Sat, 21 Feb 2015 20:23:18 +0000 (01:53 +0530)
src/test/compile-fail/lint-unsafe-code.rs

index 486e7142f27234047a620ba000f2a6b44a05844b..7b17d8877572f14b6ee5b34474c7cb65c1f5164d 100644 (file)
 #![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 {