File tree Expand file tree Collapse file tree 3 files changed +11
-22
lines changed Expand file tree Collapse file tree 3 files changed +11
-22
lines changed Original file line number Diff line number Diff line change @@ -2800,32 +2800,21 @@ config RUST_OVERFLOW_CHECKS
2800
2800
2801
2801
If unsure, say Y.
2802
2802
2803
- choice
2804
- prompt "Build-time assertions"
2805
- default RUST_BUILD_ASSERT_DENY
2803
+ config RUST_BUILD_ASSERT_ALLOW
2804
+ bool "Allow unoptimized build-time assertions"
2806
2805
depends on RUST
2807
2806
help
2808
2807
Controls how are `build_error!` and `build_assert!` handled during build.
2809
2808
2810
2809
If calls to them exist in the binary, it may indicate a violated invariant
2811
2810
or that the optimizer failed to verify the invariant during compilation.
2812
- You can choose to abort compilation or ignore them during build and let the
2813
- check be carried to runtime.
2814
-
2815
- If unsure, say "Deny".
2816
2811
2817
- config RUST_BUILD_ASSERT_ALLOW
2818
- bool "Allow"
2819
- help
2820
- Unoptimized calls to `build_error!` will be converted to `panic!`
2821
- and checked at runtime.
2812
+ This should not happen, thus by default the build is aborted. However,
2813
+ as an escape hatch, you can choose Y here to ignore them during build
2814
+ and let the check be carried at runtime (with `panic!` being called if
2815
+ the check fails).
2822
2816
2823
- config RUST_BUILD_ASSERT_DENY
2824
- bool "Deny"
2825
- help
2826
- Unoptimized calls to `build_error!` will abort compilation.
2827
-
2828
- endchoice
2817
+ If unsure, say N.
2829
2818
2830
2819
config RUST_KERNEL_KUNIT_TEST
2831
2820
bool "KUnit test for the `kernel` crate" if !KUNIT_ALL_TESTS
Original file line number Diff line number Diff line change @@ -19,10 +19,10 @@ obj-$(CONFIG_RUST) += alloc.o bindings.o kernel.o
19
19
always-$(CONFIG_RUST) += exports_alloc_generated.h exports_bindings_generated.h \
20
20
exports_kernel_generated.h
21
21
22
- ifdef CONFIG_RUST_BUILD_ASSERT_DENY
23
- always-$(CONFIG_RUST) += build_error.o
24
- else
22
+ ifdef CONFIG_RUST_BUILD_ASSERT_ALLOW
25
23
obj-$(CONFIG_RUST) += build_error.o
24
+ else
25
+ always-$(CONFIG_RUST) += build_error.o
26
26
endif
27
27
28
28
obj-$(CONFIG_RUST) += exports.o
Original file line number Diff line number Diff line change 21
21
#include "exports_kernel_generated.h"
22
22
23
23
// For modules using `rust/build_error.rs`.
24
- #ifndef CONFIG_RUST_BUILD_ASSERT_DENY
24
+ #ifdef CONFIG_RUST_BUILD_ASSERT_ALLOW
25
25
EXPORT_SYMBOL_RUST_GPL (rust_build_error );
26
26
#endif
You can’t perform that action at this time.
0 commit comments