-
- Downloads
rust: add `build_error` crate
The `build_error` crate provides a function `build_error` which will panic at compile-time if executed in const context and, by default, will cause a build error if not executed at compile time and the optimizer does not optimise away the call. The `CONFIG_RUST_BUILD_ASSERT_ALLOW` kernel option allows to relax the default build failure and convert it to a runtime check. If the runtime check fails, `panic!` will be called. Its functionality will be exposed to users as a couple macros in the `kernel` crate in the following patch, thus some documentation here refers to them for simplicity. Signed-off-by:Gary Guo <gary@garyguo.net> Reviewed-by:
Wei Liu <wei.liu@kernel.org> [Reworded, adapted for upstream and applied latest changes] Signed-off-by:
Miguel Ojeda <ojeda@kernel.org>
Showing
- lib/Kconfig.debug 16 additions, 0 deletionslib/Kconfig.debug
- rust/Makefile 17 additions, 5 deletionsrust/Makefile
- rust/build_error.rs 31 additions, 0 deletionsrust/build_error.rs
- rust/exports.c 5 additions, 0 deletionsrust/exports.c
- scripts/generate_rust_analyzer.py 7 additions, 1 deletionscripts/generate_rust_analyzer.py
Loading
Please register or sign in to comment