summaryrefslogtreecommitdiffstats
path: root/src/test/ui/unsafe/unsafe-trait-impl.rs
blob: 03a251be1a9141572c001b7ad5ce2822e79533ee (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 fn pointer `unsafe fn(&u32) -> _`
    //~| found fn pointer `fn(&u32) -> _`
}

fn main() { }