summaryrefslogtreecommitdiffstats
path: root/src/test/ui/cast/cast-to-bare-fn.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/test/ui/cast/cast-to-bare-fn.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/test/ui/cast/cast-to-bare-fn.rs b/src/test/ui/cast/cast-to-bare-fn.rs
new file mode 100644
index 000000000..1992f2637
--- /dev/null
+++ b/src/test/ui/cast/cast-to-bare-fn.rs
@@ -0,0 +1,10 @@
+fn foo(_x: isize) { }
+
+fn main() {
+ let v: u64 = 5;
+ let x = foo as extern "C" fn() -> isize;
+ //~^ ERROR non-primitive cast
+ let y = v as extern "Rust" fn(isize) -> (isize, isize);
+ //~^ ERROR non-primitive cast
+ y(x());
+}