aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/cfail/used-free-interrupt-2.rs21
-rw-r--r--tests/cpass/binds.rs25
2 files changed, 46 insertions, 0 deletions
diff --git a/tests/cfail/used-free-interrupt-2.rs b/tests/cfail/used-free-interrupt-2.rs
new file mode 100644
index 00000000..f9aab78e
--- /dev/null
+++ b/tests/cfail/used-free-interrupt-2.rs
@@ -0,0 +1,21 @@
+#![no_main]
+#![no_std]
+
+extern crate lm3s6965;
+extern crate panic_halt;
+extern crate rtfm;
+
+use rtfm::app;
+
+#[app(device = lm3s6965)]
+const APP: () = {
+ #[init]
+ fn init() {}
+
+ #[interrupt(binds = UART0)]
+ fn foo() {} //~ ERROR free interrupts (`extern { .. }`) can't be used as interrupt handlers
+
+ extern "C" {
+ fn UART0();
+ }
+};
diff --git a/tests/cpass/binds.rs b/tests/cpass/binds.rs
new file mode 100644
index 00000000..361f08fc
--- /dev/null
+++ b/tests/cpass/binds.rs
@@ -0,0 +1,25 @@
+//! Check that `binds` works as advertised
+#![no_main]
+#![no_std]
+
+extern crate lm3s6965;
+extern crate panic_halt;
+extern crate rtfm;
+
+use rtfm::app;
+
+#[app(device = lm3s6965)]
+const APP: () = {
+ #[init]
+ fn init() {}
+
+ #[exception(binds = SVCall)]
+ fn foo() {}
+
+ #[interrupt(binds = UART0)]
+ fn bar() {}
+};
+
+fn foo_trampoline(_: foo::Context) {}
+
+fn bar_trampoline(_: bar::Context) {}