Skip to content

Commit 75c8227

Browse files
committed
Fix tests.
1 parent 87d8b04 commit 75c8227

12 files changed

+36
-24
lines changed

Diff for: cortex-m-rt/examples/divergent-default-handler.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
#![no_main]
33
#![no_std]
44

5-
extern crate cortex_m_rt;
65
extern crate panic_halt;
76

7+
use cortex_m::peripheral::scb::Vector;
88
use cortex_m_rt::{entry, exception};
99

1010
#[entry]
@@ -13,6 +13,6 @@ fn foo() -> ! {
1313
}
1414

1515
#[exception]
16-
unsafe fn DefaultHandler(_irqn: i16) -> ! {
16+
unsafe fn DefaultHandler(_irqn: Vector) -> ! {
1717
loop {}
1818
}

Diff for: cortex-m-rt/examples/override-exception.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,18 @@
44
#![no_main]
55
#![no_std]
66

7-
extern crate cortex_m;
8-
extern crate cortex_m_rt as rt;
97
extern crate panic_halt;
108

11-
use cortex_m::asm;
12-
use rt::{entry, exception, ExceptionFrame};
9+
use cortex_m::{asm, peripheral::scb::Vector};
10+
use cortex_m_rt::{entry, exception, ExceptionFrame};
1311

1412
#[entry]
1513
fn main() -> ! {
1614
loop {}
1715
}
1816

1917
#[exception]
20-
unsafe fn DefaultHandler(_irqn: i16) {
18+
unsafe fn DefaultHandler(_irqn: Vector) {
2119
asm::bkpt();
2220
}
2321

Diff for: cortex-m-rt/examples/unsafe-default-handler.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
#![no_main]
33
#![no_std]
44

5-
extern crate cortex_m_rt;
65
extern crate panic_halt;
76

7+
use cortex_m::peripheral::scb::Vector;
88
use cortex_m_rt::{entry, exception};
99

1010
#[entry]
@@ -13,4 +13,4 @@ fn foo() -> ! {
1313
}
1414

1515
#[exception]
16-
unsafe fn DefaultHandler(_irqn: i16) {}
16+
unsafe fn DefaultHandler(_irqn: Vector) {}

Diff for: cortex-m-rt/examples/unsafety.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
#![no_main]
55
#![no_std]
66

7-
extern crate cortex_m_rt;
87
extern crate panic_halt;
98

9+
use cortex_m::peripheral::scb::Vector;
1010
use cortex_m_rt::{entry, exception, ExceptionFrame};
1111

1212
#[entry]
@@ -17,7 +17,7 @@ unsafe fn main() -> ! {
1717
}
1818

1919
#[exception]
20-
unsafe fn DefaultHandler(_irqn: i16) {
20+
unsafe fn DefaultHandler(_irqn: Vector) {
2121
foo();
2222
}
2323

Diff for: cortex-m-rt/macros/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ pub fn exception(args: TokenStream, input: TokenStream) -> TokenStream {
189189
&& f.sig.inputs.len() == 1
190190
&& match &f.sig.inputs[0] {
191191
FnArg::Typed(arg) => match arg.ty.as_ref() {
192-
Type::Path(t) => true,
192+
Type::Path(_) => true,
193193
_ => false,
194194
},
195195
_ => false,

Diff for: cortex-m-rt/src/lib.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -785,11 +785,12 @@ pub use macros::entry;
785785
/// - Setting the default handler
786786
///
787787
/// ```
788+
/// use cortex_m::peripheral::scb::Vector;
788789
/// use cortex_m_rt::exception;
789790
///
790791
/// #[exception]
791-
/// unsafe fn DefaultHandler(irqn: i16) {
792-
/// println!("IRQn = {}", irqn);
792+
/// unsafe fn DefaultHandler(irqn: Vector) {
793+
/// println!("IRQn = {:?}", irqn);
793794
/// }
794795
///
795796
/// # fn main() {}
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#![no_main]
22
#![no_std]
33

4+
extern crate cortex_m;
45
extern crate cortex_m_rt;
56
extern crate panic_halt;
67

8+
use cortex_m::peripheral::scb::Vector;
79
use cortex_m_rt::{entry, exception};
810

911
#[entry]
@@ -12,5 +14,5 @@ fn foo() -> ! {
1214
}
1315

1416
#[exception]
15-
unsafe fn DefaultHandler(_irqn: i16, undef: u32) {}
16-
//~^ ERROR `DefaultHandler` must have signature `unsafe fn(i16) [-> !]`
17+
unsafe fn DefaultHandler(_irqn: Vector, undef: u32) {}
18+
//~^ ERROR `DefaultHandler` must have signature `unsafe fn(Vector) [-> !]`
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#![no_main]
22
#![no_std]
33

4+
extern crate cortex_m;
45
extern crate cortex_m_rt;
56
extern crate panic_halt;
67

8+
use cortex_m::peripheral::scb::Vector;
79
use cortex_m_rt::{entry, exception};
810

911
#[entry]
@@ -12,7 +14,7 @@ fn foo() -> ! {
1214
}
1315

1416
#[exception]
15-
unsafe fn DefaultHandler(_irqn: i16) -> u32 {
16-
//~^ ERROR `DefaultHandler` must have signature `unsafe fn(i16) [-> !]`
17+
unsafe fn DefaultHandler(_irqn: Vector) -> u32 {
18+
//~^ ERROR `DefaultHandler` must have signature `unsafe fn(Vector) [-> !]`
1719
0
1820
}

Diff for: cortex-m-rt/tests/compile-fail/default-handler-hidden.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,21 @@
44
#![no_main]
55
#![no_std]
66

7+
extern crate cortex_m;
78
extern crate cortex_m_rt;
89
extern crate panic_halt;
910

10-
use cortex_m_rt::{entry, exception};
11+
use cortex_m_rt::entry;
1112

1213
#[entry]
1314
fn foo() -> ! {
1415
loop {}
1516
}
1617

1718
mod hidden {
19+
use cortex_m::peripheral::scb::Vector;
1820
use cortex_m_rt::exception;
1921

2022
#[exception]
21-
unsafe fn DefaultHandler(_irqn: i16) {}
23+
unsafe fn DefaultHandler(_irqn: Vector) {}
2224
}
+5-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#![no_main]
22
#![no_std]
33

4+
extern crate cortex_m;
45
extern crate cortex_m_rt;
56
extern crate panic_halt;
67

8+
use cortex_m::peripheral::scb::Vector;
79
use cortex_m_rt::{entry, exception};
810

911
#[entry]
@@ -12,11 +14,12 @@ fn foo() -> ! {
1214
}
1315

1416
#[exception]
15-
unsafe fn DefaultHandler(_irqn: i16) {}
17+
unsafe fn DefaultHandler(_irqn: Vector) {}
1618

1719
pub mod reachable {
20+
use cortex_m::peripheral::scb::Vector;
1821
use cortex_m_rt::exception;
1922

2023
#[exception] //~ ERROR symbol `DefaultHandler` is already defined
21-
unsafe fn DefaultHandler(_irqn: i16) {}
24+
unsafe fn DefaultHandler(_irqn: Vector) {}
2225
}

Diff for: cortex-m-rt/tests/compile-fail/exception-nmi-unsafe.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#![no_main]
22
#![no_std]
33

4+
extern crate cortex_m;
45
extern crate cortex_m_rt;
56
extern crate panic_halt;
67

8+
use cortex_m::peripheral::scb::Vector;
79
use cortex_m_rt::{entry, exception};
810

911
#[entry]
@@ -12,7 +14,7 @@ fn foo() -> ! {
1214
}
1315

1416
#[exception]
15-
fn DefaultHandler(_irq: i16) {}
17+
fn DefaultHandler(_irq: Vector) {}
1618
//~^ ERROR defining a `DefaultHandler` is unsafe and requires an `unsafe fn`
1719

1820
#[exception]

Diff for: cortex-m-rt/tests/compile-fail/unsafe-init-static.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
#![no_main]
55
#![no_std]
66

7+
extern crate cortex_m;
78
extern crate cortex_m_rt;
89
extern crate panic_halt;
910

11+
use cortex_m::peripheral::scb::Vector;
1012
use cortex_m_rt::{entry, exception, interrupt};
1113

1214
#[allow(non_camel_case_types)]
@@ -29,7 +31,7 @@ fn SVCall() {
2931
}
3032

3133
#[exception]
32-
unsafe fn DefaultHandler(_irq: i16) {
34+
unsafe fn DefaultHandler(_irq: Vector) {
3335
static mut X: u32 = init(); //~ ERROR requires unsafe
3436
}
3537

0 commit comments

Comments
 (0)