about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbjorn3 <17426603+bjorn3@users.noreply.github.com>2023-05-05 18:55:34 +0000
committerbjorn3 <17426603+bjorn3@users.noreply.github.com>2023-05-05 18:55:34 +0000
commitdfb11195da245a1f2fe04a4c976e49312a681edd (patch)
tree9876ad76f19f84c3942962b306fff2d82fbe4e4b
parent4ef286c03827dced34d0b0a709490d82e160761f (diff)
downloadrust-dfb11195da245a1f2fe04a4c976e49312a681edd.tar.gz
rust-dfb11195da245a1f2fe04a4c976e49312a681edd.zip
Replace once_cell with the newly stabilized std::sync::OnceLock
-rw-r--r--Cargo.lock1
-rw-r--r--Cargo.toml1
-rw-r--r--src/driver/jit.rs7
3 files changed, 2 insertions, 7 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 07a8e431a0e..d25bc52caa0 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -327,7 +327,6 @@ dependencies = [
  "indexmap",
  "libloading",
  "object",
- "once_cell",
  "smallvec",
  "target-lexicon",
 ]
diff --git a/Cargo.toml b/Cargo.toml
index a2890f6ddf9..85b9c0a8464 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -27,7 +27,6 @@ object = { version = "0.30.3", default-features = false, features = ["std", "rea
 
 indexmap = "1.9.3"
 libloading = { version = "0.7.3", optional = true }
-once_cell = "1.10.0"
 smallvec = "1.8.1"
 
 [patch.crates-io]
diff --git a/src/driver/jit.rs b/src/driver/jit.rs
index 62a3e096912..41e24acefbe 100644
--- a/src/driver/jit.rs
+++ b/src/driver/jit.rs
@@ -4,7 +4,7 @@
 use std::cell::RefCell;
 use std::ffi::CString;
 use std::os::raw::{c_char, c_int};
-use std::sync::{mpsc, Mutex};
+use std::sync::{mpsc, Mutex, OnceLock};
 
 use rustc_codegen_ssa::CrateInfo;
 use rustc_middle::mir::mono::MonoItem;
@@ -13,9 +13,6 @@ use rustc_span::Symbol;
 
 use cranelift_jit::{JITBuilder, JITModule};
 
-// FIXME use std::sync::OnceLock once it stabilizes
-use once_cell::sync::OnceCell;
-
 use crate::{prelude::*, BackendConfig};
 use crate::{CodegenCx, CodegenMode};
 
@@ -29,7 +26,7 @@ thread_local! {
 }
 
 /// The Sender owned by the rustc thread
-static GLOBAL_MESSAGE_SENDER: OnceCell<Mutex<mpsc::Sender<UnsafeMessage>>> = OnceCell::new();
+static GLOBAL_MESSAGE_SENDER: OnceLock<Mutex<mpsc::Sender<UnsafeMessage>>> = OnceLock::new();
 
 /// A message that is sent from the jitted runtime to the rustc thread.
 /// Senders are responsible for upholding `Send` semantics.