diff --git a/rust/kernel/src/lib.rs b/rust/kernel/src/lib.rs index a80e6425f1222b..1e1d22cbd8f48d 100644 --- a/rust/kernel/src/lib.rs +++ b/rust/kernel/src/lib.rs @@ -5,6 +5,11 @@ #![no_std] #![feature(allocator_api, alloc_error_handler)] +// Ensure conditional compilation based on the kernel configuration works; +// otherwise we may silently break things like initcall handling. +#[cfg(not(CONFIG_HAS_RUST))] +compile_error!("Missing kernel configuration for conditional compilation"); + extern crate alloc; use core::panic::PanicInfo;