Skip to content

Commit bd49eec

Browse files
committed
interface: use OnceCell from standard library
1 parent eb9e7c3 commit bd49eec

File tree

4 files changed

+5
-7
lines changed

4 files changed

+5
-7
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3606,7 +3606,6 @@ name = "rustc_interface"
36063606
version = "0.0.0"
36073607
dependencies = [
36083608
"libc",
3609-
"once_cell",
36103609
"rustc-rayon",
36113610
"rustc_ast",
36123611
"rustc_ast_lowering",

compiler/rustc_interface/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ rustc_resolve = { path = "../rustc_resolve" }
4343
rustc_trait_selection = { path = "../rustc_trait_selection" }
4444
rustc_ty = { path = "../rustc_ty" }
4545
tempfile = "3.0.5"
46-
once_cell = "1"
4746

4847
[target.'cfg(windows)'.dependencies]
4948
winapi = { version = "0.3", features = ["libloaderapi"] }

compiler/rustc_interface/src/passes.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use crate::interface::{Compiler, Result};
22
use crate::proc_macro_decls;
33
use crate::util;
44

5-
use once_cell::sync::Lazy;
65
use rustc_ast::mut_visit::MutVisitor;
76
use rustc_ast::{self as ast, visit};
87
use rustc_codegen_ssa::back::link::emit_metadata;
@@ -46,6 +45,7 @@ use std::any::Any;
4645
use std::cell::RefCell;
4746
use std::ffi::OsString;
4847
use std::io::{self, BufWriter, Write};
48+
use std::lazy::SyncLazy;
4949
use std::path::PathBuf;
5050
use std::rc::Rc;
5151
use std::{env, fs, iter, mem};
@@ -681,7 +681,7 @@ pub fn prepare_outputs(
681681
Ok(outputs)
682682
}
683683

684-
pub static DEFAULT_QUERY_PROVIDERS: Lazy<Providers> = Lazy::new(|| {
684+
pub static DEFAULT_QUERY_PROVIDERS: SyncLazy<Providers> = SyncLazy::new(|| {
685685
let providers = &mut Providers::default();
686686
providers.analysis = analysis;
687687
proc_macro_decls::provide(providers);
@@ -704,7 +704,7 @@ pub static DEFAULT_QUERY_PROVIDERS: Lazy<Providers> = Lazy::new(|| {
704704
*providers
705705
});
706706

707-
pub static DEFAULT_EXTERN_QUERY_PROVIDERS: Lazy<Providers> = Lazy::new(|| {
707+
pub static DEFAULT_EXTERN_QUERY_PROVIDERS: SyncLazy<Providers> = SyncLazy::new(|| {
708708
let mut extern_providers = *DEFAULT_QUERY_PROVIDERS;
709709
rustc_metadata::provide_extern(&mut extern_providers);
710710
rustc_codegen_ssa::provide_extern(&mut extern_providers);

compiler/rustc_interface/src/util.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ use rustc_span::symbol::{sym, Symbol};
2525
use smallvec::SmallVec;
2626
use std::env;
2727
use std::io::{self, Write};
28+
use std::lazy::SyncOnceCell;
2829
use std::mem;
2930
use std::ops::DerefMut;
3031
use std::path::{Path, PathBuf};
@@ -243,8 +244,7 @@ pub fn get_codegen_backend(sess: &Session) -> Box<dyn CodegenBackend> {
243244
// loading, so we leave the code here. It is potentially useful for other tools
244245
// that want to invoke the rustc binary while linking to rustc as well.
245246
pub fn rustc_path<'a>() -> Option<&'a Path> {
246-
static RUSTC_PATH: once_cell::sync::OnceCell<Option<PathBuf>> =
247-
once_cell::sync::OnceCell::new();
247+
static RUSTC_PATH: SyncOnceCell<Option<PathBuf>> = SyncOnceCell::new();
248248

249249
const BIN_PATH: &str = env!("RUSTC_INSTALL_BINDIR");
250250

0 commit comments

Comments
 (0)