rust/library
Dylan DPC b22559f547
Rollup merge of #103346 - HeroicKatora:metadata_of_const_pointer_argument, r=dtolnay
Adjust argument type for mutable with_metadata_of (#75091)

The method takes two pointer arguments: one `self` supplying the pointer value, and a second pointer supplying the metadata.

The new parameter type more clearly reflects the actual requirements. The provenance of the metadata parameter is disregarded completely. Using a mutable pointer in the call site can be coerced to a const pointer while the reverse is not true.

In some cases, the current parameter type can thus lead to a very slightly confusing additional cast. [Example](cad93775eb).

```rust
// Manually taking an unsized object from a `ManuallyDrop` into another allocation.
let val: &core::mem::ManuallyDrop<T> = …;

let ptr = val as *const _ as *mut T;
let ptr = uninit.as_ptr().with_metadata_of(ptr);
```

This could then instead be simplified to:

```rust
// Manually taking an unsized object from a `ManuallyDrop` into another allocation.
let val: &core::mem::ManuallyDrop<T> = …;

let ptr = uninit.as_ptr().with_metadata_of(&**val);
```

Tracking issue: https://github.com/rust-lang/rust/issues/75091

``@dtolnay`` you're reviewed #95249, would you mind chiming in?
2022-10-22 16:28:09 +05:30
..
alloc Rollup merge of #103346 - HeroicKatora:metadata_of_const_pointer_argument, r=dtolnay 2022-10-22 16:28:09 +05:30
backtrace@07872f28cd Update backtrace 2022-09-02 16:09:58 -04:00
core Rollup merge of #103346 - HeroicKatora:metadata_of_const_pointer_argument, r=dtolnay 2022-10-22 16:28:09 +05:30
panic_abort Update comment about personalities in panic_abort 2022-08-23 16:12:58 +08:00
panic_unwind Auto merge of #92845 - Amanieu:std_personality, r=Mark-Simulacrum 2022-08-28 04:16:29 +00:00
portable-simd separate the receiver from arguments in HIR under /clippy 2022-09-05 22:25:57 +09:00
proc_macro Stabilize proc_macro::Span::source_text 2022-10-18 17:13:41 +02:00
profiler_builtins Fully stabilize NLL 2022-06-03 17:16:41 -04:00
rtstartup Remove custom frame info registration on i686-pc-windows-gnu 2022-08-23 16:12:58 +08:00
rustc-std-workspace-alloc Switch all libraries to the 2021 edition 2021-12-23 19:03:47 +08:00
rustc-std-workspace-core Switch all libraries to the 2021 edition 2021-12-23 19:03:47 +08:00
rustc-std-workspace-std Switch all libraries to the 2021 edition 2021-12-23 19:03:47 +08:00
std Auto merge of #101077 - sunshowers:signal-mask-inherit, r=sunshowers 2022-10-21 18:09:03 +00:00
stdarch@790411f93c library: update stdarch submodule 2022-10-13 09:41:16 +08:00
test WinConsole::new is not actually fallible 2022-10-21 12:18:33 +02:00
unwind unwind: don't build dependency when building for Miri 2022-08-15 12:54:12 -04:00