You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This patch adds the 'assert_zero_valid' intrinsic to the compiler.
Properly implementing this intrinsic requires layout engine support to
detect types that cannot be safely zero-initialized (e.g., references
and NonNull types). Since gccrs currently lacks this capability, it is
implemented as a temporary stub that always returns unit `()`.
Normally, this intrinsic should inject a runtime panic during codegen
if the provided type does not permit zero-initialization.
gcc/rust/ChangeLog:
* backend/rust-compile-intrinsic.cc (generic_intrinsics): Add
assert_zero_valid to map.
* backend/rust-intrinsic-handlers.cc
(assert_zero_valid_handler): New function.
* backend/rust-intrinsic-handlers.h (assert_zero_valid_handler):
New declaration.
* typecheck/rust-hir-type-check-intrinsic.cc
(IntrinsicChecker::intrinsic_rules): Add new signature rule for
assert_zero_valid.
* util/rust-intrinsic-values.h (class Intrinsics): Add
ASSERT_ZERO_VALID constexpr.
gcc/testsuite/ChangeLog:
* rust/compile/assert_zero_valid.rs: New test.
Signed-off-by: Enes Cevik <enes@nsvke.com>
0 commit comments