]> git.lizzy.rs Git - rust.git/blob - tests/ui/unsafe/unsafe-subtyping.rs
Merge commit '1480cea393d0cee195e59949eabdfbcf1230f7f9' into clippyup
[rust.git] / tests / 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() { }