about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2020-10-21 13:59:29 +0900
committerGitHub <noreply@github.com>2020-10-21 13:59:29 +0900
commitff3c8cb5182ae5ffee4cd47dbabbe981f859c40f (patch)
treecf78d624aa0e1e6e1d2c8e91bb6c5f0a000d563a /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
parentf965120ad3dbe7d4d6b90a16cc7028eb6363b983 (diff)
parentdf95dcebf5f98cefdc60c9b9d818fb285ac07d5b (diff)
downloadrust-ff3c8cb5182ae5ffee4cd47dbabbe981f859c40f.tar.gz
rust-ff3c8cb5182ae5ffee4cd47dbabbe981f859c40f.zip
Rollup merge of #77726 - fusion-engineering-forks:static-pin, r=dtolnay
Add Pin::static_ref, static_mut.

This adds `Pin::static_ref` and `Pin::static_mut`, which convert a static reference to a pinned static reference.

Static references are effectively already pinned, as what they refer to has to live forever and can never be moved.

---

Context: I want to update the `sys` and `sys_common` mutexes/rwlocks/condvars to use `Pin<&self>` in their functions, instead of only warning in the unsafety comments that they may not be moved. That should make them a little bit less dangerous to use. Putting such an object in a `static` (e.g. through `sys_common::StaticMutex`) fulfills the requirements about never moving it, but right now there's no safe way to get a `Pin<&T>` to a `static`. This solves that.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions