]> git.lizzy.rs Git - rust.git/blob - src/test/ui/unsafe/unsafe-trait-impl.rs
Rollup merge of #103033 - alyssais:pkg-config, r=joshtriplett
[rust.git] / src / test / 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 fn pointer `unsafe fn(&u32) -> _`
11     //~| found fn pointer `fn(&u32) -> _`
12 }
13
14 fn main() { }