rust/tests/ui/typeck/typeck-fn-to-unsafe-fn-ptr.rs

13 lines
235 B
Rust

//@ run-pass
// This tests reification from safe function to `unsafe fn` pointer
fn do_nothing() -> () {}
unsafe fn call_unsafe(func: unsafe fn() -> ()) -> () {
func()
}
pub fn main() {
unsafe { call_unsafe(do_nothing); }
}