Skip to content

Commit e704edb

Browse files
committed
Do not compile the stubs in test mode
Test mode requires libtest, which implicity depends on libstd. The stubs will conflict with libtest whenever we are in test mode. libtest cannot be used on AVR anyway.
1 parent 7c85bc4 commit e704edb

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

src/lib.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,6 @@
55

66
#![feature(lang_items)]
77

8-
#[lang = "eh_personality"]
9-
#[no_mangle]
10-
pub unsafe extern "C" fn rust_eh_personality() -> () {
11-
}
12-
13-
#[panic_handler]
14-
fn panic(_info: &::core::panic::PanicInfo) -> ! {
15-
loop {}
16-
}
178

9+
#[cfg(not(test))] // Disable the stubs for test because #[no_std] is ignored there because libtest depends on it.
10+
mod stubs;

src/stubs.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#[lang = "eh_personality"]
2+
#[no_mangle]
3+
pub unsafe extern "C" fn rust_eh_personality() -> () {
4+
}
5+
6+
#[panic_handler]
7+
fn panic(_info: &::core::panic::PanicInfo) -> ! {
8+
loop {}
9+
}
10+

0 commit comments

Comments
 (0)