summaryrefslogtreecommitdiffstats
path: root/src/test/ui/unsafe/unsafe-fn-used-as-value.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/unsafe/unsafe-fn-used-as-value.rs')
-rw-r--r--src/test/ui/unsafe/unsafe-fn-used-as-value.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/test/ui/unsafe/unsafe-fn-used-as-value.rs b/src/test/ui/unsafe/unsafe-fn-used-as-value.rs
new file mode 100644
index 000000000..9517598c7
--- /dev/null
+++ b/src/test/ui/unsafe/unsafe-fn-used-as-value.rs
@@ -0,0 +1,11 @@
+// revisions: mir thir
+// [thir]compile-flags: -Z thir-unsafeck
+
+unsafe fn f() { return; }
+
+fn main() {
+ let x = f;
+ x();
+ //[mir]~^ ERROR call to unsafe function is unsafe
+ //[thir]~^^ ERROR call to unsafe function `f` is unsafe
+}