interface: use OnceCell
from standard library
This commit is contained in:
parent
eb9e7c357e
commit
bd49eec3d7
@ -3606,7 +3606,6 @@ name = "rustc_interface"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"once_cell",
|
||||
"rustc-rayon",
|
||||
"rustc_ast",
|
||||
"rustc_ast_lowering",
|
||||
|
@ -43,7 +43,6 @@ rustc_resolve = { path = "../rustc_resolve" }
|
||||
rustc_trait_selection = { path = "../rustc_trait_selection" }
|
||||
rustc_ty = { path = "../rustc_ty" }
|
||||
tempfile = "3.0.5"
|
||||
once_cell = "1"
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
winapi = { version = "0.3", features = ["libloaderapi"] }
|
||||
|
@ -2,7 +2,6 @@ use crate::interface::{Compiler, Result};
|
||||
use crate::proc_macro_decls;
|
||||
use crate::util;
|
||||
|
||||
use once_cell::sync::Lazy;
|
||||
use rustc_ast::mut_visit::MutVisitor;
|
||||
use rustc_ast::{self as ast, visit};
|
||||
use rustc_codegen_ssa::back::link::emit_metadata;
|
||||
@ -46,6 +45,7 @@ use std::any::Any;
|
||||
use std::cell::RefCell;
|
||||
use std::ffi::OsString;
|
||||
use std::io::{self, BufWriter, Write};
|
||||
use std::lazy::SyncLazy;
|
||||
use std::path::PathBuf;
|
||||
use std::rc::Rc;
|
||||
use std::{env, fs, iter, mem};
|
||||
@ -681,7 +681,7 @@ pub fn prepare_outputs(
|
||||
Ok(outputs)
|
||||
}
|
||||
|
||||
pub static DEFAULT_QUERY_PROVIDERS: Lazy<Providers> = Lazy::new(|| {
|
||||
pub static DEFAULT_QUERY_PROVIDERS: SyncLazy<Providers> = SyncLazy::new(|| {
|
||||
let providers = &mut Providers::default();
|
||||
providers.analysis = analysis;
|
||||
proc_macro_decls::provide(providers);
|
||||
@ -704,7 +704,7 @@ pub static DEFAULT_QUERY_PROVIDERS: Lazy<Providers> = Lazy::new(|| {
|
||||
*providers
|
||||
});
|
||||
|
||||
pub static DEFAULT_EXTERN_QUERY_PROVIDERS: Lazy<Providers> = Lazy::new(|| {
|
||||
pub static DEFAULT_EXTERN_QUERY_PROVIDERS: SyncLazy<Providers> = SyncLazy::new(|| {
|
||||
let mut extern_providers = *DEFAULT_QUERY_PROVIDERS;
|
||||
rustc_metadata::provide_extern(&mut extern_providers);
|
||||
rustc_codegen_ssa::provide_extern(&mut extern_providers);
|
||||
|
@ -25,6 +25,7 @@ use rustc_span::symbol::{sym, Symbol};
|
||||
use smallvec::SmallVec;
|
||||
use std::env;
|
||||
use std::io::{self, Write};
|
||||
use std::lazy::SyncOnceCell;
|
||||
use std::mem;
|
||||
use std::ops::DerefMut;
|
||||
use std::path::{Path, PathBuf};
|
||||
@ -243,8 +244,7 @@ pub fn get_codegen_backend(sess: &Session) -> Box<dyn CodegenBackend> {
|
||||
// loading, so we leave the code here. It is potentially useful for other tools
|
||||
// that want to invoke the rustc binary while linking to rustc as well.
|
||||
pub fn rustc_path<'a>() -> Option<&'a Path> {
|
||||
static RUSTC_PATH: once_cell::sync::OnceCell<Option<PathBuf>> =
|
||||
once_cell::sync::OnceCell::new();
|
||||
static RUSTC_PATH: SyncOnceCell<Option<PathBuf>> = SyncOnceCell::new();
|
||||
|
||||
const BIN_PATH: &str = env!("RUSTC_INSTALL_BINDIR");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user