Skip to content

Commit d0a8472

Browse files
committed
Ensure we don't break conditional compilation
At the moment, any mistake passing the kernel configuration for conditional compilation means we break things silently, like initcall handling which implies panics or memory corruption [1]. Let's prevent that from happening again. [1] #23 Signed-off-by: Miguel Ojeda <[email protected]>
1 parent c28ec6f commit d0a8472

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

rust/kernel/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
#![no_std]
66
#![feature(allocator_api, alloc_error_handler)]
77

8+
// Ensure conditional compilation based on the kernel configuration works;
9+
// otherwise we may silently break things like initcall handling.
10+
#[cfg(not(CONFIG_HAS_RUST))]
11+
compile_error!("Missing kernel configuration for conditional compilation");
12+
813
extern crate alloc;
914

1015
use core::panic::PanicInfo;

0 commit comments

Comments
 (0)