about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPavel Grigorenko <GrigorenkoPV@ya.ru>2024-07-07 21:58:59 +0300
committerPavel Grigorenko <GrigorenkoPV@ya.ru>2024-07-07 22:00:32 +0300
commit8076a33fb7a32e1065154a31a2da9c55f4ca3175 (patch)
tree571d31cab2d4b20840123e9334d702987a1c0794
parent0ca92de4733bf31262200c6d37e722f534cef4bc (diff)
downloadrust-8076a33fb7a32e1065154a31a2da9c55f4ca3175.tar.gz
rust-8076a33fb7a32e1065154a31a2da9c55f4ca3175.zip
bootstrap: once_cell::sync::Lazy -> std::sync::LazyLock
-rw-r--r--src/bootstrap/Cargo.lock1
-rw-r--r--src/bootstrap/Cargo.toml1
-rw-r--r--src/bootstrap/src/core/builder.rs7
-rw-r--r--src/bootstrap/src/utils/cache.rs7
4 files changed, 5 insertions, 11 deletions
diff --git a/src/bootstrap/Cargo.lock b/src/bootstrap/Cargo.lock
index 9c24742cff1..c095127da14 100644
--- a/src/bootstrap/Cargo.lock
+++ b/src/bootstrap/Cargo.lock
@@ -54,7 +54,6 @@ dependencies = [
  "junction",
  "libc",
  "object",
- "once_cell",
  "opener",
  "pretty_assertions",
  "semver",
diff --git a/src/bootstrap/Cargo.toml b/src/bootstrap/Cargo.toml
index 32dd3efa7a6..df7b5b88193 100644
--- a/src/bootstrap/Cargo.toml
+++ b/src/bootstrap/Cargo.toml
@@ -49,7 +49,6 @@ home = "0.5"
 ignore = "0.4"
 libc = "0.2"
 object = { version = "0.32", default-features = false, features = ["archive", "coff", "read_core", "unaligned"] }
-once_cell = "1.19"
 opener = "0.5"
 semver = "1.0"
 serde = "1.0"
diff --git a/src/bootstrap/src/core/builder.rs b/src/bootstrap/src/core/builder.rs
index 24bb96c6b88..9f19e8781da 100644
--- a/src/bootstrap/src/core/builder.rs
+++ b/src/bootstrap/src/core/builder.rs
@@ -8,6 +8,7 @@ use std::fs;
 use std::hash::Hash;
 use std::ops::Deref;
 use std::path::{Path, PathBuf};
+use std::sync::LazyLock;
 use std::time::{Duration, Instant};
 
 use crate::core::build_steps::tool::{self, SourceType};
@@ -27,8 +28,6 @@ use crate::utils::exec::{command, BootstrapCommand};
 pub use crate::Compiler;
 
 use clap::ValueEnum;
-// FIXME: replace with std::lazy after it gets stabilized and reaches beta
-use once_cell::sync::Lazy;
 
 #[cfg(test)]
 mod tests;
@@ -498,7 +497,7 @@ impl StepDescription {
 
 enum ReallyDefault<'a> {
     Bool(bool),
-    Lazy(Lazy<bool, Box<dyn Fn() -> bool + 'a>>),
+    Lazy(LazyLock<bool, Box<dyn Fn() -> bool + 'a>>),
 }
 
 pub struct ShouldRun<'a> {
@@ -529,7 +528,7 @@ impl<'a> ShouldRun<'a> {
     }
 
     pub fn lazy_default_condition(mut self, lazy_cond: Box<dyn Fn() -> bool + 'a>) -> Self {
-        self.is_really_default = ReallyDefault::Lazy(Lazy::new(lazy_cond));
+        self.is_really_default = ReallyDefault::Lazy(LazyLock::new(lazy_cond));
         self
     }
 
diff --git a/src/bootstrap/src/utils/cache.rs b/src/bootstrap/src/utils/cache.rs
index e18dcbb47be..d60b54dc703 100644
--- a/src/bootstrap/src/utils/cache.rs
+++ b/src/bootstrap/src/utils/cache.rs
@@ -9,10 +9,7 @@ use std::marker::PhantomData;
 use std::mem;
 use std::ops::Deref;
 use std::path::PathBuf;
-use std::sync::Mutex;
-
-// FIXME: replace with std::lazy after it gets stabilized and reaches beta
-use once_cell::sync::Lazy;
+use std::sync::{LazyLock, Mutex};
 
 use crate::core::builder::Step;
 
@@ -196,7 +193,7 @@ impl Interner {
     }
 }
 
-pub static INTERNER: Lazy<Interner> = Lazy::new(Interner::default);
+pub static INTERNER: LazyLock<Interner> = LazyLock::new(Interner::default);
 
 /// This is essentially a `HashMap` which allows storing any type in its input and
 /// any type in its output. It is a write-once cache; values are never evicted,