about summary refs log tree commit diff
path: root/src/test/ui/unsafe/unsafe-trait-impl.rs
blob: 7b76e006907aea34573a38fe44562cb6336af96d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// Check that safe fns are not a subtype of unsafe fns.

trait Foo {
    unsafe fn len(&self) -> u32;
}

impl Foo for u32 {
    fn len(&self) -> u32 { *self }
    //~^ ERROR method `len` has an incompatible type for trait
    //~| expected type `unsafe fn(&u32) -> u32`
    //~| found type `fn(&u32) -> u32`
}

fn main() { }