rust/library
Ralf Jung b670b86353
Rollup merge of #76936 - danielhenrymantilla:unsafecell_get_mut, r=RalfJung
Add non-`unsafe` `.get_mut()` for `Unsafecell`

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

As discussed in: https://internals.rust-lang.org/t/add-non-unsafe-get-mut-for-unsafecell/12407

  - ### [Rendered documentation](https://modest-dubinsky-1f9f47.netlify.app/core/cell/struct.unsafecell)

This PR tries to move the sound `&mut UnsafeCell<T> -> &mut T` projection that all the "downstream" constructions were already relying on, up to the root abstraction, where it rightfully belongs, and officially blessing it.

  - this **helps reduce the amount of `unsafe` snippets out there** (_c.f._, the second commit of this PR: 09503fd1b3)

The fact that this getter is now expose for `UnsafeCell<T>` itself, will also help convey the idea that **`UnsafeCell` is not magical _w.r.t._ `&mut` accesses**, contrary to what some people incorrectly think.

  - Even the standard library itself at some point had such a confusion, _c.f._ this comment where there is a mention of multi-threaded (and thus _shared_) access despite dealing with exclusive references over unique ownership: 59fb88d061/library/core/src/cell.rs (L498-L499)

r? @RalfJung
2020-09-21 10:40:37 +02:00
..
alloc Auto merge of #75974 - SkiFire13:peekmut-opt-sift, r=LukasKalbertodt 2020-09-21 05:31:01 +00:00
backtrace@4083a90168 std: Switch from libbacktrace to gimli 2020-07-28 16:34:01 -07:00
core Rollup merge of #76936 - danielhenrymantilla:unsafecell_get_mut, r=RalfJung 2020-09-21 10:40:37 +02:00
panic_abort Rollup merge of #76866 - est31:master, r=lcnr 2020-09-20 15:51:50 +02:00
panic_unwind Rollup merge of #76866 - est31:master, r=lcnr 2020-09-20 15:51:50 +02:00
proc_macro Respect -Z proc-macro-backtrace flag for panics inside libproc_macro 2020-09-03 12:13:26 -04:00
profiler_builtins Fix warning whe building profiler_builtins crate 2020-09-04 15:10:29 +02:00
rtstartup mv std libs to library/ 2020-07-27 19:51:13 -05:00
rustc-std-workspace-alloc mv std libs to library/ 2020-07-27 19:51:13 -05:00
rustc-std-workspace-core mv std libs to library/ 2020-07-27 19:51:13 -05:00
rustc-std-workspace-std mv std libs to library/ 2020-07-27 19:51:13 -05:00
std Rollup merge of #76936 - danielhenrymantilla:unsafecell_get_mut, r=RalfJung 2020-09-21 10:40:37 +02:00
stdarch@718175b34a Update stdarch 2020-09-15 17:26:20 +02:00
term mv std libs to library/ 2020-07-27 19:51:13 -05:00
test Prefer https link for wikipedia URLs 2020-08-23 10:02:42 +00:00
unwind library/unwind: Add missing ) 2020-09-17 07:10:10 -07:00