1. move node_id to syntax
2. invert rustc_session & syntax deps 3. drop rustc_session dep in rustc_hir
This commit is contained in:
parent
93a8283614
commit
097d5e1c5e
42 changed files with 84 additions and 90 deletions
|
@ -3606,7 +3606,6 @@ dependencies = [
|
|||
"rustc_errors",
|
||||
"rustc_index",
|
||||
"rustc_macros",
|
||||
"rustc_session",
|
||||
"rustc_span",
|
||||
"rustc_target",
|
||||
"serialize",
|
||||
|
@ -3917,6 +3916,7 @@ dependencies = [
|
|||
"rustc_span",
|
||||
"rustc_target",
|
||||
"serialize",
|
||||
"syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -4513,11 +4513,9 @@ dependencies = [
|
|||
"log",
|
||||
"rustc_data_structures",
|
||||
"rustc_errors",
|
||||
"rustc_feature",
|
||||
"rustc_index",
|
||||
"rustc_lexer",
|
||||
"rustc_macros",
|
||||
"rustc_session",
|
||||
"rustc_span",
|
||||
"scoped-tls",
|
||||
"serialize",
|
||||
|
|
|
@ -10,12 +10,12 @@ use rustc_data_structures::stable_hasher::StableHasher;
|
|||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::{CrateNum, DefId, DefIndex, CRATE_DEF_INDEX, LOCAL_CRATE};
|
||||
use rustc_index::vec::IndexVec;
|
||||
use rustc_session::node_id::NodeMap;
|
||||
use rustc_session::CrateDisambiguator;
|
||||
use rustc_span::hygiene::ExpnId;
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
use rustc_span::Span;
|
||||
use syntax::ast;
|
||||
use syntax::node_id::NodeMap;
|
||||
|
||||
use std::borrow::Borrow;
|
||||
use std::fmt::Write;
|
||||
|
|
|
@ -13,11 +13,12 @@ use rustc_hir as hir;
|
|||
use rustc_hir::def::DefKind;
|
||||
use rustc_hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX};
|
||||
use rustc_hir::{self, HirId};
|
||||
use rustc_session::lint::{self, BuiltinLintDiagnostics, Lint, LintBuffer};
|
||||
use rustc_session::lint::builtin::{DEPRECATED, DEPRECATED_IN_FUTURE, SOFT_UNSTABLE};
|
||||
use rustc_session::lint::{BuiltinLintDiagnostics, Lint, LintBuffer};
|
||||
use rustc_session::parse::feature_err_issue;
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
use rustc_span::{MultiSpan, Span};
|
||||
use syntax::ast::CRATE_NODE_ID;
|
||||
use syntax::sess::feature_err_issue;
|
||||
|
||||
use std::num::NonZeroU32;
|
||||
|
||||
|
@ -97,7 +98,7 @@ pub fn report_unstable(
|
|||
issue: Option<NonZeroU32>,
|
||||
is_soft: bool,
|
||||
span: Span,
|
||||
soft_handler: impl FnOnce(&'static lint::Lint, Span, &str),
|
||||
soft_handler: impl FnOnce(&'static Lint, Span, &str),
|
||||
) {
|
||||
let msg = match reason {
|
||||
Some(r) => format!("use of unstable library feature '{}': {}", feature, r),
|
||||
|
@ -119,7 +120,7 @@ pub fn report_unstable(
|
|||
let fresh = sess.one_time_diagnostics.borrow_mut().insert(error_id);
|
||||
if fresh {
|
||||
if is_soft {
|
||||
soft_handler(lint::builtin::SOFT_UNSTABLE, span, &msg)
|
||||
soft_handler(SOFT_UNSTABLE, span, &msg)
|
||||
} else {
|
||||
feature_err_issue(&sess.parse_sess, feature, span, GateIssue::Library(issue), &msg)
|
||||
.emit();
|
||||
|
@ -175,19 +176,19 @@ fn deprecation_message_common(message: String, reason: Option<Symbol>) -> String
|
|||
|
||||
pub fn deprecation_message(depr: &Deprecation, path: &str) -> (String, &'static Lint) {
|
||||
let message = format!("use of deprecated item '{}'", path);
|
||||
(deprecation_message_common(message, depr.note), lint::builtin::DEPRECATED)
|
||||
(deprecation_message_common(message, depr.note), DEPRECATED)
|
||||
}
|
||||
|
||||
pub fn rustc_deprecation_message(depr: &RustcDeprecation, path: &str) -> (String, &'static Lint) {
|
||||
let (message, lint) = if deprecation_in_effect(&depr.since.as_str()) {
|
||||
(format!("use of deprecated item '{}'", path), lint::builtin::DEPRECATED)
|
||||
(format!("use of deprecated item '{}'", path), DEPRECATED)
|
||||
} else {
|
||||
(
|
||||
format!(
|
||||
"use of item '{}' that will be deprecated in future version {}",
|
||||
path, depr.since
|
||||
),
|
||||
lint::builtin::DEPRECATED_IN_FUTURE,
|
||||
DEPRECATED_IN_FUTURE,
|
||||
)
|
||||
};
|
||||
(deprecation_message_common(message, Some(depr.reason)), lint)
|
||||
|
|
|
@ -41,16 +41,6 @@ use crate::ty::{ExistentialPredicate, InferTy, ParamTy, PolyFnSig, Predicate, Pr
|
|||
use crate::ty::{InferConst, ParamConst};
|
||||
use crate::ty::{List, TyKind, TyS};
|
||||
use crate::util::common::ErrorReported;
|
||||
use rustc_data_structures::sync;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{DefKind, Res};
|
||||
use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, DefIdSet, DefIndex, LOCAL_CRATE};
|
||||
use rustc_hir::{HirId, Node, TraitCandidate};
|
||||
use rustc_hir::{ItemKind, ItemLocalId, ItemLocalMap, ItemLocalSet};
|
||||
use rustc_session::config::CrateType;
|
||||
use rustc_session::config::{BorrowckMode, OutputFilenames};
|
||||
use rustc_session::Session;
|
||||
|
||||
use rustc_attr as attr;
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_data_structures::profiling::SelfProfilerRef;
|
||||
|
@ -58,16 +48,27 @@ use rustc_data_structures::sharded::{IntoPointer, ShardedHashMap};
|
|||
use rustc_data_structures::stable_hasher::{
|
||||
hash_stable_hashmap, HashStable, StableHasher, StableVec,
|
||||
};
|
||||
use rustc_data_structures::sync::{Lock, Lrc, WorkerLocal};
|
||||
use rustc_data_structures::sync::{self, Lock, Lrc, WorkerLocal};
|
||||
use rustc_errors::DiagnosticBuilder;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{DefKind, Res};
|
||||
use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, DefIdSet, DefIndex, LOCAL_CRATE};
|
||||
use rustc_hir::{HirId, Node, TraitCandidate};
|
||||
use rustc_hir::{ItemKind, ItemLocalId, ItemLocalMap, ItemLocalSet};
|
||||
use rustc_index::vec::{Idx, IndexVec};
|
||||
use rustc_macros::HashStable;
|
||||
use rustc_session::config::CrateType;
|
||||
use rustc_session::config::{BorrowckMode, OutputFilenames};
|
||||
use rustc_session::lint::{Level, Lint};
|
||||
use rustc_session::node_id::NodeMap;
|
||||
use rustc_session::Session;
|
||||
use rustc_span::source_map::MultiSpan;
|
||||
use rustc_span::symbol::{kw, sym, Symbol};
|
||||
use rustc_span::Span;
|
||||
use rustc_target::spec::abi;
|
||||
use syntax::ast;
|
||||
use syntax::expand::allocator::AllocatorKind;
|
||||
use syntax::node_id::NodeMap;
|
||||
|
||||
use smallvec::SmallVec;
|
||||
use std::any::Any;
|
||||
use std::borrow::Borrow;
|
||||
|
@ -79,8 +80,6 @@ use std::iter;
|
|||
use std::mem;
|
||||
use std::ops::{Bound, Deref};
|
||||
use std::sync::Arc;
|
||||
use syntax::ast;
|
||||
use syntax::expand::allocator::AllocatorKind;
|
||||
|
||||
type InternedSet<'tcx, T> = ShardedHashMap<Interned<'tcx, T>, ()>;
|
||||
|
||||
|
|
|
@ -39,11 +39,13 @@ use rustc_hir::{GlobMap, Node, TraitMap};
|
|||
use rustc_index::vec::{Idx, IndexVec};
|
||||
use rustc_macros::HashStable;
|
||||
use rustc_serialize::{self, Encodable, Encoder};
|
||||
use rustc_session::node_id::{NodeMap, NodeSet};
|
||||
use rustc_span::hygiene::ExpnId;
|
||||
use rustc_span::symbol::{kw, sym, Symbol};
|
||||
use rustc_span::Span;
|
||||
use rustc_target::abi::Align;
|
||||
use syntax::ast::{self, Constness, Ident, Name};
|
||||
use syntax::node_id::{NodeId, NodeMap, NodeSet};
|
||||
|
||||
use smallvec;
|
||||
use std::cell::RefCell;
|
||||
use std::cmp::{self, Ordering};
|
||||
|
@ -53,7 +55,6 @@ use std::ops::Deref;
|
|||
use std::ops::Range;
|
||||
use std::slice;
|
||||
use std::{mem, ptr};
|
||||
use syntax::ast::{self, Constness, Ident, Name, NodeId};
|
||||
|
||||
pub use self::sty::BoundRegion::*;
|
||||
pub use self::sty::InferTy::*;
|
||||
|
|
|
@ -7,13 +7,13 @@ use rustc_errors::struct_span_err;
|
|||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{DefKind, Res};
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_session::node_id::NodeMap;
|
||||
use rustc_span::source_map::{respan, DesugaringKind};
|
||||
use rustc_span::symbol::{kw, sym};
|
||||
use rustc_span::Span;
|
||||
use rustc_target::spec::abi;
|
||||
use syntax::ast::*;
|
||||
use syntax::attr;
|
||||
use syntax::node_id::NodeMap;
|
||||
use syntax::visit::{self, Visitor};
|
||||
|
||||
use log::debug;
|
||||
|
|
|
@ -49,8 +49,8 @@ use rustc_hir::intravisit;
|
|||
use rustc_hir::{ConstArg, GenericArg, ParamName};
|
||||
use rustc_index::vec::IndexVec;
|
||||
use rustc_session::config::nightly_options;
|
||||
use rustc_session::lint::{builtin, BuiltinLintDiagnostics, LintBuffer};
|
||||
use rustc_session::node_id::NodeMap;
|
||||
use rustc_session::lint::{builtin::BARE_TRAIT_OBJECTS, BuiltinLintDiagnostics, LintBuffer};
|
||||
use rustc_session::parse::ParseSess;
|
||||
use rustc_session::Session;
|
||||
use rustc_span::hygiene::ExpnId;
|
||||
use rustc_span::source_map::{respan, DesugaringKind, ExpnData, ExpnKind};
|
||||
|
@ -59,8 +59,8 @@ use rustc_span::Span;
|
|||
use syntax::ast;
|
||||
use syntax::ast::*;
|
||||
use syntax::attr;
|
||||
use syntax::node_id::NodeMap;
|
||||
use syntax::print::pprust;
|
||||
use syntax::sess::ParseSess;
|
||||
use syntax::token::{self, Nonterminal, Token};
|
||||
use syntax::tokenstream::{TokenStream, TokenTree};
|
||||
use syntax::visit::{self, Visitor};
|
||||
|
@ -2621,7 +2621,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
|||
.unwrap_or(true);
|
||||
if !is_macro_callsite {
|
||||
self.resolver.lint_buffer().buffer_lint_with_diagnostic(
|
||||
builtin::BARE_TRAIT_OBJECTS,
|
||||
BARE_TRAIT_OBJECTS,
|
||||
id,
|
||||
span,
|
||||
"trait objects without an explicit `dyn` are deprecated",
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
use rustc_errors::{struct_span_err, Handler};
|
||||
use rustc_feature::{AttributeGate, BUILTIN_ATTRIBUTE_MAP};
|
||||
use rustc_feature::{Features, GateIssue, UnstableFeatures};
|
||||
use rustc_session::parse::{feature_err, feature_err_issue, ParseSess};
|
||||
use rustc_span::source_map::Spanned;
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::Span;
|
||||
use syntax::ast::{self, AssocTyConstraint, AssocTyConstraintKind, NodeId};
|
||||
use syntax::ast::{GenericParam, GenericParamKind, PatKind, RangeEnd, VariantData};
|
||||
use syntax::attr;
|
||||
use syntax::sess::{feature_err, feature_err_issue, ParseSess};
|
||||
use syntax::visit::{self, FnKind, Visitor};
|
||||
|
||||
use log::debug;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
//! Attributes injected into the crate root from command line using `-Z crate-attr`.
|
||||
|
||||
use rustc_expand::panictry;
|
||||
use rustc_session::parse::ParseSess;
|
||||
use rustc_span::FileName;
|
||||
use syntax::ast::{self, AttrItem, AttrStyle};
|
||||
use syntax::attr::mk_attr;
|
||||
use syntax::sess::ParseSess;
|
||||
use syntax::token;
|
||||
|
||||
pub fn inject(mut krate: ast::Crate, parse_sess: &ParseSess, attrs: &[String]) -> ast::Crate {
|
||||
|
|
|
@ -183,13 +183,13 @@ use std::vec;
|
|||
|
||||
use rustc_attr as attr;
|
||||
use rustc_expand::base::{Annotatable, ExtCtxt};
|
||||
use rustc_session::parse::ParseSess;
|
||||
use rustc_span::source_map::respan;
|
||||
use rustc_span::symbol::{kw, sym, Symbol};
|
||||
use rustc_span::Span;
|
||||
use syntax::ast::{self, BinOpKind, EnumDef, Expr, Generics, Ident, PatKind};
|
||||
use syntax::ast::{GenericArg, GenericParamKind, VariantData};
|
||||
use syntax::ptr::P;
|
||||
use syntax::sess::ParseSess;
|
||||
use syntax::util::map_in_place::MapInPlace;
|
||||
|
||||
use ty::{LifetimeBounds, Path, Ptr, PtrTy, Self_, Ty};
|
||||
|
|
|
@ -2,6 +2,7 @@ use std::mem;
|
|||
|
||||
use rustc_expand::base::{ExtCtxt, Resolver};
|
||||
use rustc_expand::expand::{AstFragment, ExpansionConfig};
|
||||
use rustc_session::parse::ParseSess;
|
||||
use rustc_span::hygiene::AstPass;
|
||||
use rustc_span::symbol::{kw, sym};
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
|
@ -11,7 +12,6 @@ use syntax::attr;
|
|||
use syntax::expand::is_proc_macro_attr;
|
||||
use syntax::print::pprust;
|
||||
use syntax::ptr::P;
|
||||
use syntax::sess::ParseSess;
|
||||
use syntax::visit::{self, Visitor};
|
||||
|
||||
struct ProcMacroDerive {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
use rustc_expand::base::{ExtCtxt, Resolver};
|
||||
use rustc_expand::expand::ExpansionConfig;
|
||||
use rustc_session::parse::ParseSess;
|
||||
use rustc_span::edition::Edition;
|
||||
use rustc_span::hygiene::AstPass;
|
||||
use rustc_span::symbol::{kw, sym, Ident, Symbol};
|
||||
use rustc_span::DUMMY_SP;
|
||||
use syntax::ptr::P;
|
||||
use syntax::sess::ParseSess;
|
||||
use syntax::{ast, attr};
|
||||
|
||||
pub fn inject(
|
||||
|
|
|
@ -4,6 +4,7 @@ use log::debug;
|
|||
use rustc_expand::base::{ExtCtxt, Resolver};
|
||||
use rustc_expand::expand::{AstFragment, ExpansionConfig};
|
||||
use rustc_feature::Features;
|
||||
use rustc_session::parse::ParseSess;
|
||||
use rustc_span::hygiene::{AstPass, SyntaxContext, Transparency};
|
||||
use rustc_span::source_map::respan;
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
|
@ -15,7 +16,6 @@ use syntax::attr;
|
|||
use syntax::entry::{self, EntryPointType};
|
||||
use syntax::mut_visit::{ExpectOne, *};
|
||||
use syntax::ptr::P;
|
||||
use syntax::sess::ParseSess;
|
||||
|
||||
use std::{iter, mem};
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ use rustc_data_structures::fx::FxHashMap;
|
|||
use rustc_data_structures::sync::{self, Lrc};
|
||||
use rustc_errors::{DiagnosticBuilder, DiagnosticId};
|
||||
use rustc_parse::{self, parser, DirectoryOwnership, MACRO_ARGUMENTS};
|
||||
use rustc_session::parse::ParseSess;
|
||||
use rustc_span::edition::Edition;
|
||||
use rustc_span::hygiene::{AstPass, ExpnData, ExpnId, ExpnKind};
|
||||
use rustc_span::source_map::SourceMap;
|
||||
|
@ -14,7 +15,6 @@ use smallvec::{smallvec, SmallVec};
|
|||
use syntax::ast::{self, Attribute, Name, NodeId, PatKind};
|
||||
use syntax::mut_visit::{self, MutVisitor};
|
||||
use syntax::ptr::P;
|
||||
use syntax::sess::ParseSess;
|
||||
use syntax::token;
|
||||
use syntax::tokenstream::{self, TokenStream};
|
||||
use syntax::visit::Visitor;
|
||||
|
|
|
@ -13,6 +13,7 @@ use rustc_parse::configure;
|
|||
use rustc_parse::parser::Parser;
|
||||
use rustc_parse::validate_attr;
|
||||
use rustc_parse::DirectoryOwnership;
|
||||
use rustc_session::parse::{feature_err, ParseSess};
|
||||
use rustc_span::source_map::respan;
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
use rustc_span::{FileName, Span, DUMMY_SP};
|
||||
|
@ -21,7 +22,6 @@ use syntax::ast::{ItemKind, MacArgs, MacStmtStyle, StmtKind};
|
|||
use syntax::mut_visit::*;
|
||||
use syntax::print::pprust;
|
||||
use syntax::ptr::P;
|
||||
use syntax::sess::{feature_err, ParseSess};
|
||||
use syntax::token;
|
||||
use syntax::tokenstream::{TokenStream, TokenTree};
|
||||
use syntax::util::map_in_place::MapInPlace;
|
||||
|
|
|
@ -78,11 +78,11 @@ use crate::mbe::{self, TokenTree};
|
|||
|
||||
use rustc_parse::parser::{FollowedByType, Parser, PathStyle};
|
||||
use rustc_parse::Directory;
|
||||
use rustc_session::parse::ParseSess;
|
||||
use rustc_span::symbol::{kw, sym, Symbol};
|
||||
use syntax::ast::{Ident, Name};
|
||||
use syntax::print::pprust;
|
||||
use syntax::ptr::P;
|
||||
use syntax::sess::ParseSess;
|
||||
use syntax::token::{self, DocComment, Nonterminal, Token};
|
||||
use syntax::tokenstream::TokenStream;
|
||||
|
||||
|
|
|
@ -15,13 +15,13 @@ use rustc_errors::{Applicability, DiagnosticBuilder, FatalError};
|
|||
use rustc_feature::Features;
|
||||
use rustc_parse::parser::Parser;
|
||||
use rustc_parse::Directory;
|
||||
use rustc_session::parse::ParseSess;
|
||||
use rustc_span::edition::Edition;
|
||||
use rustc_span::hygiene::Transparency;
|
||||
use rustc_span::symbol::{kw, sym, Symbol};
|
||||
use rustc_span::Span;
|
||||
use syntax::ast;
|
||||
use syntax::print::pprust;
|
||||
use syntax::sess::ParseSess;
|
||||
use syntax::token::{self, NtTT, Token, TokenKind::*};
|
||||
use syntax::tokenstream::{DelimSpan, TokenStream};
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
use crate::mbe::macro_parser;
|
||||
use crate::mbe::{Delimited, KleeneOp, KleeneToken, SequenceRepetition, TokenTree};
|
||||
|
||||
use rustc_session::parse::ParseSess;
|
||||
use rustc_span::symbol::kw;
|
||||
use syntax::ast;
|
||||
use syntax::print::pprust;
|
||||
use syntax::sess::ParseSess;
|
||||
use syntax::token::{self, Token};
|
||||
use syntax::tokenstream;
|
||||
|
||||
|
|
|
@ -4,11 +4,11 @@ use rustc_data_structures::sync::Lrc;
|
|||
use rustc_errors::Diagnostic;
|
||||
use rustc_parse::lexer::nfc_normalize;
|
||||
use rustc_parse::{nt_to_tokenstream, parse_stream_from_source_str};
|
||||
use rustc_session::parse::ParseSess;
|
||||
use rustc_span::symbol::{kw, sym, Symbol};
|
||||
use rustc_span::{BytePos, FileName, MultiSpan, Pos, SourceFile, Span};
|
||||
use syntax::ast;
|
||||
use syntax::print::pprust;
|
||||
use syntax::sess::ParseSess;
|
||||
use syntax::token;
|
||||
use syntax::tokenstream::{self, DelimSpan, IsJoint::*, TokenStream, TreeAndJoint};
|
||||
use syntax::util::comments;
|
||||
|
|
|
@ -17,6 +17,5 @@ rustc_index = { path = "../librustc_index" }
|
|||
rustc_span = { path = "../librustc_span" }
|
||||
rustc_errors = { path = "../librustc_errors" }
|
||||
rustc_serialize = { path = "../libserialize", package = "serialize" }
|
||||
rustc_session = { path = "../librustc_session" }
|
||||
syntax = { path = "../libsyntax" }
|
||||
smallvec = { version = "1.0", features = ["union", "may_dangle"] }
|
||||
|
|
|
@ -12,21 +12,22 @@ use rustc_data_structures::fx::FxHashSet;
|
|||
use rustc_data_structures::sync::{par_for_each_in, Send, Sync};
|
||||
use rustc_errors::FatalError;
|
||||
use rustc_macros::HashStable_Generic;
|
||||
use rustc_session::node_id::NodeMap;
|
||||
use rustc_span::source_map::{SourceMap, Spanned};
|
||||
use rustc_span::symbol::{kw, sym, Symbol};
|
||||
use rustc_span::{MultiSpan, Span, DUMMY_SP};
|
||||
use rustc_target::spec::abi::Abi;
|
||||
use smallvec::SmallVec;
|
||||
use std::collections::{BTreeMap, BTreeSet};
|
||||
use std::fmt;
|
||||
use syntax::ast::{self, AsmDialect, CrateSugar, Ident, Name, NodeId};
|
||||
use syntax::ast::{AttrVec, Attribute, FloatTy, IntTy, Label, LitKind, StrStyle, UintTy};
|
||||
pub use syntax::ast::{BorrowKind, ImplPolarity, IsAuto};
|
||||
pub use syntax::ast::{CaptureBy, Constness, Movability, Mutability, Unsafety};
|
||||
use syntax::node_id::NodeMap;
|
||||
use syntax::tokenstream::TokenStream;
|
||||
use syntax::util::parser::ExprPrecedence;
|
||||
|
||||
use smallvec::SmallVec;
|
||||
use std::collections::{BTreeMap, BTreeSet};
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Copy, Clone, RustcEncodable, RustcDecodable, HashStable_Generic)]
|
||||
pub struct Lifetime {
|
||||
pub hir_id: HirId,
|
||||
|
|
|
@ -14,13 +14,13 @@ use rustc_data_structures::OnDrop;
|
|||
use rustc_errors::registry::Registry;
|
||||
use rustc_lint::LintStore;
|
||||
use rustc_parse::new_parser_from_source_str;
|
||||
use rustc_session::parse::{CrateConfig, ParseSess};
|
||||
use rustc_span::edition;
|
||||
use rustc_span::source_map::{FileLoader, FileName, SourceMap};
|
||||
use std::path::PathBuf;
|
||||
use std::result;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use syntax::ast::{self, MetaItemKind};
|
||||
use syntax::sess::ParseSess;
|
||||
use syntax::ast::MetaItemKind;
|
||||
use syntax::token;
|
||||
|
||||
pub type Result<T> = result::Result<T, ErrorReported>;
|
||||
|
@ -106,7 +106,7 @@ pub fn parse_cfgspecs(cfgspecs: Vec<String>) -> FxHashSet<(String, Option<String
|
|||
|
||||
error!(r#"expected `key` or `key="value"`"#);
|
||||
})
|
||||
.collect::<ast::CrateConfig>();
|
||||
.collect::<CrateConfig>();
|
||||
cfg.into_iter().map(|(a, b)| (a.to_string(), b.map(|b| b.to_string()))).collect()
|
||||
})
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ use rustc_resolve::{self, Resolver};
|
|||
use rustc_session as session;
|
||||
use rustc_session::config::{ErrorOutputType, Input, OutputFilenames};
|
||||
use rustc_session::lint::{BuiltinLintDiagnostics, LintBuffer};
|
||||
use rustc_session::parse::CrateConfig;
|
||||
use rustc_session::CrateDisambiguator;
|
||||
use rustc_session::{config, early_error, filesearch, DiagnosticOutput, Session};
|
||||
use rustc_span::edition::Edition;
|
||||
|
@ -40,7 +41,7 @@ use syntax::{self, ast};
|
|||
/// This is performed by checking whether a whitelisted set of
|
||||
/// features is available on the target machine, by querying LLVM.
|
||||
pub fn add_configuration(
|
||||
cfg: &mut ast::CrateConfig,
|
||||
cfg: &mut CrateConfig,
|
||||
sess: &Session,
|
||||
codegen_backend: &dyn CodegenBackend,
|
||||
) {
|
||||
|
|
|
@ -9,15 +9,15 @@ use rustc_data_structures::fx::FxHashMap;
|
|||
use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::{CrateNum, LOCAL_CRATE};
|
||||
use rustc_hir::hir_id::HirId;
|
||||
use rustc_hir::intravisit;
|
||||
use rustc_hir::{intravisit, HirId};
|
||||
use rustc_session::lint::{builtin, Level, Lint};
|
||||
use rustc_session::parse::feature_err;
|
||||
use rustc_session::Session;
|
||||
use rustc_span::{sym, MultiSpan, Symbol};
|
||||
use rustc_span::source_map::MultiSpan;
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
use syntax::ast;
|
||||
use syntax::attr;
|
||||
use syntax::print::pprust;
|
||||
use syntax::sess::feature_err;
|
||||
use syntax::unwrap_or;
|
||||
|
||||
use std::cmp;
|
||||
|
|
|
@ -16,6 +16,7 @@ use rustc_feature::{Feature, Features, State as FeatureState};
|
|||
use rustc_feature::{
|
||||
ACCEPTED_FEATURES, ACTIVE_FEATURES, REMOVED_FEATURES, STABLE_REMOVED_FEATURES,
|
||||
};
|
||||
use rustc_session::parse::{feature_err, ParseSess};
|
||||
use rustc_span::edition::{Edition, ALL_EDITIONS};
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
|
@ -23,7 +24,6 @@ use syntax::ast::{self, AttrItem, Attribute, MetaItem};
|
|||
use syntax::attr::HasAttrs;
|
||||
use syntax::mut_visit::*;
|
||||
use syntax::ptr::P;
|
||||
use syntax::sess::{feature_err, ParseSess};
|
||||
use syntax::util::map_in_place::MapInPlace;
|
||||
|
||||
use smallvec::SmallVec;
|
||||
|
|
|
@ -2,9 +2,9 @@ use rustc_data_structures::sync::Lrc;
|
|||
use rustc_errors::{DiagnosticBuilder, FatalError};
|
||||
use rustc_lexer::unescape;
|
||||
use rustc_lexer::Base;
|
||||
use rustc_session::parse::ParseSess;
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
use rustc_span::{BytePos, Pos, Span};
|
||||
use syntax::sess::ParseSess;
|
||||
use syntax::token::{self, Token, TokenKind};
|
||||
use syntax::util::comments;
|
||||
|
||||
|
|
|
@ -4,15 +4,14 @@
|
|||
#![feature(crate_visibility_modifier)]
|
||||
#![cfg_attr(bootstrap, feature(slice_patterns))]
|
||||
|
||||
use syntax::ast;
|
||||
use syntax::print::pprust;
|
||||
use syntax::sess::ParseSess;
|
||||
use syntax::token::{self, Nonterminal};
|
||||
use syntax::tokenstream::{self, TokenStream, TokenTree};
|
||||
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_errors::{Diagnostic, FatalError, Level, PResult};
|
||||
use rustc_session::parse::ParseSess;
|
||||
use rustc_span::{FileName, SourceFile, Span};
|
||||
use syntax::ast;
|
||||
use syntax::print::pprust;
|
||||
use syntax::token::{self, Nonterminal};
|
||||
use syntax::tokenstream::{self, TokenStream, TokenTree};
|
||||
|
||||
use std::borrow::Cow;
|
||||
use std::path::Path;
|
||||
|
|
|
@ -17,6 +17,7 @@ use crate::{Directory, DirectoryOwnership};
|
|||
|
||||
use log::debug;
|
||||
use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder, FatalError, PResult};
|
||||
use rustc_session::parse::ParseSess;
|
||||
use rustc_span::source_map::respan;
|
||||
use rustc_span::symbol::{kw, sym, Symbol};
|
||||
use rustc_span::{BytePos, FileName, Span, DUMMY_SP};
|
||||
|
@ -24,7 +25,6 @@ use syntax::ast::{self, AttrStyle, AttrVec, CrateSugar, Extern, Ident, Unsafety,
|
|||
use syntax::ast::{IsAsync, MacArgs, MacDelimiter, Mutability, StrLit, Visibility, VisibilityKind};
|
||||
use syntax::print::pprust;
|
||||
use syntax::ptr::P;
|
||||
use syntax::sess::ParseSess;
|
||||
use syntax::token::{self, DelimToken, Token, TokenKind};
|
||||
use syntax::tokenstream::{self, DelimSpan, TokenStream, TokenTree, TreeAndJoint};
|
||||
use syntax::util::comments::{doc_comment_style, strip_doc_comment_decoration};
|
||||
|
|
|
@ -30,9 +30,9 @@ use rustc::{lint, ty};
|
|||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_errors::pluralize;
|
||||
use rustc_session::lint::BuiltinLintDiagnostics;
|
||||
use rustc_session::node_id::NodeMap;
|
||||
use rustc_span::{MultiSpan, Span, DUMMY_SP};
|
||||
use syntax::ast;
|
||||
use syntax::node_id::NodeMap;
|
||||
use syntax::visit::{self, Visitor};
|
||||
|
||||
struct UnusedImport<'a> {
|
||||
|
|
|
@ -37,7 +37,6 @@ use rustc_hir::PrimTy::{self, Bool, Char, Float, Int, Str, Uint};
|
|||
use rustc_hir::{GlobMap, TraitMap};
|
||||
use rustc_metadata::creader::{CStore, CrateLoader};
|
||||
use rustc_session::lint::{BuiltinLintDiagnostics, LintBuffer};
|
||||
use rustc_session::node_id::{NodeMap, NodeSet};
|
||||
use rustc_session::Session;
|
||||
use rustc_span::hygiene::{ExpnId, ExpnKind, MacroKind, SyntaxContext, Transparency};
|
||||
use rustc_span::source_map::Spanned;
|
||||
|
@ -47,6 +46,7 @@ use syntax::ast::{self, FloatTy, Ident, IntTy, Name, NodeId, UintTy};
|
|||
use syntax::ast::{Crate, CRATE_NODE_ID};
|
||||
use syntax::ast::{ItemKind, Path};
|
||||
use syntax::attr;
|
||||
use syntax::node_id::{NodeMap, NodeSet};
|
||||
use syntax::print::pprust;
|
||||
use syntax::unwrap_or;
|
||||
use syntax::visit::{self, Visitor};
|
||||
|
|
|
@ -19,3 +19,4 @@ rustc_span = { path = "../librustc_span" }
|
|||
rustc_index = { path = "../librustc_index" }
|
||||
rustc_fs_util = { path = "../librustc_fs_util" }
|
||||
num_cpus = "1.0"
|
||||
syntax = { path = "../libsyntax" }
|
||||
|
|
|
@ -10,7 +10,6 @@ pub mod cgu_reuse_tracker;
|
|||
pub mod utils;
|
||||
#[macro_use]
|
||||
pub mod lint;
|
||||
pub mod node_id;
|
||||
pub mod parse;
|
||||
|
||||
mod code_stats;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
pub use self::Level::*;
|
||||
use crate::node_id::{NodeId, NodeMap};
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher, ToStableHashKey};
|
||||
use rustc_span::edition::Edition;
|
||||
use rustc_span::{sym, symbol::Ident, MultiSpan, Span, Symbol};
|
||||
use syntax::node_id::{NodeId, NodeMap};
|
||||
|
||||
pub mod builtin;
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
//! It also serves as an input to the parser itself.
|
||||
|
||||
use crate::lint::{BufferedEarlyLint, BuiltinLintDiagnostics, Lint, LintId};
|
||||
use crate::node_id::NodeId;
|
||||
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_data_structures::sync::{Lock, Lrc, Once};
|
||||
use rustc_errors::{emitter::SilentEmitter, ColorConfig, Handler};
|
||||
|
@ -13,6 +11,7 @@ use rustc_span::edition::Edition;
|
|||
use rustc_span::hygiene::ExpnId;
|
||||
use rustc_span::source_map::{FilePathMapping, SourceMap};
|
||||
use rustc_span::{MultiSpan, Span, Symbol};
|
||||
use syntax::node_id::NodeId;
|
||||
|
||||
use std::path::PathBuf;
|
||||
use std::str;
|
||||
|
|
|
@ -8,9 +8,9 @@ use std::mem;
|
|||
use std::ops;
|
||||
|
||||
use rustc_feature::Features;
|
||||
use rustc_session::parse::ParseSess;
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
use syntax::ast::{LitKind, MetaItem, MetaItemKind, NestedMetaItem};
|
||||
use syntax::sess::ParseSess;
|
||||
|
||||
use rustc_span::Span;
|
||||
|
||||
|
|
|
@ -12,10 +12,10 @@ use std::io;
|
|||
use std::io::prelude::*;
|
||||
|
||||
use rustc_parse::lexer;
|
||||
use rustc_session::parse::ParseSess;
|
||||
use rustc_span::source_map::SourceMap;
|
||||
use rustc_span::symbol::{kw, sym};
|
||||
use rustc_span::{FileName, Span};
|
||||
use syntax::sess::ParseSess;
|
||||
use syntax::token::{self, Token};
|
||||
|
||||
/// Highlights `src`, returning the HTML output.
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
use rustc_data_structures::sync::{Lock, Lrc};
|
||||
use rustc_errors::{emitter::Emitter, Applicability, Diagnostic, Handler};
|
||||
use rustc_parse::lexer::StringReader as Lexer;
|
||||
use rustc_session::parse::ParseSess;
|
||||
use rustc_span::source_map::{FilePathMapping, SourceMap};
|
||||
use rustc_span::{FileName, InnerSpan};
|
||||
use syntax::sess::ParseSess;
|
||||
use syntax::token;
|
||||
|
||||
use crate::clean;
|
||||
|
|
|
@ -395,8 +395,8 @@ pub fn make_test(
|
|||
use rustc_errors::emitter::EmitterWriter;
|
||||
use rustc_errors::Handler;
|
||||
use rustc_parse::maybe_new_parser_from_source_str;
|
||||
use rustc_session::parse::ParseSess;
|
||||
use rustc_span::source_map::FilePathMapping;
|
||||
use syntax::sess::ParseSess;
|
||||
|
||||
let filename = FileName::anon_source_code(s);
|
||||
let source = crates + &everything_else;
|
||||
|
|
|
@ -16,9 +16,7 @@ scoped-tls = "1.0"
|
|||
rustc_errors = { path = "../librustc_errors" }
|
||||
rustc_span = { path = "../librustc_span" }
|
||||
rustc_data_structures = { path = "../librustc_data_structures" }
|
||||
rustc_feature = { path = "../librustc_feature" }
|
||||
rustc_index = { path = "../librustc_index" }
|
||||
rustc_lexer = { path = "../librustc_lexer" }
|
||||
rustc_macros = { path = "../librustc_macros" }
|
||||
smallvec = { version = "1.0", features = ["union", "may_dangle"] }
|
||||
rustc_session = { path = "../librustc_session" }
|
||||
|
|
|
@ -256,15 +256,7 @@ impl ParenthesizedArgs {
|
|||
}
|
||||
}
|
||||
|
||||
pub use rustc_session::node_id::NodeId;
|
||||
|
||||
/// `NodeId` used to represent the root of the crate.
|
||||
pub const CRATE_NODE_ID: NodeId = NodeId::from_u32_const(0);
|
||||
|
||||
/// When parsing and doing expansions, we initially give all AST nodes this AST
|
||||
/// node value. Then later, in the renumber pass, we renumber them to have
|
||||
/// small, positive ids.
|
||||
pub const DUMMY_NODE_ID: NodeId = NodeId::MAX;
|
||||
pub use crate::node_id::{NodeId, CRATE_NODE_ID, DUMMY_NODE_ID};
|
||||
|
||||
/// A modifier on a bound, e.g., `?Sized` or `?const Trait`.
|
||||
///
|
||||
|
@ -432,8 +424,6 @@ pub struct WhereEqPredicate {
|
|||
pub rhs_ty: P<Ty>,
|
||||
}
|
||||
|
||||
pub use rustc_session::parse::CrateConfig;
|
||||
|
||||
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||
pub struct Crate {
|
||||
pub module: Mod,
|
||||
|
|
|
@ -41,8 +41,8 @@ pub mod attr;
|
|||
pub mod entry;
|
||||
pub mod expand;
|
||||
pub mod mut_visit;
|
||||
pub mod node_id;
|
||||
pub mod ptr;
|
||||
pub use rustc_session::parse as sess;
|
||||
pub mod token;
|
||||
pub mod tokenstream;
|
||||
pub mod visit;
|
||||
|
|
|
@ -11,6 +11,14 @@ rustc_index::newtype_index! {
|
|||
|
||||
rustc_data_structures::define_id_collections!(NodeMap, NodeSet, NodeId);
|
||||
|
||||
/// `NodeId` used to represent the root of the crate.
|
||||
pub const CRATE_NODE_ID: NodeId = NodeId::from_u32_const(0);
|
||||
|
||||
/// When parsing and doing expansions, we initially give all AST nodes this AST
|
||||
/// node value. Then later, in the renumber pass, we renumber them to have
|
||||
/// small, positive ids.
|
||||
pub const DUMMY_NODE_ID: NodeId = NodeId::MAX;
|
||||
|
||||
impl NodeId {
|
||||
pub fn placeholder_from_expn_id(expn_id: ExpnId) -> Self {
|
||||
NodeId::from_u32(expn_id.as_u32())
|
Loading…
Add table
Add a link
Reference in a new issue