diff options
| author | Ralf Jung <post@ralfj.de> | 2020-09-21 10:40:37 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-21 10:40:37 +0200 |
| commit | b670b86353ac42b98a969de6f804f9718a56097d (patch) | |
| tree | 84818eb43148419de2499a7c98da525d66d7d883 /src/test/codegen/src-hash-algorithm/src-hash-algorithm-sha256.rs | |
| parent | 02d787bef8b6b12523253cf24f79df5c1428959c (diff) | |
| parent | 5886c38112c8bb347b1cbd46c28b1ca6f8bac88d (diff) | |
| download | rust-b670b86353ac42b98a969de6f804f9718a56097d.tar.gz rust-b670b86353ac42b98a969de6f804f9718a56097d.zip | |
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: https://github.com/rust-lang/rust/pull/76936/commits/09503fd1b30c83ca605546fa3f899721e41e68c6) 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: https://github.com/rust-lang/rust/blob/59fb88d061544a035f3043b47594b34789204cee/library/core/src/cell.rs#L498-L499 r? @RalfJung
Diffstat (limited to 'src/test/codegen/src-hash-algorithm/src-hash-algorithm-sha256.rs')
0 files changed, 0 insertions, 0 deletions
