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

//@ dont-require-annotations: NOTE

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
    //~| NOTE expected signature `unsafe fn(&_) -> _`
    //~| NOTE found signature `fn(&_) -> _`
}

fn main() { }