From fb7368e658ed175a35cdf4a33a02b356aa139523 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Mon, 17 Sep 2018 20:12:25 +0200 Subject: implement `#[interrupt]` --- cortex-m-rt/tests/compile-fail/interrupt-invalid.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 cortex-m-rt/tests/compile-fail/interrupt-invalid.rs (limited to 'cortex-m-rt/tests/compile-fail/interrupt-invalid.rs') diff --git a/cortex-m-rt/tests/compile-fail/interrupt-invalid.rs b/cortex-m-rt/tests/compile-fail/interrupt-invalid.rs new file mode 100644 index 0000000..4e79e7d --- /dev/null +++ b/cortex-m-rt/tests/compile-fail/interrupt-invalid.rs @@ -0,0 +1,21 @@ +#![no_main] +#![no_std] + +extern crate cortex_m_rt; +extern crate panic_halt; + +use cortex_m_rt::{entry, interrupt}; + +#[entry] +fn foo() -> ! { + loop {} +} + +enum interrupt { + USART1, +} + +// NOTE this looks a bit better when using a device crate: +// "no variant named `foo` found for type `stm32f30x::Interrupt` in the current scope" +#[interrupt] //~ ERROR no variant named `foo` found for type `interrupt` in the current scope +fn foo() {} -- cgit v1.2.3 From 1f08b692ab1ba37a09cbcdd73469225db5d67aad Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Tue, 22 Jan 2019 09:54:45 +0100 Subject: update cfail tests to make them pass with latest nightly --- cortex-m-rt/tests/compile-fail/duplicate-static.rs | 1 + cortex-m-rt/tests/compile-fail/interrupt-args.rs | 1 + cortex-m-rt/tests/compile-fail/interrupt-bad-signature-1.rs | 1 + cortex-m-rt/tests/compile-fail/interrupt-bad-signature-2.rs | 1 + cortex-m-rt/tests/compile-fail/interrupt-invalid.rs | 5 +++-- cortex-m-rt/tests/compile-fail/interrupt-soundness.rs | 1 + 6 files changed, 8 insertions(+), 2 deletions(-) (limited to 'cortex-m-rt/tests/compile-fail/interrupt-invalid.rs') diff --git a/cortex-m-rt/tests/compile-fail/duplicate-static.rs b/cortex-m-rt/tests/compile-fail/duplicate-static.rs index fccb65f..eeb884f 100644 --- a/cortex-m-rt/tests/compile-fail/duplicate-static.rs +++ b/cortex-m-rt/tests/compile-fail/duplicate-static.rs @@ -6,6 +6,7 @@ extern crate panic_halt; use cortex_m_rt::{entry, exception, interrupt}; +#[allow(non_camel_case_types)] enum interrupt { UART0, } diff --git a/cortex-m-rt/tests/compile-fail/interrupt-args.rs b/cortex-m-rt/tests/compile-fail/interrupt-args.rs index 9630ce1..1e06ec2 100644 --- a/cortex-m-rt/tests/compile-fail/interrupt-args.rs +++ b/cortex-m-rt/tests/compile-fail/interrupt-args.rs @@ -11,6 +11,7 @@ fn foo() -> ! { loop {} } +#[allow(non_camel_case_types)] enum interrupt { USART1, } diff --git a/cortex-m-rt/tests/compile-fail/interrupt-bad-signature-1.rs b/cortex-m-rt/tests/compile-fail/interrupt-bad-signature-1.rs index c7e25b3..bd5ff9f 100644 --- a/cortex-m-rt/tests/compile-fail/interrupt-bad-signature-1.rs +++ b/cortex-m-rt/tests/compile-fail/interrupt-bad-signature-1.rs @@ -11,6 +11,7 @@ fn foo() -> ! { loop {} } +#[allow(non_camel_case_types)] enum interrupt { USART1, } diff --git a/cortex-m-rt/tests/compile-fail/interrupt-bad-signature-2.rs b/cortex-m-rt/tests/compile-fail/interrupt-bad-signature-2.rs index ed5cbd4..56db222 100644 --- a/cortex-m-rt/tests/compile-fail/interrupt-bad-signature-2.rs +++ b/cortex-m-rt/tests/compile-fail/interrupt-bad-signature-2.rs @@ -11,6 +11,7 @@ fn foo() -> ! { loop {} } +#[allow(non_camel_case_types)] enum interrupt { USART1, } diff --git a/cortex-m-rt/tests/compile-fail/interrupt-invalid.rs b/cortex-m-rt/tests/compile-fail/interrupt-invalid.rs index 4e79e7d..9b1482a 100644 --- a/cortex-m-rt/tests/compile-fail/interrupt-invalid.rs +++ b/cortex-m-rt/tests/compile-fail/interrupt-invalid.rs @@ -11,11 +11,12 @@ fn foo() -> ! { loop {} } +#[allow(non_camel_case_types)] enum interrupt { USART1, } // NOTE this looks a bit better when using a device crate: // "no variant named `foo` found for type `stm32f30x::Interrupt` in the current scope" -#[interrupt] //~ ERROR no variant named `foo` found for type `interrupt` in the current scope -fn foo() {} +#[interrupt] +fn foo() {} //~ ERROR no variant named `foo` found for type `interrupt` in the current scope diff --git a/cortex-m-rt/tests/compile-fail/interrupt-soundness.rs b/cortex-m-rt/tests/compile-fail/interrupt-soundness.rs index b473a94..74e5e79 100644 --- a/cortex-m-rt/tests/compile-fail/interrupt-soundness.rs +++ b/cortex-m-rt/tests/compile-fail/interrupt-soundness.rs @@ -11,6 +11,7 @@ fn foo() -> ! { loop {} } +#[allow(non_camel_case_types)] enum interrupt { USART1, USART2, -- cgit v1.2.3 From c8916fe8b724d087e30c745a568bd60f0342fb91 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Thu, 21 Nov 2019 18:22:04 +0100 Subject: Fix interrupt-invalid.rs on stable --- cortex-m-rt/tests/compile-fail/interrupt-invalid.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cortex-m-rt/tests/compile-fail/interrupt-invalid.rs') diff --git a/cortex-m-rt/tests/compile-fail/interrupt-invalid.rs b/cortex-m-rt/tests/compile-fail/interrupt-invalid.rs index 9b1482a..4e568eb 100644 --- a/cortex-m-rt/tests/compile-fail/interrupt-invalid.rs +++ b/cortex-m-rt/tests/compile-fail/interrupt-invalid.rs @@ -19,4 +19,4 @@ enum interrupt { // NOTE this looks a bit better when using a device crate: // "no variant named `foo` found for type `stm32f30x::Interrupt` in the current scope" #[interrupt] -fn foo() {} //~ ERROR no variant named `foo` found for type `interrupt` in the current scope +fn foo() {} //~ ERROR no variant or associated item named `foo` found for type `interrupt` in the current scope -- cgit v1.2.3 From 1d790bd2858b2c1827322eb872a2e05f05bcd694 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Thu, 21 Nov 2019 22:06:33 +0100 Subject: Rename a function to not collide Functions with the same name in the same module will now collide (just like they do in normal Rust code) --- cortex-m-rt/tests/compile-fail/interrupt-invalid.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cortex-m-rt/tests/compile-fail/interrupt-invalid.rs') diff --git a/cortex-m-rt/tests/compile-fail/interrupt-invalid.rs b/cortex-m-rt/tests/compile-fail/interrupt-invalid.rs index 4e568eb..e915518 100644 --- a/cortex-m-rt/tests/compile-fail/interrupt-invalid.rs +++ b/cortex-m-rt/tests/compile-fail/interrupt-invalid.rs @@ -7,7 +7,7 @@ extern crate panic_halt; use cortex_m_rt::{entry, interrupt}; #[entry] -fn foo() -> ! { +fn entry() -> ! { loop {} } -- cgit v1.2.3 From ed2df63ff3b2ff3e69ec62c32e321f81bc7047fb Mon Sep 17 00:00:00 2001 From: Emil Fresk Date: Mon, 30 Mar 2020 10:06:55 +0200 Subject: New compile-fail string for interrupt-invalid --- cortex-m-rt/tests/compile-fail/interrupt-invalid.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cortex-m-rt/tests/compile-fail/interrupt-invalid.rs') diff --git a/cortex-m-rt/tests/compile-fail/interrupt-invalid.rs b/cortex-m-rt/tests/compile-fail/interrupt-invalid.rs index e915518..f2ec718 100644 --- a/cortex-m-rt/tests/compile-fail/interrupt-invalid.rs +++ b/cortex-m-rt/tests/compile-fail/interrupt-invalid.rs @@ -19,4 +19,4 @@ enum interrupt { // NOTE this looks a bit better when using a device crate: // "no variant named `foo` found for type `stm32f30x::Interrupt` in the current scope" #[interrupt] -fn foo() {} //~ ERROR no variant or associated item named `foo` found for type `interrupt` in the current scope +fn foo() {} //~ ERROR no variant or associated item named `foo` found for enum `interrupt` in the current scope [E0599] -- cgit v1.2.3