Skip to content

Commit 6164f5c

Browse files
committed
1. move node_id to syntax
2. invert rustc_session & syntax deps 3. drop rustc_session dep in rustc_hir
1 parent a7f6cc7 commit 6164f5c

File tree

42 files changed

+83
-91
lines changed

Some content is hidden

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

42 files changed

+83
-91
lines changed

Cargo.lock

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3609,7 +3609,6 @@ dependencies = [
36093609
"rustc_errors",
36103610
"rustc_index",
36113611
"rustc_macros",
3612-
"rustc_session",
36133612
"rustc_span",
36143613
"rustc_target",
36153614
"serialize",
@@ -3929,6 +3928,7 @@ dependencies = [
39293928
"rustc_span",
39303929
"rustc_target",
39313930
"serialize",
3931+
"syntax",
39323932
]
39333933

39343934
[[package]]
@@ -4525,13 +4525,10 @@ version = "0.0.0"
45254525
dependencies = [
45264526
"log",
45274527
"rustc_data_structures",
4528-
"rustc_error_codes",
45294528
"rustc_errors",
4530-
"rustc_feature",
45314529
"rustc_index",
45324530
"rustc_lexer",
45334531
"rustc_macros",
4534-
"rustc_session",
45354532
"rustc_span",
45364533
"scoped-tls",
45374534
"serialize",

src/librustc/hir/map/definitions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ use rustc_data_structures::stable_hasher::StableHasher;
1010
use rustc_hir as hir;
1111
use rustc_hir::def_id::{CrateNum, DefId, DefIndex, CRATE_DEF_INDEX, LOCAL_CRATE};
1212
use rustc_index::vec::IndexVec;
13-
use rustc_session::node_id::NodeMap;
1413
use rustc_session::CrateDisambiguator;
1514
use rustc_span::hygiene::ExpnId;
1615
use rustc_span::symbol::{sym, Symbol};
1716
use rustc_span::Span;
1817
use syntax::ast;
18+
use syntax::node_id::NodeMap;
1919

2020
use std::borrow::Borrow;
2121
use std::fmt::Write;

src/librustc/middle/stability.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ use rustc_hir as hir;
1313
use rustc_hir::def::DefKind;
1414
use rustc_hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX};
1515
use rustc_hir::{self, HirId};
16-
use rustc_session::lint::{self, BuiltinLintDiagnostics, Lint, LintBuffer};
16+
use rustc_session::lint::builtin::{DEPRECATED, DEPRECATED_IN_FUTURE, SOFT_UNSTABLE};
17+
use rustc_session::lint::{BuiltinLintDiagnostics, Lint, LintBuffer};
18+
use rustc_session::parse::feature_err_issue;
1719
use rustc_span::symbol::{sym, Symbol};
1820
use rustc_span::{MultiSpan, Span};
1921
use syntax::ast::CRATE_NODE_ID;
20-
use syntax::sess::feature_err_issue;
2122

2223
use std::num::NonZeroU32;
2324

@@ -97,7 +98,7 @@ pub fn report_unstable(
9798
issue: Option<NonZeroU32>,
9899
is_soft: bool,
99100
span: Span,
100-
soft_handler: impl FnOnce(&'static lint::Lint, Span, &str),
101+
soft_handler: impl FnOnce(&'static Lint, Span, &str),
101102
) {
102103
let msg = match reason {
103104
Some(r) => format!("use of unstable library feature '{}': {}", feature, r),
@@ -119,7 +120,7 @@ pub fn report_unstable(
119120
let fresh = sess.one_time_diagnostics.borrow_mut().insert(error_id);
120121
if fresh {
121122
if is_soft {
122-
soft_handler(lint::builtin::SOFT_UNSTABLE, span, &msg)
123+
soft_handler(SOFT_UNSTABLE, span, &msg)
123124
} else {
124125
feature_err_issue(&sess.parse_sess, feature, span, GateIssue::Library(issue), &msg)
125126
.emit();
@@ -175,19 +176,19 @@ fn deprecation_message_common(message: String, reason: Option<Symbol>) -> String
175176

176177
pub fn deprecation_message(depr: &Deprecation, path: &str) -> (String, &'static Lint) {
177178
let message = format!("use of deprecated item '{}'", path);
178-
(deprecation_message_common(message, depr.note), lint::builtin::DEPRECATED)
179+
(deprecation_message_common(message, depr.note), DEPRECATED)
179180
}
180181

181182
pub fn rustc_deprecation_message(depr: &RustcDeprecation, path: &str) -> (String, &'static Lint) {
182183
let (message, lint) = if deprecation_in_effect(&depr.since.as_str()) {
183-
(format!("use of deprecated item '{}'", path), lint::builtin::DEPRECATED)
184+
(format!("use of deprecated item '{}'", path), DEPRECATED)
184185
} else {
185186
(
186187
format!(
187188
"use of item '{}' that will be deprecated in future version {}",
188189
path, depr.since
189190
),
190-
lint::builtin::DEPRECATED_IN_FUTURE,
191+
DEPRECATED_IN_FUTURE,
191192
)
192193
};
193194
(deprecation_message_common(message, Some(depr.reason)), lint)

src/librustc/ty/context.rs

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,33 +41,34 @@ use crate::ty::{ExistentialPredicate, InferTy, ParamTy, PolyFnSig, Predicate, Pr
4141
use crate::ty::{InferConst, ParamConst};
4242
use crate::ty::{List, TyKind, TyS};
4343
use crate::util::common::ErrorReported;
44-
use rustc_data_structures::sync;
45-
use rustc_hir as hir;
46-
use rustc_hir::def::{DefKind, Res};
47-
use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, DefIdSet, DefIndex, LOCAL_CRATE};
48-
use rustc_hir::{HirId, Node, TraitCandidate};
49-
use rustc_hir::{ItemKind, ItemLocalId, ItemLocalMap, ItemLocalSet};
50-
use rustc_session::config::CrateType;
51-
use rustc_session::config::{BorrowckMode, OutputFilenames};
52-
use rustc_session::Session;
53-
5444
use rustc_attr as attr;
5545
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
5646
use rustc_data_structures::profiling::SelfProfilerRef;
5747
use rustc_data_structures::sharded::{IntoPointer, ShardedHashMap};
5848
use rustc_data_structures::stable_hasher::{
5949
hash_stable_hashmap, HashStable, StableHasher, StableVec,
6050
};
61-
use rustc_data_structures::sync::{Lock, Lrc, WorkerLocal};
51+
use rustc_data_structures::sync::{self, Lock, Lrc, WorkerLocal};
6252
use rustc_errors::DiagnosticBuilder;
53+
use rustc_hir as hir;
54+
use rustc_hir::def::{DefKind, Res};
55+
use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, DefIdSet, DefIndex, LOCAL_CRATE};
56+
use rustc_hir::{HirId, Node, TraitCandidate};
57+
use rustc_hir::{ItemKind, ItemLocalId, ItemLocalMap, ItemLocalSet};
6358
use rustc_index::vec::{Idx, IndexVec};
6459
use rustc_macros::HashStable;
60+
use rustc_session::config::CrateType;
61+
use rustc_session::config::{BorrowckMode, OutputFilenames};
6562
use rustc_session::lint::{Level, Lint};
66-
use rustc_session::node_id::NodeMap;
63+
use rustc_session::Session;
6764
use rustc_span::source_map::MultiSpan;
6865
use rustc_span::symbol::{kw, sym, Symbol};
6966
use rustc_span::Span;
7067
use rustc_target::spec::abi;
68+
use syntax::ast;
69+
use syntax::expand::allocator::AllocatorKind;
70+
use syntax::node_id::NodeMap;
71+
7172
use smallvec::SmallVec;
7273
use std::any::Any;
7374
use std::borrow::Borrow;
@@ -79,8 +80,6 @@ use std::iter;
7980
use std::mem;
8081
use std::ops::{Bound, Deref};
8182
use std::sync::Arc;
82-
use syntax::ast;
83-
use syntax::expand::allocator::AllocatorKind;
8483

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

src/librustc/ty/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,13 @@ use rustc_hir::{GlobMap, Node, TraitMap};
3939
use rustc_index::vec::{Idx, IndexVec};
4040
use rustc_macros::HashStable;
4141
use rustc_serialize::{self, Encodable, Encoder};
42-
use rustc_session::node_id::{NodeMap, NodeSet};
4342
use rustc_span::hygiene::ExpnId;
4443
use rustc_span::symbol::{kw, sym, Symbol};
4544
use rustc_span::Span;
4645
use rustc_target::abi::Align;
46+
use syntax::ast::{self, Ident, Name, NodeId};
47+
use syntax::node_id::{NodeMap, NodeSet};
48+
4749
use smallvec;
4850
use std::cell::RefCell;
4951
use std::cmp::{self, Ordering};
@@ -53,7 +55,6 @@ use std::ops::Deref;
5355
use std::ops::Range;
5456
use std::slice;
5557
use std::{mem, ptr};
56-
use syntax::ast::{self, Ident, Name, NodeId};
5758

5859
pub use self::sty::BoundRegion::*;
5960
pub use self::sty::InferTy::*;

src/librustc_ast_lowering/item.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ use rustc_errors::struct_span_err;
88
use rustc_hir as hir;
99
use rustc_hir::def::{DefKind, Res};
1010
use rustc_hir::def_id::DefId;
11-
use rustc_session::node_id::NodeMap;
1211
use rustc_span::source_map::{respan, DesugaringKind};
1312
use rustc_span::symbol::{kw, sym};
1413
use rustc_span::Span;
1514
use rustc_target::spec::abi;
1615
use syntax::ast::*;
1716
use syntax::attr;
17+
use syntax::node_id::NodeMap;
1818
use syntax::visit::{self, Visitor};
1919

2020
use log::debug;

src/librustc_ast_lowering/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ use rustc_hir::intravisit;
5050
use rustc_hir::{ConstArg, GenericArg, ParamName};
5151
use rustc_index::vec::IndexVec;
5252
use rustc_session::config::nightly_options;
53-
use rustc_session::lint::{builtin, BuiltinLintDiagnostics, LintBuffer};
54-
use rustc_session::node_id::NodeMap;
53+
use rustc_session::lint::{builtin::BARE_TRAIT_OBJECTS, BuiltinLintDiagnostics, LintBuffer};
54+
use rustc_session::parse::ParseSess;
5555
use rustc_session::Session;
5656
use rustc_span::hygiene::ExpnId;
5757
use rustc_span::source_map::{respan, DesugaringKind, ExpnData, ExpnKind};
@@ -60,8 +60,8 @@ use rustc_span::Span;
6060
use syntax::ast;
6161
use syntax::ast::*;
6262
use syntax::attr;
63+
use syntax::node_id::NodeMap;
6364
use syntax::print::pprust;
64-
use syntax::sess::ParseSess;
6565
use syntax::token::{self, Nonterminal, Token};
6666
use syntax::tokenstream::{TokenStream, TokenTree};
6767
use syntax::visit::{self, Visitor};
@@ -2614,7 +2614,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
26142614
.unwrap_or(true);
26152615
if !is_macro_callsite {
26162616
self.resolver.lint_buffer().buffer_lint_with_diagnostic(
2617-
builtin::BARE_TRAIT_OBJECTS,
2617+
BARE_TRAIT_OBJECTS,
26182618
id,
26192619
span,
26202620
"trait objects without an explicit `dyn` are deprecated",

src/librustc_ast_passes/feature_gate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ use rustc_error_codes::*;
22
use rustc_errors::{struct_span_err, Handler};
33
use rustc_feature::{AttributeGate, BUILTIN_ATTRIBUTE_MAP};
44
use rustc_feature::{Features, GateIssue, UnstableFeatures};
5+
use rustc_session::parse::{feature_err, feature_err_issue, ParseSess};
56
use rustc_span::source_map::Spanned;
67
use rustc_span::symbol::sym;
78
use rustc_span::Span;
89
use syntax::ast::{self, AssocTyConstraint, AssocTyConstraintKind, NodeId};
910
use syntax::ast::{GenericParam, GenericParamKind, PatKind, RangeEnd, VariantData};
1011
use syntax::attr;
11-
use syntax::sess::{feature_err, feature_err_issue, ParseSess};
1212
use syntax::visit::{self, FnKind, Visitor};
1313

1414
use log::debug;

src/librustc_builtin_macros/cmdline_attrs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
//! Attributes injected into the crate root from command line using `-Z crate-attr`.
22
33
use rustc_expand::panictry;
4+
use rustc_session::parse::ParseSess;
45
use rustc_span::FileName;
56
use syntax::ast::{self, AttrItem, AttrStyle};
67
use syntax::attr::mk_attr;
7-
use syntax::sess::ParseSess;
88
use syntax::token;
99

1010
pub fn inject(mut krate: ast::Crate, parse_sess: &ParseSess, attrs: &[String]) -> ast::Crate {

src/librustc_builtin_macros/deriving/generic/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,13 +183,13 @@ use std::vec;
183183

184184
use rustc_attr as attr;
185185
use rustc_expand::base::{Annotatable, ExtCtxt};
186+
use rustc_session::parse::ParseSess;
186187
use rustc_span::source_map::respan;
187188
use rustc_span::symbol::{kw, sym, Symbol};
188189
use rustc_span::Span;
189190
use syntax::ast::{self, BinOpKind, EnumDef, Expr, Generics, Ident, PatKind};
190191
use syntax::ast::{GenericArg, GenericParamKind, VariantData};
191192
use syntax::ptr::P;
192-
use syntax::sess::ParseSess;
193193
use syntax::util::map_in_place::MapInPlace;
194194

195195
use ty::{LifetimeBounds, Path, Ptr, PtrTy, Self_, Ty};

0 commit comments

Comments
 (0)