Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
avoid tearing of thread_locals
  • Loading branch information
matklad committed Oct 26, 2019
commit 77ff0800a1939eafcb7b592f68694c0e0f77ece9
4 changes: 2 additions & 2 deletions text/0000-standard-lazy-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ use std::cell::{RefCell, Lazy};
pub static FOO: Lazy<RefCell<u32>> = Lazy::new(|| RefCell::new(1));
```

However, `#[thread_local]` attribute is pretty far from stabilization at the moment, and due to the required special handling of destructors, it's unclear if just using `cell::Lazy` will work out.

Unlike `lazy_static!`, `Lazy` can be used used for locals:

```rust
Expand All @@ -203,8 +205,6 @@ fn main() {
}
```

However, `#[thread_local]` attribute is pretty far from stabilization at the moment, and due to the required special handling of destructors, it's unclear if just using `cell::Lazy` will work out.

# Reference-level explanation
[reference-level-explanation]: #reference-level-explanation

Expand Down