about summary refs log tree commit diff
path: root/compiler/rustc_driver_impl/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-05-25 22:15:16 +0200
committerGitHub <noreply@github.com>2024-05-25 22:15:16 +0200
commit890982e47bf3dea0f3625aabddf9312d89b81972 (patch)
tree8d381a5df522b067589c156ff5e03bff184ca2fe /compiler/rustc_driver_impl/src
parent48f00110d0dae38b3046a9ac05d20ea321fd6637 (diff)
parent4913ab8f779582dc9da099a148a4670ede0e15aa (diff)
downloadrust-890982e47bf3dea0f3625aabddf9312d89b81972.tar.gz
rust-890982e47bf3dea0f3625aabddf9312d89b81972.zip
Rollup merge of #121377 - pitaj:lazy_cell_fn_pointer, r=dtolnay
Stabilize `LazyCell` and `LazyLock`

Closes #109736

This stabilizes the [`LazyLock`](https://doc.rust-lang.org/stable/std/sync/struct.LazyLock.html) and [`LazyCell`](https://doc.rust-lang.org/stable/std/cell/struct.LazyCell.html) types:

```rust
static HASHMAP: LazyLock<HashMap<i32, String>> = LazyLock::new(|| {
    println!("initializing");
    let mut m = HashMap::new();
    m.insert(13, "Spica".to_string());
    m.insert(74, "Hoyten".to_string());
    m
});

let lazy: LazyCell<i32> = LazyCell::new(|| {
    println!("initializing");
    92
});
```

r? libs-api
Diffstat (limited to 'compiler/rustc_driver_impl/src')
0 files changed, 0 insertions, 0 deletions