]> git.lizzy.rs Git - rust.git/blob - src/test/ui/unsafe/unsafe-subtyping.rs
Auto merge of #103894 - mati865:gnullvm-libunwind-changes, r=thomcc
[rust.git] / src / test / ui / unsafe / unsafe-subtyping.rs
1 // Check that safe fns are not a subtype of unsafe fns.
2
3 fn foo(x: Option<fn(i32)>) -> Option<unsafe fn(i32)> {
4     x //~ ERROR mismatched types
5 }
6
7 fn bar(x: fn(i32)) -> unsafe fn(i32) {
8     x // OK, coercion!
9 }
10
11 fn main() { }