hir: replace lazy_static
by SyncLazy
from std
This commit is contained in:
parent
1b650d0fea
commit
67b8f9491c
@ -3530,7 +3530,6 @@ version = "0.0.0"
|
||||
name = "rustc_hir"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"rustc_ast",
|
||||
"rustc_data_structures",
|
||||
"rustc_index",
|
||||
|
@ -15,6 +15,5 @@ rustc_index = { path = "../rustc_index" }
|
||||
rustc_span = { path = "../rustc_span" }
|
||||
rustc_serialize = { path = "../rustc_serialize" }
|
||||
rustc_ast = { path = "../rustc_ast" }
|
||||
lazy_static = "1"
|
||||
tracing = "0.1"
|
||||
smallvec = { version = "1.0", features = ["union", "may_dangle"] }
|
||||
|
@ -17,7 +17,7 @@ use rustc_macros::HashStable_Generic;
|
||||
use rustc_span::symbol::{kw, sym, Symbol};
|
||||
use rustc_span::Span;
|
||||
|
||||
use lazy_static::lazy_static;
|
||||
use std::lazy::SyncLazy;
|
||||
|
||||
pub enum LangItemGroup {
|
||||
Op,
|
||||
@ -117,14 +117,12 @@ macro_rules! language_item_table {
|
||||
)*
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
/// A mapping from the name of the lang item to its order and the form it must be of.
|
||||
pub static ref ITEM_REFS: FxHashMap<Symbol, (usize, Target)> = {
|
||||
let mut item_refs = FxHashMap::default();
|
||||
$( item_refs.insert($name, (LangItem::$variant as usize, $target)); )*
|
||||
item_refs
|
||||
};
|
||||
}
|
||||
/// A mapping from the name of the lang item to its order and the form it must be of.
|
||||
pub static ITEM_REFS: SyncLazy<FxHashMap<Symbol, (usize, Target)>> = SyncLazy::new(|| {
|
||||
let mut item_refs = FxHashMap::default();
|
||||
$( item_refs.insert($name, (LangItem::$variant as usize, $target)); )*
|
||||
item_refs
|
||||
});
|
||||
|
||||
// End of the macro
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
#![feature(const_fn)] // For the unsizing cast on `&[]`
|
||||
#![feature(const_panic)]
|
||||
#![feature(in_band_lifetimes)]
|
||||
#![feature(once_cell)]
|
||||
#![feature(or_patterns)]
|
||||
#![recursion_limit = "256"]
|
||||
|
||||
|
@ -7,18 +7,16 @@ use rustc_ast as ast;
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
|
||||
use lazy_static::lazy_static;
|
||||
use std::lazy::SyncLazy;
|
||||
|
||||
macro_rules! weak_lang_items {
|
||||
($($name:ident, $item:ident, $sym:ident;)*) => (
|
||||
|
||||
lazy_static! {
|
||||
pub static ref WEAK_ITEMS_REFS: FxHashMap<Symbol, LangItem> = {
|
||||
let mut map = FxHashMap::default();
|
||||
$(map.insert(sym::$name, LangItem::$item);)*
|
||||
map
|
||||
};
|
||||
}
|
||||
pub static WEAK_ITEMS_REFS: SyncLazy<FxHashMap<Symbol, LangItem>> = SyncLazy::new(|| {
|
||||
let mut map = FxHashMap::default();
|
||||
$(map.insert(sym::$name, LangItem::$item);)*
|
||||
map
|
||||
});
|
||||
|
||||
/// The `check_name` argument avoids the need for `librustc_hir` to depend on
|
||||
/// `librustc_session`.
|
||||
|
Loading…
x
Reference in New Issue
Block a user