Skip to content

Commit 548f16c

Browse files
committed
Only include the stubs when targeting AVR
The previous patch, e704edb, is not enough. We cannot detect whether a downstream crate is being compiled in test mode. #[cfg(test)] is only true when 'avr-std-stub' itself is being tested.
1 parent 056bfb2 commit 548f16c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/lib.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
//! Contains simple implementations of required language items that `libstd` normally defines on
22
//! other targets.
3+
//!
4+
//! You should always have `extern crate avr_std_stubs` defined when using this crate.
35
46
#![no_std]
57

68
#![feature(lang_items)]
79

8-
9-
#[cfg(not(test))] // Disable the stubs for test because #[no_std] is ignored there because libtest depends on it.
10+
// Disable the stubs for non-AVR targets because #[no_std] is ignored
11+
// when using the Rust test harness, and we cannot detect if a downstream
12+
// crate dependent on this crate is being compiled in test mode or not.
13+
#[cfg(target_arch = "avr")]
1014
mod stubs;

0 commit comments

Comments
 (0)