rust/compiler/rustc_ty_utils
bors 3984bc5833 Auto merge of #106294 - Nilstrieb:noundef-everything, r=nikic
Put `noundef` on all scalars that don't allow uninit

Previously, it was only put on scalars with range validity invariants like bool, was uninit was obviously invalid for those.

Since then, we have normatively declared all uninit primitives to be undefined behavior and can therefore put `noundef` on them.

The remaining concern was the `mem::uninitialized` function, which cause quite a lot of UB in the older parts of the ecosystem. After #99182, this function now doesn't return uninit values anymore, making users of it safe from this change.

The only real sources of UB where people could encounter uninit primitives are `MaybeUninit::uninit().assume_init()`, which has always be clear in the docs about being UB and from heap allocations (like reading from the spare capacity of a vec). This is hopefully rare enough to not break anything.

cc `@nagisa` `@scottmcm` `@nikic`
2023-01-17 17:39:48 +00:00
..
src Auto merge of #106294 - Nilstrieb:noundef-everything, r=nikic 2023-01-17 17:39:48 +00:00
Cargo.toml move things from rustc_target::abi to rustc_abi 2022-11-24 16:26:13 +03:30