diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2020-04-19 13:00:18 +0200 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2020-05-08 13:13:15 +0200 |
| commit | d4e143ed2f248a808fb5f1cf959f630d419cc01b (patch) | |
| tree | 4418c7d53db14542c6eb4736aa2a308d2447bde9 /src/librustc_middle | |
| parent | a51e004e1bf7f9bba151dd9104a217c1ace6a0a2 (diff) | |
| download | rust-d4e143ed2f248a808fb5f1cf959f630d419cc01b.tar.gz rust-d4e143ed2f248a808fb5f1cf959f630d419cc01b.zip | |
Remove ast::{Ident, Name} reexports.
Diffstat (limited to 'src/librustc_middle')
| -rw-r--r-- | src/librustc_middle/arena.rs | 2 | ||||
| -rw-r--r-- | src/librustc_middle/hir/exports.rs | 4 | ||||
| -rw-r--r-- | src/librustc_middle/hir/map/blocks.rs | 3 | ||||
| -rw-r--r-- | src/librustc_middle/hir/map/mod.rs | 26 | ||||
| -rw-r--r-- | src/librustc_middle/mir/mod.rs | 3 | ||||
| -rw-r--r-- | src/librustc_middle/query/mod.rs | 4 | ||||
| -rw-r--r-- | src/librustc_middle/traits/mod.rs | 10 | ||||
| -rw-r--r-- | src/librustc_middle/traits/specialization_graph.rs | 2 | ||||
| -rw-r--r-- | src/librustc_middle/ty/context.rs | 10 | ||||
| -rw-r--r-- | src/librustc_middle/ty/layout.rs | 7 | ||||
| -rw-r--r-- | src/librustc_middle/ty/mod.rs | 6 | ||||
| -rw-r--r-- | src/librustc_middle/ty/print/pretty.rs | 4 | ||||
| -rw-r--r-- | src/librustc_middle/ty/query/on_disk_cache.rs | 2 | ||||
| -rw-r--r-- | src/librustc_middle/ty/sty.rs | 4 |
14 files changed, 43 insertions, 44 deletions
diff --git a/src/librustc_middle/arena.rs b/src/librustc_middle/arena.rs index 96ef4b37412..a97db3134dc 100644 --- a/src/librustc_middle/arena.rs +++ b/src/librustc_middle/arena.rs @@ -65,7 +65,7 @@ macro_rules! arena_types { [] object_safety_violations: rustc_middle::traits::ObjectSafetyViolation, [] codegen_unit: rustc_middle::mir::mono::CodegenUnit<$tcx>, [] attribute: rustc_ast::ast::Attribute, - [] name_set: rustc_data_structures::fx::FxHashSet<rustc_ast::ast::Name>, + [] name_set: rustc_data_structures::fx::FxHashSet<rustc_span::symbol::Symbol>, [] hir_id_set: rustc_hir::HirIdSet, // Interned types diff --git a/src/librustc_middle/hir/exports.rs b/src/librustc_middle/hir/exports.rs index 4c144a54d63..83baf6cc433 100644 --- a/src/librustc_middle/hir/exports.rs +++ b/src/librustc_middle/hir/exports.rs @@ -1,9 +1,9 @@ use crate::ty; -use rustc_ast::ast; use rustc_hir::def::Res; use rustc_hir::def_id::DefIdMap; use rustc_macros::HashStable; +use rustc_span::symbol::Ident; use rustc_span::Span; use std::fmt::Debug; @@ -15,7 +15,7 @@ pub type ExportMap<Id> = DefIdMap<Vec<Export<Id>>>; #[derive(Copy, Clone, Debug, RustcEncodable, RustcDecodable, HashStable)] pub struct Export<Id> { /// The name of the target. - pub ident: ast::Ident, + pub ident: Ident, /// The resolution of the target. pub res: Res<Id>, /// The span of the target. diff --git a/src/librustc_middle/hir/map/blocks.rs b/src/librustc_middle/hir/map/blocks.rs index 7024e86f95d..a2e4372f017 100644 --- a/src/librustc_middle/hir/map/blocks.rs +++ b/src/librustc_middle/hir/map/blocks.rs @@ -12,10 +12,11 @@ //! for the `Code` associated with a particular NodeId. use crate::hir::map::Map; -use rustc_ast::ast::{Attribute, Ident}; +use rustc_ast::ast::Attribute; use rustc_hir as hir; use rustc_hir::intravisit::FnKind; use rustc_hir::{Expr, FnDecl, Node}; +use rustc_span::symbol::Ident; use rustc_span::Span; /// An FnLikeNode is a Node that is like a fn, in that it has a decl diff --git a/src/librustc_middle/hir/map/mod.rs b/src/librustc_middle/hir/map/mod.rs index 1c71fc57bea..5ea2b8b8e49 100644 --- a/src/librustc_middle/hir/map/mod.rs +++ b/src/librustc_middle/hir/map/mod.rs @@ -3,7 +3,7 @@ use self::collector::NodeCollector; use crate::hir::{Owner, OwnerNodes}; use crate::ty::query::Providers; use crate::ty::TyCtxt; -use rustc_ast::ast::{self, Name, NodeId}; +use rustc_ast::ast::{self, NodeId}; use rustc_data_structures::svh::Svh; use rustc_hir::def::{DefKind, Res}; use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, CRATE_DEF_INDEX, LOCAL_CRATE}; @@ -14,7 +14,7 @@ use rustc_hir::*; use rustc_index::vec::IndexVec; use rustc_span::hygiene::MacroKind; use rustc_span::source_map::Spanned; -use rustc_span::symbol::kw; +use rustc_span::symbol::{kw, Symbol}; use rustc_span::Span; use rustc_target::spec::abi::Abi; @@ -432,7 +432,7 @@ impl<'hir> Map<'hir> { } } - pub fn ty_param_name(&self, id: HirId) -> Name { + pub fn ty_param_name(&self, id: HirId) -> Symbol { match self.get(id) { Node::Item(&Item { kind: ItemKind::Trait(..) | ItemKind::TraitAlias(..), .. }) => { kw::SelfUpper @@ -804,7 +804,7 @@ impl<'hir> Map<'hir> { } } - pub fn opt_name(&self, id: HirId) -> Option<Name> { + pub fn opt_name(&self, id: HirId) -> Option<Symbol> { Some(match self.get(id) { Node::Item(i) => i.ident.name, Node::ForeignItem(fi) => fi.ident.name, @@ -820,7 +820,7 @@ impl<'hir> Map<'hir> { }) } - pub fn name(&self, id: HirId) -> Name { + pub fn name(&self, id: HirId) -> Symbol { match self.opt_name(id) { Some(name) => name, None => bug!("no name for {}", self.node_to_string(id)), @@ -932,42 +932,42 @@ impl<'hir> intravisit::Map<'hir> for Map<'hir> { } trait Named { - fn name(&self) -> Name; + fn name(&self) -> Symbol; } impl<T: Named> Named for Spanned<T> { - fn name(&self) -> Name { + fn name(&self) -> Symbol { self.node.name() } } impl Named for Item<'_> { - fn name(&self) -> Name { + fn name(&self) -> Symbol { self.ident.name } } impl Named for ForeignItem<'_> { - fn name(&self) -> Name { + fn name(&self) -> Symbol { self.ident.name } } impl Named for Variant<'_> { - fn name(&self) -> Name { + fn name(&self) -> Symbol { self.ident.name } } impl Named for StructField<'_> { - fn name(&self) -> Name { + fn name(&self) -> Symbol { self.ident.name } } impl Named for TraitItem<'_> { - fn name(&self) -> Name { + fn name(&self) -> Symbol { self.ident.name } } impl Named for ImplItem<'_> { - fn name(&self) -> Name { + fn name(&self) -> Symbol { self.ident.name } } diff --git a/src/librustc_middle/mir/mod.rs b/src/librustc_middle/mir/mod.rs index 8d416536155..4faf8461b8a 100644 --- a/src/librustc_middle/mir/mod.rs +++ b/src/librustc_middle/mir/mod.rs @@ -19,7 +19,6 @@ use rustc_target::abi::VariantIdx; use polonius_engine::Atom; pub use rustc_ast::ast::Mutability; -use rustc_ast::ast::Name; use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::graph::dominators::{dominators, Dominators}; use rustc_data_structures::graph::{self, GraphSuccessors}; @@ -971,7 +970,7 @@ impl<'tcx> LocalDecl<'tcx> { /// Debug information pertaining to a user variable. #[derive(Clone, Debug, RustcEncodable, RustcDecodable, HashStable, TypeFoldable)] pub struct VarDebugInfo<'tcx> { - pub name: Name, + pub name: Symbol, /// Source info of the user variable, including the scope /// within which the variable is visible (to debuginfo) diff --git a/src/librustc_middle/query/mod.rs b/src/librustc_middle/query/mod.rs index b0c44238148..bd7e3b31b97 100644 --- a/src/librustc_middle/query/mod.rs +++ b/src/librustc_middle/query/mod.rs @@ -639,7 +639,7 @@ rustc_queries! { } Other { - query fn_arg_names(_: DefId) -> &'tcx [ast::Name] {} + query fn_arg_names(_: DefId) -> &'tcx [Symbol] {} /// Gets the rendered value of the specified constant or associated constant. /// Used by rustdoc. query rendered_const(_: DefId) -> String {} @@ -1052,7 +1052,7 @@ rustc_queries! { desc { "looking up all possibly unused extern crates" } } query names_imported_by_glob_use(def_id: LocalDefId) - -> &'tcx FxHashSet<ast::Name> { + -> &'tcx FxHashSet<Symbol> { eval_always desc { |tcx| "names_imported_by_glob_use for `{}`", tcx.def_path_str(def_id.to_def_id()) } } diff --git a/src/librustc_middle/traits/mod.rs b/src/librustc_middle/traits/mod.rs index 3a05d577bfa..6cc00b8d3b7 100644 --- a/src/librustc_middle/traits/mod.rs +++ b/src/librustc_middle/traits/mod.rs @@ -11,9 +11,9 @@ use crate::mir::interpret::ErrorHandled; use crate::ty::subst::SubstsRef; use crate::ty::{self, AdtKind, Ty, TyCtxt}; -use rustc_ast::ast; use rustc_hir as hir; use rustc_hir::def_id::DefId; +use rustc_span::symbol::Symbol; use rustc_span::{Span, DUMMY_SP}; use smallvec::SmallVec; @@ -198,14 +198,14 @@ pub enum ObligationCauseCode<'tcx> { /// Error derived when matching traits/impls; see ObligationCause for more details CompareImplMethodObligation { - item_name: ast::Name, + item_name: Symbol, impl_item_def_id: DefId, trait_item_def_id: DefId, }, /// Error derived when matching traits/impls; see ObligationCause for more details CompareImplTypeObligation { - item_name: ast::Name, + item_name: Symbol, impl_item_def_id: DefId, trait_item_def_id: DefId, }, @@ -566,10 +566,10 @@ pub enum ObjectSafetyViolation { SupertraitSelf(SmallVec<[Span; 1]>), /// Method has something illegal. - Method(ast::Name, MethodViolationCode, Span), + Method(Symbol, MethodViolationCode, Span), /// Associated const. - AssocConst(ast::Name, Span), + AssocConst(Symbol, Span), } impl ObjectSafetyViolation { diff --git a/src/librustc_middle/traits/specialization_graph.rs b/src/librustc_middle/traits/specialization_graph.rs index bc743666e4a..4f02aaa96ac 100644 --- a/src/librustc_middle/traits/specialization_graph.rs +++ b/src/librustc_middle/traits/specialization_graph.rs @@ -1,11 +1,11 @@ use crate::ich::{self, StableHashingContext}; use crate::ty::fast_reject::SimplifiedType; use crate::ty::{self, TyCtxt}; -use rustc_ast::ast::Ident; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_errors::ErrorReported; use rustc_hir::def_id::{DefId, DefIdMap}; +use rustc_span::symbol::Ident; /// A per-trait graph of impls in specialization order. At the moment, this /// graph forms a tree rooted with the trait itself, with all other nodes diff --git a/src/librustc_middle/ty/context.rs b/src/librustc_middle/ty/context.rs index e43eb01ad96..d6fdc71b1ac 100644 --- a/src/librustc_middle/ty/context.rs +++ b/src/librustc_middle/ty/context.rs @@ -376,7 +376,7 @@ pub struct TypeckTables<'tcx> { /// Records the reasons that we picked the kind of each closure; /// not all closures are present in the map. - closure_kind_origins: ItemLocalMap<(Span, ast::Name)>, + closure_kind_origins: ItemLocalMap<(Span, Symbol)>, /// For each fn, records the "liberated" types of its arguments /// and return type. Liberated means that all bound regions @@ -621,11 +621,11 @@ impl<'tcx> TypeckTables<'tcx> { self.upvar_capture_map[&upvar_id] } - pub fn closure_kind_origins(&self) -> LocalTableInContext<'_, (Span, ast::Name)> { + pub fn closure_kind_origins(&self) -> LocalTableInContext<'_, (Span, Symbol)> { LocalTableInContext { hir_owner: self.hir_owner, data: &self.closure_kind_origins } } - pub fn closure_kind_origins_mut(&mut self) -> LocalTableInContextMut<'_, (Span, ast::Name)> { + pub fn closure_kind_origins_mut(&mut self) -> LocalTableInContextMut<'_, (Span, Symbol)> { LocalTableInContextMut { hir_owner: self.hir_owner, data: &mut self.closure_kind_origins } } @@ -941,10 +941,10 @@ pub struct GlobalCtxt<'tcx> { maybe_unused_extern_crates: Vec<(DefId, Span)>, /// A map of glob use to a set of names it actually imports. Currently only /// used in save-analysis. - glob_map: FxHashMap<LocalDefId, FxHashSet<ast::Name>>, + glob_map: FxHashMap<LocalDefId, FxHashSet<Symbol>>, /// Extern prelude entries. The value is `true` if the entry was introduced /// via `extern crate` item and not `--extern` option or compiler built-in. - pub extern_prelude: FxHashMap<ast::Name, bool>, + pub extern_prelude: FxHashMap<Symbol, bool>, // Internal cache for metadata decoding. No need to track deps on this. pub rcache: Lock<FxHashMap<ty::CReaderCacheKey, Ty<'tcx>>>, diff --git a/src/librustc_middle/ty/layout.rs b/src/librustc_middle/ty/layout.rs index ade89ab39d4..7c4e4d095bc 100644 --- a/src/librustc_middle/ty/layout.rs +++ b/src/librustc_middle/ty/layout.rs @@ -4,13 +4,14 @@ use crate::mir::{GeneratorLayout, GeneratorSavedLocal}; use crate::ty::subst::Subst; use crate::ty::{self, subst::SubstsRef, ReprOptions, Ty, TyCtxt, TypeFoldable}; -use rustc_ast::ast::{self, Ident, IntTy, UintTy}; +use rustc_ast::ast::{self, IntTy, UintTy}; use rustc_attr as attr; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_hir as hir; use rustc_index::bit_set::BitSet; use rustc_index::vec::{Idx, IndexVec}; use rustc_session::{DataTypeKind, FieldInfo, SizeKind, VariantInfo}; +use rustc_span::symbol::{Ident, Symbol}; use rustc_span::DUMMY_SP; use rustc_target::abi::call::{ ArgAbi, ArgAttribute, ArgAttributes, Conv, FnAbi, PassMode, Reg, RegKind, @@ -1628,9 +1629,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> { let adt_kind = adt_def.adt_kind(); let adt_packed = adt_def.repr.pack.is_some(); - let build_variant_info = |n: Option<Ident>, - flds: &[ast::Name], - layout: TyAndLayout<'tcx>| { + let build_variant_info = |n: Option<Ident>, flds: &[Symbol], layout: TyAndLayout<'tcx>| { let mut min_size = Size::ZERO; let field_info: Vec<_> = flds .iter() diff --git a/src/librustc_middle/ty/mod.rs b/src/librustc_middle/ty/mod.rs index 8bb9934789a..02fe7adcd07 100644 --- a/src/librustc_middle/ty/mod.rs +++ b/src/librustc_middle/ty/mod.rs @@ -17,7 +17,7 @@ use crate::traits::{self, Reveal}; use crate::ty; use crate::ty::subst::{InternalSubsts, Subst, SubstsRef}; use crate::ty::util::{Discr, IntTypeExt}; -use rustc_ast::ast::{self, Ident, Name}; +use rustc_ast::ast; use rustc_ast::node_id::{NodeId, NodeMap, NodeSet}; use rustc_attr as attr; use rustc_data_structures::captures::Captures; @@ -38,7 +38,7 @@ use rustc_macros::HashStable; use rustc_serialize::{self, Encodable, Encoder}; use rustc_session::DataTypeKind; use rustc_span::hygiene::ExpnId; -use rustc_span::symbol::{kw, sym, Symbol}; +use rustc_span::symbol::{kw, sym, Ident, Symbol}; use rustc_span::Span; use rustc_target::abi::{Align, VariantIdx}; @@ -128,7 +128,7 @@ pub struct ResolverOutputs { pub glob_map: GlobMap, /// Extern prelude entries. The value is `true` if the entry was introduced /// via `extern crate` item and not `--extern` option or compiler built-in. - pub extern_prelude: FxHashMap<Name, bool>, + pub extern_prelude: FxHashMap<Symbol, bool>, } #[derive(Clone, Copy, PartialEq, Eq, Debug, HashStable)] diff --git a/src/librustc_middle/ty/print/pretty.rs b/src/librustc_middle/ty/print/pretty.rs index 2d2704fc2bd..32cad07bd79 100644 --- a/src/librustc_middle/ty/print/pretty.rs +++ b/src/librustc_middle/ty/print/pretty.rs @@ -12,7 +12,7 @@ use rustc_hir as hir; use rustc_hir::def::{CtorKind, DefKind, Namespace}; use rustc_hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX, LOCAL_CRATE}; use rustc_hir::definitions::{DefPathData, DisambiguatedDefPathData}; -use rustc_span::symbol::{kw, Symbol}; +use rustc_span::symbol::{kw, Ident, Symbol}; use rustc_target::abi::{Integer, Size}; use rustc_target::spec::abi::Abi; @@ -1456,7 +1456,7 @@ impl<F: fmt::Write> Printer<'tcx> for FmtPrinter<'_, 'tcx, F> { if !self.empty_path { write!(self, "::")?; } - if ast::Ident::from_str(&name).is_raw_guess() { + if Ident::from_str(&name).is_raw_guess() { write!(self, "r#")?; } write!(self, "{}", name)?; diff --git a/src/librustc_middle/ty/query/on_disk_cache.rs b/src/librustc_middle/ty/query/on_disk_cache.rs index 760fdbe8522..71c2c24cc0a 100644 --- a/src/librustc_middle/ty/query/on_disk_cache.rs +++ b/src/librustc_middle/ty/query/on_disk_cache.rs @@ -4,7 +4,6 @@ use crate::mir::{self, interpret}; use crate::ty::codec::{self as ty_codec, TyDecoder, TyEncoder}; use crate::ty::context::TyCtxt; use crate::ty::{self, Ty}; -use rustc_ast::ast::Ident; use rustc_data_structures::fingerprint::Fingerprint; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::sync::{HashMapExt, Lock, Lrc, Once}; @@ -20,6 +19,7 @@ use rustc_serialize::{ use rustc_session::{CrateDisambiguator, Session}; use rustc_span::hygiene::{ExpnId, SyntaxContext}; use rustc_span::source_map::{SourceMap, StableSourceFileId}; +use rustc_span::symbol::Ident; use rustc_span::CachingSourceMapView; use rustc_span::{BytePos, SourceFile, Span, DUMMY_SP}; use std::mem; diff --git a/src/librustc_middle/ty/sty.rs b/src/librustc_middle/ty/sty.rs index ac5477edcc3..a6cf3b7e2ee 100644 --- a/src/librustc_middle/ty/sty.rs +++ b/src/librustc_middle/ty/sty.rs @@ -16,14 +16,14 @@ use crate::ty::{ }; use crate::ty::{List, ParamEnv, ParamEnvAnd, TyS}; use polonius_engine::Atom; -use rustc_ast::ast::{self, Ident}; +use rustc_ast::ast; use rustc_data_structures::captures::Captures; use rustc_errors::ErrorReported; use rustc_hir as hir; use rustc_hir::def_id::{DefId, LocalDefId}; use rustc_index::vec::Idx; use rustc_macros::HashStable; -use rustc_span::symbol::{kw, Symbol}; +use rustc_span::symbol::{kw, Ident, Symbol}; use rustc_target::abi::{Size, VariantIdx}; use rustc_target::spec::abi; use std::borrow::Cow; |
