Skip to content

Commit 893aa4c

Browse files
committed
Move builtin attribute logic to new rustc_attr crate.
For now, this is all the crate contains, but more attribute logic & types will be moved there over time.
1 parent 589fc04 commit 893aa4c

File tree

63 files changed

+133
-53
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+133
-53
lines changed

Cargo.lock

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3091,6 +3091,7 @@ dependencies = [
30913091
"rustc-rayon",
30923092
"rustc-rayon-core",
30933093
"rustc_apfloat",
3094+
"rustc_attr",
30943095
"rustc_data_structures",
30953096
"rustc_errors",
30963097
"rustc_feature",
@@ -3372,6 +3373,7 @@ name = "rustc_ast_passes"
33723373
version = "0.0.0"
33733374
dependencies = [
33743375
"log",
3376+
"rustc_attr",
33753377
"rustc_data_structures",
33763378
"rustc_errors",
33773379
"rustc_feature",
@@ -3381,12 +3383,28 @@ dependencies = [
33813383
"syntax",
33823384
]
33833385

3386+
[[package]]
3387+
name = "rustc_attr"
3388+
version = "0.0.0"
3389+
dependencies = [
3390+
"rustc_data_structures",
3391+
"rustc_errors",
3392+
"rustc_feature",
3393+
"rustc_macros",
3394+
"rustc_session",
3395+
"rustc_span",
3396+
"serialize",
3397+
"smallvec 1.0.0",
3398+
"syntax",
3399+
]
3400+
33843401
[[package]]
33853402
name = "rustc_builtin_macros"
33863403
version = "0.0.0"
33873404
dependencies = [
33883405
"fmt_macros",
33893406
"log",
3407+
"rustc_attr",
33903408
"rustc_data_structures",
33913409
"rustc_errors",
33923410
"rustc_expand",
@@ -3409,6 +3427,7 @@ dependencies = [
34093427
"log",
34103428
"rustc",
34113429
"rustc-demangle",
3430+
"rustc_attr",
34123431
"rustc_codegen_ssa",
34133432
"rustc_codegen_utils",
34143433
"rustc_data_structures",
@@ -3439,6 +3458,7 @@ dependencies = [
34393458
"num_cpus",
34403459
"rustc",
34413460
"rustc_apfloat",
3461+
"rustc_attr",
34423462
"rustc_codegen_utils",
34433463
"rustc_data_structures",
34443464
"rustc_errors",
@@ -3549,6 +3569,7 @@ version = "0.0.0"
35493569
dependencies = [
35503570
"log",
35513571
"rustc_ast_passes",
3572+
"rustc_attr",
35523573
"rustc_data_structures",
35533574
"rustc_errors",
35543575
"rustc_feature",
@@ -3625,6 +3646,7 @@ dependencies = [
36253646
"rustc-rayon",
36263647
"rustc_ast_lowering",
36273648
"rustc_ast_passes",
3649+
"rustc_attr",
36283650
"rustc_builtin_macros",
36293651
"rustc_codegen_llvm",
36303652
"rustc_codegen_ssa",
@@ -3669,6 +3691,7 @@ version = "0.0.0"
36693691
dependencies = [
36703692
"log",
36713693
"rustc",
3694+
"rustc_attr",
36723695
"rustc_data_structures",
36733696
"rustc_errors",
36743697
"rustc_feature",
@@ -3709,6 +3732,7 @@ dependencies = [
37093732
"log",
37103733
"memmap",
37113734
"rustc",
3735+
"rustc_attr",
37123736
"rustc_data_structures",
37133737
"rustc_errors",
37143738
"rustc_expand",
@@ -3736,6 +3760,7 @@ dependencies = [
37363760
"polonius-engine",
37373761
"rustc",
37383762
"rustc_apfloat",
3763+
"rustc_attr",
37393764
"rustc_data_structures",
37403765
"rustc_errors",
37413766
"rustc_hir",
@@ -3758,6 +3783,7 @@ dependencies = [
37583783
"log",
37593784
"rustc",
37603785
"rustc_apfloat",
3786+
"rustc_attr",
37613787
"rustc_data_structures",
37623788
"rustc_errors",
37633789
"rustc_hir",
@@ -3777,6 +3803,7 @@ version = "0.0.0"
37773803
dependencies = [
37783804
"bitflags",
37793805
"log",
3806+
"rustc_attr",
37803807
"rustc_data_structures",
37813808
"rustc_errors",
37823809
"rustc_feature",
@@ -3794,6 +3821,7 @@ version = "0.0.0"
37943821
dependencies = [
37953822
"log",
37963823
"rustc",
3824+
"rustc_attr",
37973825
"rustc_data_structures",
37983826
"rustc_errors",
37993827
"rustc_feature",
@@ -3824,6 +3852,7 @@ version = "0.0.0"
38243852
dependencies = [
38253853
"log",
38263854
"rustc",
3855+
"rustc_attr",
38273856
"rustc_data_structures",
38283857
"rustc_errors",
38293858
"rustc_hir",
@@ -3841,6 +3870,7 @@ dependencies = [
38413870
"log",
38423871
"rustc",
38433872
"rustc_ast_lowering",
3873+
"rustc_attr",
38443874
"rustc_data_structures",
38453875
"rustc_errors",
38463876
"rustc_expand",
@@ -3958,6 +3988,7 @@ dependencies = [
39583988
"arena",
39593989
"log",
39603990
"rustc",
3991+
"rustc_attr",
39613992
"rustc_data_structures",
39623993
"rustc_errors",
39633994
"rustc_hir",

src/librustc/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ rustc-rayon = "0.3.0"
2121
rustc-rayon-core = "0.3.0"
2222
polonius-engine = "0.11.0"
2323
rustc_apfloat = { path = "../librustc_apfloat" }
24+
rustc_attr = { path = "../librustc_attr" }
2425
rustc_feature = { path = "../librustc_feature" }
2526
rustc_hir = { path = "../librustc_hir" }
2627
rustc_target = { path = "../librustc_target" }

src/librustc/ich/impls_hir.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
44
use crate::hir::map::DefPathHash;
55
use crate::ich::{Fingerprint, NodeIdHashingMode, StableHashingContext};
6+
use rustc_attr as attr;
67
use rustc_data_structures::stable_hasher::{HashStable, StableHasher, ToStableHashKey};
78
use rustc_hir as hir;
89
use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, CRATE_DEF_INDEX};
910
use smallvec::SmallVec;
1011
use std::mem;
11-
use syntax::attr;
1212

1313
impl<'ctx> rustc_hir::HashStableContext for StableHashingContext<'ctx> {
1414
#[inline]

src/librustc/middle/codegen_fn_attrs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::mir::mono::Linkage;
2+
use rustc_attr::{InlineAttr, OptimizeAttr};
23
use rustc_span::symbol::Symbol;
3-
use syntax::attr::{InlineAttr, OptimizeAttr};
44

55
#[derive(Clone, RustcEncodable, RustcDecodable, HashStable)]
66
pub struct CodegenFnAttrs {

src/librustc/middle/stability.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ pub use self::StabilityLevel::*;
55

66
use crate::session::{DiagnosticMessageId, Session};
77
use crate::ty::{self, TyCtxt};
8+
use rustc_attr::{self as attr, ConstStability, Deprecation, RustcDeprecation, Stability};
89
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
910
use rustc_errors::{Applicability, DiagnosticBuilder};
1011
use rustc_feature::GateIssue;
@@ -16,7 +17,6 @@ use rustc_session::lint::{self, BuiltinLintDiagnostics, Lint, LintBuffer};
1617
use rustc_span::symbol::{sym, Symbol};
1718
use rustc_span::{MultiSpan, Span};
1819
use syntax::ast::CRATE_NODE_ID;
19-
use syntax::attr::{self, ConstStability, Deprecation, RustcDeprecation, Stability};
2020
use syntax::sess::feature_err_issue;
2121

2222
use std::num::NonZeroU32;

src/librustc/mir/mono.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use crate::ich::{Fingerprint, NodeIdHashingMode, StableHashingContext};
33
use crate::session::config::OptLevel;
44
use crate::ty::print::obsolete::DefPathBasedNames;
55
use crate::ty::{subst::InternalSubsts, Instance, InstanceDef, SymbolName, TyCtxt};
6+
use rustc_attr::InlineAttr;
67
use rustc_data_structures::base_n;
78
use rustc_data_structures::fx::FxHashMap;
89
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
@@ -12,7 +13,6 @@ use rustc_span::source_map::Span;
1213
use rustc_span::symbol::Symbol;
1314
use std::fmt;
1415
use std::hash::Hash;
15-
use syntax::attr::InlineAttr;
1616

1717
/// Describes how a monomorphization will be instantiated in object files.
1818
#[derive(PartialEq)]

src/librustc/traits/on_unimplemented.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ use fmt_macros::{Parser, Piece, Position};
33
use crate::ty::{self, GenericParamDefKind, TyCtxt};
44
use crate::util::common::ErrorReported;
55

6+
use rustc_attr as attr;
67
use rustc_data_structures::fx::FxHashMap;
78
use rustc_errors::struct_span_err;
89
use rustc_hir::def_id::DefId;
910
use rustc_span::symbol::{kw, sym, Symbol};
1011
use rustc_span::Span;
1112
use syntax::ast::{MetaItem, NestedMetaItem};
12-
use syntax::attr;
1313

1414
#[derive(Clone, Debug)]
1515
pub struct OnUnimplementedFormatString(Symbol);

src/librustc/ty/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ use rustc_session::config::CrateType;
5151
use rustc_session::config::{BorrowckMode, OutputFilenames};
5252
use rustc_session::Session;
5353

54+
use rustc_attr as attr;
5455
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
5556
use rustc_data_structures::profiling::SelfProfilerRef;
5657
use rustc_data_structures::sharded::{IntoPointer, ShardedHashMap};
@@ -79,7 +80,6 @@ use std::mem;
7980
use std::ops::{Bound, Deref};
8081
use std::sync::Arc;
8182
use syntax::ast;
82-
use syntax::attr;
8383
use syntax::expand::allocator::AllocatorKind;
8484

8585
type InternedSet<'tcx, T> = ShardedHashMap<Interned<'tcx, T>, ()>;

src/librustc/ty/layout.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use crate::session::{self, DataTypeKind};
22
use crate::ty::{self, subst::SubstsRef, ReprOptions, Ty, TyCtxt, TypeFoldable};
33

4+
use rustc_attr as attr;
45
use rustc_span::DUMMY_SP;
56
use syntax::ast::{self, Ident, IntTy, UintTy};
6-
use syntax::attr;
77

88
use std::cmp;
99
use std::fmt;

src/librustc/ty/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ use crate::ty::layout::VariantIdx;
2626
use crate::ty::subst::{InternalSubsts, Subst, SubstsRef};
2727
use crate::ty::util::{Discr, IntTypeExt};
2828
use crate::ty::walk::TypeWalker;
29+
use rustc_attr as attr;
2930
use rustc_data_structures::captures::Captures;
3031
use rustc_data_structures::fx::FxHashMap;
3132
use rustc_data_structures::fx::FxIndexMap;
@@ -53,7 +54,6 @@ use std::ops::Range;
5354
use std::slice;
5455
use std::{mem, ptr};
5556
use syntax::ast::{self, Constness, Ident, Name, NodeId};
56-
use syntax::attr;
5757

5858
pub use self::sty::BoundRegion::*;
5959
pub use self::sty::InferTy::*;

0 commit comments

Comments
 (0)