gnu/gcc/46d2b1f7b898c309bd2d61200a91bfd4c285c8ca gccrs: intrinsic: Add size_of_val
This patch adds the size_of_val intrinsic to the compiler. This
intrinsic evaluates the size of a value at runtime, including
Dynamically Sized Types (DSTs).
gcc/rust/ChangeLog:
* backend/rust-compile-intrinsic.cc (generic_intrinsics): Add
size_of_val_handler to the map.
* backend/rust-intrinsic-handlers.cc (size_of_val_handler): New
function.
* backend/rust-intrinsic-handlers.h (size_of_val_handler): New
declaration.
* typecheck/rust-hir-type-check-intrinsic.cc
(IntrinsicChecker::intrinsic_rules): Add size_of_val signature
rule to the map.
* util/rust-intrinsic-values.h (class Intrinsics): Add
SIZE_OF_VAL constexpr.
gcc/testsuite/ChangeLog:
* rust/execute/size-of-val.rs: New test.
Signed-off-by: Enes Cevik <enes@nsvke.com>
6 files changed