builtin_attrs.rs -> rustc_feature

This commit is contained in:
Mazdak Farrokhzad 2019-11-30 02:34:18 +01:00
parent d04b838a44
commit 70234f16df
16 changed files with 31 additions and 27 deletions

View File

@ -3575,6 +3575,7 @@ dependencies = [
"rustc_data_structures",
"rustc_error_codes",
"rustc_errors",
"rustc_feature",
"rustc_interface",
"rustc_lint",
"rustc_metadata",
@ -3612,6 +3613,8 @@ dependencies = [
name = "rustc_feature"
version = "0.0.0"
dependencies = [
"lazy_static 1.3.0",
"rustc_data_structures",
"syntax_pos",
]
@ -3855,6 +3858,7 @@ dependencies = [
"rustc_data_structures",
"rustc_error_codes",
"rustc_errors",
"rustc_feature",
"rustc_metadata",
"smallvec 1.0.0",
"syntax",

View File

@ -19,6 +19,7 @@ rustc_target = { path = "../librustc_target" }
rustc_lint = { path = "../librustc_lint" }
rustc_data_structures = { path = "../librustc_data_structures" }
errors = { path = "../librustc_errors", package = "rustc_errors" }
rustc_feature = { path = "../librustc_feature" }
rustc_metadata = { path = "../librustc_metadata" }
rustc_mir = { path = "../librustc_mir" }
rustc_parse = { path = "../librustc_parse" }

View File

@ -44,6 +44,7 @@ use errors::{PResult, registry::Registry};
use rustc_interface::interface;
use rustc_interface::util::get_codegen_sysroot;
use rustc_data_structures::sync::SeqCst;
use rustc_feature::find_gated_cfg;
use rustc_serialize::json::ToJson;
@ -62,7 +63,7 @@ use std::time::Instant;
use syntax::ast;
use syntax::source_map::FileLoader;
use syntax::feature_gate::{find_gated_cfg, UnstableFeatures};
use syntax::feature_gate::UnstableFeatures;
use syntax_pos::symbol::sym;
use syntax_pos::FileName;

View File

@ -10,4 +10,6 @@ path = "lib.rs"
doctest = false
[dependencies]
rustc_data_structures = { path = "../librustc_data_structures" }
lazy_static = "1.0.0"
syntax_pos = { path = "../libsyntax_pos" }

View File

@ -3,8 +3,9 @@
use AttributeType::*;
use AttributeGate::*;
use crate::{Features, Stability};
use rustc_data_structures::fx::FxHashMap;
use rustc_feature::{Features, Stability};
use syntax_pos::symbol::{Symbol, sym};
use lazy_static::lazy_static;

View File

@ -15,6 +15,7 @@
mod accepted;
mod removed;
mod active;
mod builtin_attrs;
use std::fmt;
use std::num::NonZeroU32;
@ -67,3 +68,8 @@ pub enum Stability {
pub use accepted::ACCEPTED_FEATURES;
pub use active::{ACTIVE_FEATURES, Features, INCOMPLETE_FEATURES};
pub use removed::{REMOVED_FEATURES, STABLE_REMOVED_FEATURES};
pub use builtin_attrs::{
AttributeGate, AttributeTemplate, AttributeType, find_gated_cfg, GatedCfg,
BuiltinAttribute, BUILTIN_ATTRIBUTES, BUILTIN_ATTRIBUTE_MAP,
deprecated_attributes, is_builtin_attr_name,
};

View File

@ -34,6 +34,7 @@ use lint::{LateContext, LintContext, LintArray};
use lint::{LintPass, LateLintPass, EarlyLintPass, EarlyContext};
use rustc::util::nodemap::FxHashSet;
use rustc_feature::{AttributeGate, AttributeTemplate, AttributeType, deprecated_attributes};
use rustc_feature::Stability;
use syntax::tokenstream::{TokenTree, TokenStream};
@ -42,8 +43,6 @@ use syntax::ptr::P;
use syntax::attr::{self, HasAttrs};
use syntax::source_map::Spanned;
use syntax::edition::Edition;
use syntax::feature_gate::{AttributeGate, AttributeTemplate, AttributeType};
use syntax::feature_gate::deprecated_attributes;
use syntax_pos::{BytePos, Span};
use syntax::symbol::{Symbol, kw, sym};
use syntax::errors::{Applicability, DiagnosticBuilder};

View File

@ -1,3 +1,4 @@
use rustc::hir;
use rustc::hir::def::{Res, DefKind};
use rustc::hir::def_id::DefId;
use rustc::lint;
@ -7,19 +8,17 @@ use rustc::ty::adjustment;
use rustc_data_structures::fx::FxHashMap;
use lint::{LateContext, EarlyContext, LintContext, LintArray};
use lint::{LintPass, EarlyLintPass, LateLintPass};
use rustc_feature::{AttributeType, BuiltinAttribute, BUILTIN_ATTRIBUTE_MAP};
use syntax::ast;
use syntax::attr;
use syntax::errors::{Applicability, pluralize};
use syntax::feature_gate::{AttributeType, BuiltinAttribute, BUILTIN_ATTRIBUTE_MAP};
use syntax::print::pprust;
use syntax::symbol::{kw, sym};
use syntax::symbol::Symbol;
use syntax::util::parser;
use syntax_pos::{Span, BytePos};
use rustc::hir;
use log::debug;
declare_lint! {

View File

@ -1,11 +1,10 @@
//! Meta-syntax validation logic of attributes for post-expansion.
use errors::{PResult, Applicability};
use syntax::feature_gate::AttributeTemplate;
use rustc_feature::{AttributeTemplate, BUILTIN_ATTRIBUTE_MAP};
use syntax::ast::{self, Attribute, AttrKind, Ident, MetaItem, MetaItemKind};
use syntax::attr::mk_name_value_item_str;
use syntax::early_buffered_lints::BufferedEarlyLintId;
use syntax::feature_gate::BUILTIN_ATTRIBUTE_MAP;
use syntax::token;
use syntax::tokenstream::TokenTree;
use syntax::sess::ParseSess;

View File

@ -20,6 +20,7 @@ arena = { path = "../libarena" }
errors = { path = "../librustc_errors", package = "rustc_errors" }
syntax_pos = { path = "../libsyntax_pos" }
rustc_data_structures = { path = "../librustc_data_structures" }
rustc_feature = { path = "../librustc_feature" }
rustc_metadata = { path = "../librustc_metadata" }
rustc_error_codes = { path = "../librustc_error_codes" }
smallvec = { version = "1.0", features = ["union", "may_dangle"] }

View File

@ -9,8 +9,8 @@ use rustc::hir::def_id::{CRATE_DEF_INDEX, DefId};
use rustc::session::Session;
use rustc::ty::{self, DefIdTree};
use rustc::util::nodemap::FxHashSet;
use rustc_feature::BUILTIN_ATTRIBUTES;
use syntax::ast::{self, Ident, Path};
use syntax::feature_gate::BUILTIN_ATTRIBUTES;
use syntax::source_map::SourceMap;
use syntax::struct_span_err;
use syntax::symbol::{Symbol, kw};

View File

@ -12,18 +12,18 @@ use rustc::middle::stability;
use rustc::session::Session;
use rustc::util::nodemap::FxHashSet;
use rustc::{ty, lint, span_bug};
use rustc_feature::is_builtin_attr_name;
use syntax::ast::{self, NodeId, Ident};
use syntax::attr::{self, StabilityLevel};
use syntax::edition::Edition;
use syntax::feature_gate::{emit_feature_err, is_builtin_attr_name};
use syntax::feature_gate::GateIssue;
use syntax::feature_gate::{emit_feature_err, GateIssue};
use syntax::print::pprust;
use syntax::symbol::{Symbol, kw, sym};
use syntax_expand::base::{self, InvocationRes, Indeterminate};
use syntax_expand::base::SyntaxExtension;
use syntax_expand::expand::{AstFragment, AstFragmentKind, Invocation, InvocationKind};
use syntax_expand::compile_declarative_macro;
use syntax_pos::hygiene::{self, ExpnId, ExpnData, ExpnKind};
use syntax_pos::symbol::{Symbol, kw, sym};
use syntax_pos::{Span, DUMMY_SP};
use std::{mem, ptr};

View File

@ -1,8 +1,8 @@
//! Parsing and validation of builtin attributes
use super::{mark_used, MetaItemKind};
use crate::ast::{self, Attribute, MetaItem, NestedMetaItem};
use crate::feature_gate::{find_gated_cfg, emit_feature_err, GatedCfg, GateIssue};
use crate::feature_gate::is_builtin_attr_name;
use crate::feature_gate::{emit_feature_err, GateIssue};
use crate::print::pprust;
use crate::sess::ParseSess;
@ -10,12 +10,9 @@ use errors::{Applicability, Handler};
use std::num::NonZeroU32;
use syntax_pos::hygiene::Transparency;
use syntax_pos::{symbol::Symbol, symbol::sym, Span};
use rustc_feature::Features;
use rustc_feature::{Features, find_gated_cfg, GatedCfg, is_builtin_attr_name};
use rustc_macros::HashStable_Generic;
use super::{mark_used, MetaItemKind};
use rustc_error_codes::*;
pub fn is_builtin_attr(attr: &Attribute) -> bool {

View File

@ -1,6 +1,6 @@
use rustc_feature::{ACCEPTED_FEATURES, ACTIVE_FEATURES, Features, Feature, State as FeatureState};
use rustc_feature::{REMOVED_FEATURES, STABLE_REMOVED_FEATURES};
use super::builtin_attrs::{AttributeGate, BUILTIN_ATTRIBUTE_MAP};
use rustc_feature::{AttributeGate, BUILTIN_ATTRIBUTE_MAP};
use crate::ast::{self, AssocTyConstraint, AssocTyConstraintKind, NodeId};
use crate::ast::{GenericParam, GenericParamKind, PatKind, RangeEnd, VariantData};

View File

@ -99,12 +99,6 @@ pub mod feature_gate {
GateIssue, UnstableFeatures,
EXPLAIN_STMT_ATTR_SYNTAX, EXPLAIN_UNSIZED_TUPLE_COERCION,
};
mod builtin_attrs;
pub use builtin_attrs::{
AttributeGate, AttributeTemplate, AttributeType, find_gated_cfg, GatedCfg,
BuiltinAttribute, BUILTIN_ATTRIBUTES, BUILTIN_ATTRIBUTE_MAP,
deprecated_attributes, is_builtin_attr_name,
};
}
pub mod mut_visit;
pub mod ptr;

View File

@ -1,7 +1,7 @@
use rustc_parse::validate_attr;
use rustc_feature::AttributeTemplate;
use syntax_pos::Symbol;
use syntax::ast::MetaItem;
use syntax::feature_gate::AttributeTemplate;
use syntax_expand::base::ExtCtxt;
pub fn check_builtin_macro_attribute(ecx: &ExtCtxt<'_>, meta_item: &MetaItem, name: Symbol) {