about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorChristopher Durham <cad97@cad97.com>2018-07-10 22:47:59 -0400
committerGitHub <noreply@github.com>2018-07-10 22:47:59 -0400
commit0f3f292b4c7a15b656a925e7ebe5f2d3955b8553 (patch)
tree6973f0d21fcb31e4d4eb70563f9ce44b76b71922 /src/rustllvm/RustWrapper.cpp
parent4700e1188f66fdb4086b7593416b678b8fe935f4 (diff)
downloadrust-0f3f292b4c7a15b656a925e7ebe5f2d3955b8553.tar.gz
rust-0f3f292b4c7a15b656a925e7ebe5f2d3955b8553.zip
remove sync::Once::call_once 'static
- [std: Rewrite the `sync` modulehttps://github.com/rust-lang/rust/commit/71d4e77db8ad4b6d821da7e5d5300134ac95974e) (Nov 2014)

    ```diff
    -    pub fn doit(&self, f: ||) {
    +    pub fn doit(&'static self, f: ||) {
    ```

    > ```text
    >  The second layer is the layer provided by `std::sync` which is intended to be
    >  the thinnest possible layer on top of `sys_common` which is entirely safe to
    >  use. There are a few concerns which need to be addressed when making these
    >  system primitives safe:
    >
    >    * Once used, the OS primitives can never be **moved**. This means that they
    >      essentially need to have a stable address. The static primitives use
    >      `&'static self` to enforce this, and the non-static primitives all use a
    >      `Box` to provide this guarantee.
    > ```

The author of this diff is @alexcrichton. `sync::Once` contains only a pointer to (privately hidden) `Waiter`s, which are all stack-allocated. The `'static` bound to `sync::Once` is thus unnecessary to guarantee that any OS primitives are non-relocatable.

See https://internals.rust-lang.org/t/sync-once-per-instance/7918 for more context.
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions