rust/tests
bors e4b9f86054 Auto merge of #109035 - scottmcm:ptr-read-should-know-undef, r=WaffleLapkin,JakobDegen
Ensure `ptr::read` gets all the same LLVM `load` metadata that dereferencing does

I was looking into `array::IntoIter` optimization, and noticed that it wasn't annotating the loads with `noundef` for simple things like `array::IntoIter<i32, N>`.  Trying to narrow it down, it seems that was because `MaybeUninit::assume_init_read` isn't marking the load as initialized (<https://rust.godbolt.org/z/Mxd8TPTnv>), which is unfortunate since that's basically its reason to exist.

The root cause is that `ptr::read` is currently implemented via the *untyped* `copy_nonoverlapping`, and thus the `load` doesn't get any type-aware metadata: no `noundef`, no `!range`.  This PR solves that by lowering `ptr::read(p)` to `copy *p` in MIR, for which the backends already do the right thing.

Fortuitiously, this also improves the IR we give to LLVM for things like `mem::replace`, and fixes a couple of long-standing bugs where `ptr::read` on `Copy` types was worse than `*`ing them.

Zulip conversation: <https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/Move.20array.3A.3AIntoIter.20to.20ManuallyDrop/near/341189936>

cc `@erikdesjardins` `@JakobDegen` `@workingjubilee` `@the8472`

Fixes #106369
Fixes #73258
2023-03-15 11:44:12 +00:00
..
assembly Update the minimum external LLVM to 14 2023-02-10 16:06:25 -08:00
auxiliary
codegen Auto merge of #109035 - scottmcm:ptr-read-should-know-undef, r=WaffleLapkin,JakobDegen 2023-03-15 11:44:12 +00:00
codegen-units
debuginfo Remove the capture_disjoint_fields feature 2023-02-28 01:21:15 +00:00
incremental
mir-opt Auto merge of #109035 - scottmcm:ptr-read-should-know-undef, r=WaffleLapkin,JakobDegen 2023-03-15 11:44:12 +00:00
pretty Remove uses of box_syntax in rustc and tools 2023-03-12 13:19:46 +00:00
run-make Update coverage info. 2023-03-09 17:51:38 +00:00
run-make-fulldeps rustdoc: fix test case for custom themes 2023-03-08 12:49:35 -07:00
run-pass-valgrind
rustdoc Rollup merge of #108936 - GuillaumeGomez:rustdoc-anonymous-reexport, r=notriddle 2023-03-10 12:31:58 +01:00
rustdoc-gui Rollup merge of #106915 - notriddle:notriddle/load-only-one-theme, r=GuillaumeGomez,jsha 2023-03-09 12:11:52 +01:00
rustdoc-js rustdoc: function signature search with traits in where clause 2023-03-04 09:05:57 -07:00
rustdoc-js-std rustdoc: use restricted Damerau-Levenshtein distance for search 2023-03-10 19:47:08 -07:00
rustdoc-json Add regression test for #107677 2023-02-18 18:28:17 +01:00
rustdoc-ui rustdoc: Don't crash on crate references in blocks 2023-03-10 17:49:13 +01:00
ui Auto merge of #109035 - scottmcm:ptr-read-should-know-undef, r=WaffleLapkin,JakobDegen 2023-03-15 11:44:12 +00:00
ui-fulldeps Remove uses of box_syntax in rustc and tools 2023-03-12 13:19:46 +00:00
COMPILER_TESTS.md