]> git.lizzy.rs Git - rust.git/blob - tests/ui/unsafe/unsafe-trait-impl.rs
Merge commit '1d8491b120223272b13451fc81265aa64f7f4d5b' into sync-from-rustfmt
[rust.git] / tests / ui / unsafe / unsafe-trait-impl.rs
1 // Check that safe fns are not a subtype of unsafe fns.
2
3 trait Foo {
4     unsafe fn len(&self) -> u32;
5 }
6
7 impl Foo for u32 {
8     fn len(&self) -> u32 { *self }
9     //~^ ERROR method `len` has an incompatible type for trait
10     //~| expected signature `unsafe fn(&u32) -> _`
11     //~| found signature `fn(&u32) -> _`
12 }
13
14 fn main() { }