]>
Commit | Line | Data |
---|---|---|
416331ca | 1 | // run-pass |
c34b1796 | 2 | // Check that safe fns are not a subtype of unsafe fns. |
223e47cc | 3 | |
c34b1796 AL |
4 | |
5 | fn foo(x: i32) -> i32 { | |
6 | x * 22 | |
223e47cc LB |
7 | } |
8 | ||
c34b1796 AL |
9 | fn bar(x: fn(i32) -> i32) -> unsafe fn(i32) -> i32 { |
10 | x // OK, coercion! | |
223e47cc LB |
11 | } |
12 | ||
13 | fn main() { | |
c34b1796 AL |
14 | let f = bar(foo); |
15 | let x = unsafe { f(2) }; | |
16 | assert_eq!(x, 44); | |
223e47cc | 17 | } |