rust/library
bors b63223c152 Auto merge of #141759 - 1c3t3a:discriminants-query, r=saethlin
Insert checks for enum discriminants when debug assertions are enabled

Similar to the existing null-pointer and alignment checks, this checks for valid enum discriminants on creation of enums through unsafe transmutes. Essentially this sanitizes patterns like the following:
```rust
let val: MyEnum = unsafe { std::mem::transmute<u32, MyEnum>(42) };
```

An extension of this check will be done in a follow-up that explicitly sanitizes for extern enum values that come into Rust from e.g. C/C++.

This check is similar to Miri's capabilities of checking for valid construction of enum values.

This PR is inspired by saethlin@'s PR
https://github.com/rust-lang/rust/pull/104862. Thank you so much for keeping this code up and the detailed comments!

I also pair-programmed large parts of this together with vabr-g@.

r? `@saethlin`
2025-06-28 10:25:00 +00:00
..
alloc Rollup merge of #142700 - theemathas:remove-weak-comment, r=ibraheemdev 2025-06-26 20:15:20 -04:00
alloctests Rollup merge of #142668 - hkBst:less-static-mut, r=tgross35 2025-06-20 02:50:39 -04:00
backtrace@b65ab935fb Update the backtrace submodule 2025-06-16 07:00:13 +00:00
compiler-builtins Work around out-of-tree testing with a shim crate 2025-06-14 06:56:18 +00:00
core Auto merge of #141759 - 1c3t3a:discriminants-query, r=saethlin 2025-06-28 10:25:00 +00:00
coretests Auto merge of #143074 - compiler-errors:rollup-cv64hdh, r=compiler-errors 2025-06-27 00:44:20 +00:00
panic_abort Use the in-tree compiler-builtins 2025-06-08 02:36:58 +00:00
panic_unwind Rollup merge of #141993 - tgross35:use-in-tree-builtins, r=bjorn3 2025-06-09 12:17:53 -05:00
portable-simd Merge commit 'c14f2fc3eb' into sync-from-portable-simd-2025-03-19 2025-03-19 00:58:47 -04:00
proc_macro Auto merge of #140999 - hkBst:update-escaper, r=nnethercote 2025-06-25 01:03:30 +00:00
profiler_builtins Fix profiler_builtins build script to handle full path to profiler lib 2025-04-11 16:57:38 +02:00
rtstartup library/compiler: add PointeeSized bounds 2025-06-16 23:04:33 +00:00
rustc-std-workspace-alloc Migrated the rustc-std-workspace crates to Rust 2024 2025-03-11 09:46:35 -07:00
rustc-std-workspace-core Use the in-tree compiler-builtins 2025-06-08 02:36:58 +00:00
rustc-std-workspace-std Migrated the rustc-std-workspace crates to Rust 2024 2025-03-11 09:46:35 -07:00
std Rollup merge of #140809 - bjorn3:panic_runtime_cleanup, r=petrochenkov 2025-06-27 22:13:01 +02:00
stdarch Removed library/stdarch submodule 2025-06-23 17:22:38 +02:00
sysroot Avoid exporting panic_unwind as stdlib cargo feature 2025-06-24 19:44:35 +00:00
test Add new test_main_with_exit_callback public function in libtest to allow a callback to be called before exiting 2025-05-06 18:17:48 +02:00
unwind Upgrade the standard library unwinding version 2025-06-11 20:05:06 +00:00
windows_targets Fix backtrace for cygwin 2025-05-07 13:08:19 +08:00
Cargo.lock Auto merge of #140999 - hkBst:update-escaper, r=nnethercote 2025-06-25 01:03:30 +00:00
Cargo.toml Auto merge of #140999 - hkBst:update-escaper, r=nnethercote 2025-06-25 01:03:30 +00:00