diff options
| author | bors <bors@rust-lang.org> | 2025-01-16 10:52:11 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-01-16 10:52:11 +0000 |
| commit | d8a64098c9d0fb25699f657c6efff0bb418f7e18 (patch) | |
| tree | bdac77b7db080d83e34592a5d311012439db5e54 /tests/rustdoc-js-std/field-is-unary-func.js | |
| parent | d61f55d8b9d4703207a5980f27b6c28973ba27ee (diff) | |
| parent | c18718c9c28cc4c700312775c2b7f87cd79d3063 (diff) | |
| download | rust-d8a64098c9d0fb25699f657c6efff0bb418f7e18.tar.gz rust-d8a64098c9d0fb25699f657c6efff0bb418f7e18.zip | |
Auto merge of #135344 - scottmcm:safe-dangling, r=joboet
Less unsafe in `dangling`/`without_provenance` This PR was inspired by the new `NonNull::without_provenance` (cc https://github.com/rust-lang/rust/issues/135243#issuecomment-2583913562) since it made me realize that we could write `NonNull::dangling` in completely-safe code using other existing things. Then doing that led me to a few more places that could be simplified, like now that GVN will optimize Transmute-then-PtrToPtr, we can just implement `ptr::without_provenance` by calling `ptr::without_provenance_mut` since the shipped rlib of `core` ends up with the same single statement as the implementation (thanks to GVN merging the steps) and thus there's no need to duplicate the `transmute` -- and more importantly, no need to repeat a long safety comment. There did end up being a couple of other changes needed to avoid exploding certain bits of MIR, though -- like `<Box<[i32]>>::default()`'s MIR originally got way worse as certain things didn't inline, or had a bunch of extraneous UbChecks -- so there's a couple of other changes to solve that.
Diffstat (limited to 'tests/rustdoc-js-std/field-is-unary-func.js')
0 files changed, 0 insertions, 0 deletions
