File tree Expand file tree Collapse file tree 5 files changed +14
-19
lines changed Expand file tree Collapse file tree 5 files changed +14
-19
lines changed Original file line number Diff line number Diff line change @@ -3530,7 +3530,6 @@ version = "0.0.0"
3530
3530
name = "rustc_hir"
3531
3531
version = "0.0.0"
3532
3532
dependencies = [
3533
- "lazy_static",
3534
3533
"rustc_ast",
3535
3534
"rustc_data_structures",
3536
3535
"rustc_index",
Original file line number Diff line number Diff line change @@ -15,6 +15,5 @@ rustc_index = { path = "../rustc_index" }
15
15
rustc_span = { path = "../rustc_span" }
16
16
rustc_serialize = { path = "../rustc_serialize" }
17
17
rustc_ast = { path = "../rustc_ast" }
18
- lazy_static = "1"
19
18
tracing = "0.1"
20
19
smallvec = { version = "1.0", features = ["union", "may_dangle"] }
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ use rustc_macros::HashStable_Generic;
17
17
use rustc_span::symbol::{kw, sym, Symbol};
18
18
use rustc_span::Span;
19
19
20
- use lazy_static::lazy_static ;
20
+ use std::lazy::SyncLazy ;
21
21
22
22
pub enum LangItemGroup {
23
23
Op,
@@ -117,14 +117,12 @@ macro_rules! language_item_table {
117
117
)*
118
118
}
119
119
120
- lazy_static! {
121
- /// A mapping from the name of the lang item to its order and the form it must be of.
122
- pub static ref ITEM_REFS: FxHashMap<Symbol, (usize, Target)> = {
123
- let mut item_refs = FxHashMap::default();
124
- $( item_refs.insert($name, (LangItem::$variant as usize, $target)); )*
125
- item_refs
126
- };
127
- }
120
+ /// A mapping from the name of the lang item to its order and the form it must be of.
121
+ pub static ITEM_REFS: SyncLazy<FxHashMap<Symbol, (usize, Target)>> = SyncLazy::new(|| {
122
+ let mut item_refs = FxHashMap::default();
123
+ $( item_refs.insert($name, (LangItem::$variant as usize, $target)); )*
124
+ item_refs
125
+ });
128
126
129
127
// End of the macro
130
128
}
Original file line number Diff line number Diff line change 6
6
#![feature(const_fn)] // For the unsizing cast on `&[]`
7
7
#![feature(const_panic)]
8
8
#![feature(in_band_lifetimes)]
9
+ #![feature(once_cell)]
9
10
#![feature(or_patterns)]
10
11
#![recursion_limit = "256"]
11
12
Original file line number Diff line number Diff line change @@ -7,18 +7,16 @@ use rustc_ast as ast;
7
7
use rustc_data_structures::fx::FxHashMap;
8
8
use rustc_span::symbol::{sym, Symbol};
9
9
10
- use lazy_static::lazy_static ;
10
+ use std::lazy::SyncLazy ;
11
11
12
12
macro_rules! weak_lang_items {
13
13
($($name:ident, $item:ident, $sym:ident;)*) => (
14
14
15
- lazy_static! {
16
- pub static ref WEAK_ITEMS_REFS: FxHashMap<Symbol, LangItem> = {
17
- let mut map = FxHashMap::default();
18
- $(map.insert(sym::$name, LangItem::$item);)*
19
- map
20
- };
21
- }
15
+ pub static WEAK_ITEMS_REFS: SyncLazy<FxHashMap<Symbol, LangItem>> = SyncLazy::new(|| {
16
+ let mut map = FxHashMap::default();
17
+ $(map.insert(sym::$name, LangItem::$item);)*
18
+ map
19
+ });
22
20
23
21
/// The `check_name` argument avoids the need for `librustc_hir` to depend on
24
22
/// `librustc_session`.
You can’t perform that action at this time.
0 commit comments