feature: replace lazy_static
by SyncLazy
from std
This commit is contained in:
parent
67b8f9491c
commit
73a7204983
@ -3513,7 +3513,6 @@ dependencies = [
|
|||||||
name = "rustc_feature"
|
name = "rustc_feature"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"lazy_static",
|
|
||||||
"rustc_data_structures",
|
"rustc_data_structures",
|
||||||
"rustc_span",
|
"rustc_span",
|
||||||
]
|
]
|
||||||
|
@ -9,5 +9,4 @@ doctest = false
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
rustc_data_structures = { path = "../rustc_data_structures" }
|
rustc_data_structures = { path = "../rustc_data_structures" }
|
||||||
lazy_static = "1.0.0"
|
|
||||||
rustc_span = { path = "../rustc_span" }
|
rustc_span = { path = "../rustc_span" }
|
||||||
|
@ -5,10 +5,11 @@ use AttributeType::*;
|
|||||||
|
|
||||||
use crate::{Features, Stability};
|
use crate::{Features, Stability};
|
||||||
|
|
||||||
use lazy_static::lazy_static;
|
|
||||||
use rustc_data_structures::fx::FxHashMap;
|
use rustc_data_structures::fx::FxHashMap;
|
||||||
use rustc_span::symbol::{sym, Symbol};
|
use rustc_span::symbol::{sym, Symbol};
|
||||||
|
|
||||||
|
use std::lazy::SyncLazy;
|
||||||
|
|
||||||
type GateFn = fn(&Features) -> bool;
|
type GateFn = fn(&Features) -> bool;
|
||||||
|
|
||||||
macro_rules! cfg_fn {
|
macro_rules! cfg_fn {
|
||||||
@ -589,14 +590,12 @@ pub fn is_builtin_attr_name(name: Symbol) -> bool {
|
|||||||
BUILTIN_ATTRIBUTE_MAP.get(&name).is_some()
|
BUILTIN_ATTRIBUTE_MAP.get(&name).is_some()
|
||||||
}
|
}
|
||||||
|
|
||||||
lazy_static! {
|
pub static BUILTIN_ATTRIBUTE_MAP: SyncLazy<FxHashMap<Symbol, &'static BuiltinAttribute>> = SyncLazy::new(|| {
|
||||||
pub static ref BUILTIN_ATTRIBUTE_MAP: FxHashMap<Symbol, &'static BuiltinAttribute> = {
|
let mut map = FxHashMap::default();
|
||||||
let mut map = FxHashMap::default();
|
for attr in BUILTIN_ATTRIBUTES.iter() {
|
||||||
for attr in BUILTIN_ATTRIBUTES.iter() {
|
if map.insert(attr.0, attr).is_some() {
|
||||||
if map.insert(attr.0, attr).is_some() {
|
panic!("duplicate builtin attribute `{}`", attr.0);
|
||||||
panic!("duplicate builtin attribute `{}`", attr.0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
map
|
}
|
||||||
};
|
map
|
||||||
}
|
});
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
//! even if it is stabilized or removed, *do not remove it*. Instead, move the
|
//! even if it is stabilized or removed, *do not remove it*. Instead, move the
|
||||||
//! symbol to the `accepted` or `removed` modules respectively.
|
//! symbol to the `accepted` or `removed` modules respectively.
|
||||||
|
|
||||||
|
#![feature(once_cell)]
|
||||||
|
|
||||||
mod accepted;
|
mod accepted;
|
||||||
mod active;
|
mod active;
|
||||||
mod builtin_attrs;
|
mod builtin_attrs;
|
||||||
|
Loading…
Reference in New Issue
Block a user