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
28002800
28012801 If unsure, say Y.
28022802
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"
28062805 depends on RUST
28072806 help
28082807 Controls how are `build_error!` and `build_assert!` handled during build.
28092808
28102809 If calls to them exist in the binary, it may indicate a violated invariant
28112810 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".
28162811
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).
28222816
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.
28292818
28302819config RUST_KERNEL_KUNIT_TEST
28312820 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
1919always-$(CONFIG_RUST) += exports_alloc_generated.h exports_bindings_generated.h \
2020 exports_kernel_generated.h
2121
22- ifdef CONFIG_RUST_BUILD_ASSERT_DENY
23- always-$(CONFIG_RUST) += build_error.o
24- else
22+ ifdef CONFIG_RUST_BUILD_ASSERT_ALLOW
2523obj-$(CONFIG_RUST) += build_error.o
24+ else
25+ always-$(CONFIG_RUST) += build_error.o
2626endif
2727
2828obj-$(CONFIG_RUST) += exports.o
Original file line number Diff line number Diff line change 2121#include "exports_kernel_generated.h"
2222
2323// For modules using `rust/build_error.rs`.
24- #ifndef CONFIG_RUST_BUILD_ASSERT_DENY
24+ #ifdef CONFIG_RUST_BUILD_ASSERT_ALLOW
2525EXPORT_SYMBOL_RUST_GPL (rust_build_error );
2626#endif
You can’t perform that action at this time.
0 commit comments