diff options
Diffstat (limited to 'src/test/ui/typeck/typeck-fn-to-unsafe-fn-ptr.rs')
-rw-r--r-- | src/test/ui/typeck/typeck-fn-to-unsafe-fn-ptr.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/test/ui/typeck/typeck-fn-to-unsafe-fn-ptr.rs b/src/test/ui/typeck/typeck-fn-to-unsafe-fn-ptr.rs new file mode 100644 index 000000000..1e954f569 --- /dev/null +++ b/src/test/ui/typeck/typeck-fn-to-unsafe-fn-ptr.rs @@ -0,0 +1,12 @@ +// 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); } +} |