Skip to content

Commit 70234f1

Browse files
committed
builtin_attrs.rs -> rustc_feature
1 parent d04b838 commit 70234f1

File tree

16 files changed

+31
-27
lines changed

16 files changed

+31
-27
lines changed

Cargo.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3575,6 +3575,7 @@ dependencies = [
35753575
"rustc_data_structures",
35763576
"rustc_error_codes",
35773577
"rustc_errors",
3578+
"rustc_feature",
35783579
"rustc_interface",
35793580
"rustc_lint",
35803581
"rustc_metadata",
@@ -3612,6 +3613,8 @@ dependencies = [
36123613
name = "rustc_feature"
36133614
version = "0.0.0"
36143615
dependencies = [
3616+
"lazy_static 1.3.0",
3617+
"rustc_data_structures",
36153618
"syntax_pos",
36163619
]
36173620

@@ -3855,6 +3858,7 @@ dependencies = [
38553858
"rustc_data_structures",
38563859
"rustc_error_codes",
38573860
"rustc_errors",
3861+
"rustc_feature",
38583862
"rustc_metadata",
38593863
"smallvec 1.0.0",
38603864
"syntax",

src/librustc_driver/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ rustc_target = { path = "../librustc_target" }
1919
rustc_lint = { path = "../librustc_lint" }
2020
rustc_data_structures = { path = "../librustc_data_structures" }
2121
errors = { path = "../librustc_errors", package = "rustc_errors" }
22+
rustc_feature = { path = "../librustc_feature" }
2223
rustc_metadata = { path = "../librustc_metadata" }
2324
rustc_mir = { path = "../librustc_mir" }
2425
rustc_parse = { path = "../librustc_parse" }

src/librustc_driver/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ use errors::{PResult, registry::Registry};
4444
use rustc_interface::interface;
4545
use rustc_interface::util::get_codegen_sysroot;
4646
use rustc_data_structures::sync::SeqCst;
47+
use rustc_feature::find_gated_cfg;
4748

4849
use rustc_serialize::json::ToJson;
4950

@@ -62,7 +63,7 @@ use std::time::Instant;
6263

6364
use syntax::ast;
6465
use syntax::source_map::FileLoader;
65-
use syntax::feature_gate::{find_gated_cfg, UnstableFeatures};
66+
use syntax::feature_gate::UnstableFeatures;
6667
use syntax_pos::symbol::sym;
6768
use syntax_pos::FileName;
6869

src/librustc_feature/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,6 @@ path = "lib.rs"
1010
doctest = false
1111

1212
[dependencies]
13+
rustc_data_structures = { path = "../librustc_data_structures" }
14+
lazy_static = "1.0.0"
1315
syntax_pos = { path = "../libsyntax_pos" }

src/libsyntax/feature_gate/builtin_attrs.rs renamed to src/librustc_feature/builtin_attrs.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
use AttributeType::*;
44
use AttributeGate::*;
55

6+
use crate::{Features, Stability};
7+
68
use rustc_data_structures::fx::FxHashMap;
7-
use rustc_feature::{Features, Stability};
89
use syntax_pos::symbol::{Symbol, sym};
910
use lazy_static::lazy_static;
1011

src/librustc_feature/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
mod accepted;
1616
mod removed;
1717
mod active;
18+
mod builtin_attrs;
1819

1920
use std::fmt;
2021
use std::num::NonZeroU32;
@@ -67,3 +68,8 @@ pub enum Stability {
6768
pub use accepted::ACCEPTED_FEATURES;
6869
pub use active::{ACTIVE_FEATURES, Features, INCOMPLETE_FEATURES};
6970
pub use removed::{REMOVED_FEATURES, STABLE_REMOVED_FEATURES};
71+
pub use builtin_attrs::{
72+
AttributeGate, AttributeTemplate, AttributeType, find_gated_cfg, GatedCfg,
73+
BuiltinAttribute, BUILTIN_ATTRIBUTES, BUILTIN_ATTRIBUTE_MAP,
74+
deprecated_attributes, is_builtin_attr_name,
75+
};

src/librustc_lint/builtin.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ use lint::{LateContext, LintContext, LintArray};
3434
use lint::{LintPass, LateLintPass, EarlyLintPass, EarlyContext};
3535

3636
use rustc::util::nodemap::FxHashSet;
37+
use rustc_feature::{AttributeGate, AttributeTemplate, AttributeType, deprecated_attributes};
3738
use rustc_feature::Stability;
3839

3940
use syntax::tokenstream::{TokenTree, TokenStream};
@@ -42,8 +43,6 @@ use syntax::ptr::P;
4243
use syntax::attr::{self, HasAttrs};
4344
use syntax::source_map::Spanned;
4445
use syntax::edition::Edition;
45-
use syntax::feature_gate::{AttributeGate, AttributeTemplate, AttributeType};
46-
use syntax::feature_gate::deprecated_attributes;
4746
use syntax_pos::{BytePos, Span};
4847
use syntax::symbol::{Symbol, kw, sym};
4948
use syntax::errors::{Applicability, DiagnosticBuilder};

src/librustc_lint/unused.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use rustc::hir;
12
use rustc::hir::def::{Res, DefKind};
23
use rustc::hir::def_id::DefId;
34
use rustc::lint;
@@ -7,19 +8,17 @@ use rustc::ty::adjustment;
78
use rustc_data_structures::fx::FxHashMap;
89
use lint::{LateContext, EarlyContext, LintContext, LintArray};
910
use lint::{LintPass, EarlyLintPass, LateLintPass};
11+
use rustc_feature::{AttributeType, BuiltinAttribute, BUILTIN_ATTRIBUTE_MAP};
1012

1113
use syntax::ast;
1214
use syntax::attr;
1315
use syntax::errors::{Applicability, pluralize};
14-
use syntax::feature_gate::{AttributeType, BuiltinAttribute, BUILTIN_ATTRIBUTE_MAP};
1516
use syntax::print::pprust;
1617
use syntax::symbol::{kw, sym};
1718
use syntax::symbol::Symbol;
1819
use syntax::util::parser;
1920
use syntax_pos::{Span, BytePos};
2021

21-
use rustc::hir;
22-
2322
use log::debug;
2423

2524
declare_lint! {

src/librustc_parse/validate_attr.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
//! Meta-syntax validation logic of attributes for post-expansion.
22
33
use errors::{PResult, Applicability};
4-
use syntax::feature_gate::AttributeTemplate;
4+
use rustc_feature::{AttributeTemplate, BUILTIN_ATTRIBUTE_MAP};
55
use syntax::ast::{self, Attribute, AttrKind, Ident, MetaItem, MetaItemKind};
66
use syntax::attr::mk_name_value_item_str;
77
use syntax::early_buffered_lints::BufferedEarlyLintId;
8-
use syntax::feature_gate::BUILTIN_ATTRIBUTE_MAP;
98
use syntax::token;
109
use syntax::tokenstream::TokenTree;
1110
use syntax::sess::ParseSess;

src/librustc_resolve/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ arena = { path = "../libarena" }
2020
errors = { path = "../librustc_errors", package = "rustc_errors" }
2121
syntax_pos = { path = "../libsyntax_pos" }
2222
rustc_data_structures = { path = "../librustc_data_structures" }
23+
rustc_feature = { path = "../librustc_feature" }
2324
rustc_metadata = { path = "../librustc_metadata" }
2425
rustc_error_codes = { path = "../librustc_error_codes" }
2526
smallvec = { version = "1.0", features = ["union", "may_dangle"] }

src/librustc_resolve/diagnostics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ use rustc::hir::def_id::{CRATE_DEF_INDEX, DefId};
99
use rustc::session::Session;
1010
use rustc::ty::{self, DefIdTree};
1111
use rustc::util::nodemap::FxHashSet;
12+
use rustc_feature::BUILTIN_ATTRIBUTES;
1213
use syntax::ast::{self, Ident, Path};
13-
use syntax::feature_gate::BUILTIN_ATTRIBUTES;
1414
use syntax::source_map::SourceMap;
1515
use syntax::struct_span_err;
1616
use syntax::symbol::{Symbol, kw};

src/librustc_resolve/macros.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@ use rustc::middle::stability;
1212
use rustc::session::Session;
1313
use rustc::util::nodemap::FxHashSet;
1414
use rustc::{ty, lint, span_bug};
15+
use rustc_feature::is_builtin_attr_name;
1516
use syntax::ast::{self, NodeId, Ident};
1617
use syntax::attr::{self, StabilityLevel};
1718
use syntax::edition::Edition;
18-
use syntax::feature_gate::{emit_feature_err, is_builtin_attr_name};
19-
use syntax::feature_gate::GateIssue;
19+
use syntax::feature_gate::{emit_feature_err, GateIssue};
2020
use syntax::print::pprust;
21-
use syntax::symbol::{Symbol, kw, sym};
2221
use syntax_expand::base::{self, InvocationRes, Indeterminate};
2322
use syntax_expand::base::SyntaxExtension;
2423
use syntax_expand::expand::{AstFragment, AstFragmentKind, Invocation, InvocationKind};
2524
use syntax_expand::compile_declarative_macro;
2625
use syntax_pos::hygiene::{self, ExpnId, ExpnData, ExpnKind};
26+
use syntax_pos::symbol::{Symbol, kw, sym};
2727
use syntax_pos::{Span, DUMMY_SP};
2828

2929
use std::{mem, ptr};

src/libsyntax/attr/builtin.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
11
//! Parsing and validation of builtin attributes
22
3+
use super::{mark_used, MetaItemKind};
34
use crate::ast::{self, Attribute, MetaItem, NestedMetaItem};
4-
use crate::feature_gate::{find_gated_cfg, emit_feature_err, GatedCfg, GateIssue};
5-
use crate::feature_gate::is_builtin_attr_name;
5+
use crate::feature_gate::{emit_feature_err, GateIssue};
66
use crate::print::pprust;
77
use crate::sess::ParseSess;
88

99
use errors::{Applicability, Handler};
1010
use std::num::NonZeroU32;
1111
use syntax_pos::hygiene::Transparency;
1212
use syntax_pos::{symbol::Symbol, symbol::sym, Span};
13-
use rustc_feature::Features;
14-
13+
use rustc_feature::{Features, find_gated_cfg, GatedCfg, is_builtin_attr_name};
1514
use rustc_macros::HashStable_Generic;
1615

17-
use super::{mark_used, MetaItemKind};
18-
1916
use rustc_error_codes::*;
2017

2118
pub fn is_builtin_attr(attr: &Attribute) -> bool {

src/libsyntax/feature_gate/check.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use rustc_feature::{ACCEPTED_FEATURES, ACTIVE_FEATURES, Features, Feature, State as FeatureState};
22
use rustc_feature::{REMOVED_FEATURES, STABLE_REMOVED_FEATURES};
3-
use super::builtin_attrs::{AttributeGate, BUILTIN_ATTRIBUTE_MAP};
3+
use rustc_feature::{AttributeGate, BUILTIN_ATTRIBUTE_MAP};
44

55
use crate::ast::{self, AssocTyConstraint, AssocTyConstraintKind, NodeId};
66
use crate::ast::{GenericParam, GenericParamKind, PatKind, RangeEnd, VariantData};

src/libsyntax/lib.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,6 @@ pub mod feature_gate {
9999
GateIssue, UnstableFeatures,
100100
EXPLAIN_STMT_ATTR_SYNTAX, EXPLAIN_UNSIZED_TUPLE_COERCION,
101101
};
102-
mod builtin_attrs;
103-
pub use builtin_attrs::{
104-
AttributeGate, AttributeTemplate, AttributeType, find_gated_cfg, GatedCfg,
105-
BuiltinAttribute, BUILTIN_ATTRIBUTES, BUILTIN_ATTRIBUTE_MAP,
106-
deprecated_attributes, is_builtin_attr_name,
107-
};
108102
}
109103
pub mod mut_visit;
110104
pub mod ptr;

src/libsyntax_ext/util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use rustc_parse::validate_attr;
2+
use rustc_feature::AttributeTemplate;
23
use syntax_pos::Symbol;
34
use syntax::ast::MetaItem;
4-
use syntax::feature_gate::AttributeTemplate;
55
use syntax_expand::base::ExtCtxt;
66

77
pub fn check_builtin_macro_attribute(ecx: &ExtCtxt<'_>, meta_item: &MetaItem, name: Symbol) {

0 commit comments

Comments
 (0)