mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-11 16:15:03 +00:00
Index HIR after creating TyCtxt
This commit is contained in:
parent
3538cb38fc
commit
8b16b023b1
@ -163,7 +163,7 @@ macro_rules! arena_types {
|
|||||||
[] where_predicate: rustc_hir::WherePredicate<$tcx>,
|
[] where_predicate: rustc_hir::WherePredicate<$tcx>,
|
||||||
|
|
||||||
// HIR query types
|
// HIR query types
|
||||||
[few] hir_map: rustc::hir::map::Map<$tcx>,
|
[few] indexed_hir: rustc::hir::map::IndexedHir<$tcx>,
|
||||||
[few] hir_definitions: rustc::hir::map::definitions::Definitions,
|
[few] hir_definitions: rustc::hir::map::definitions::Definitions,
|
||||||
[] hir_owner: rustc::hir::HirOwner<$tcx>,
|
[] hir_owner: rustc::hir::HirOwner<$tcx>,
|
||||||
[] hir_owner_items: rustc::hir::HirOwnerItems<$tcx>,
|
[] hir_owner_items: rustc::hir::HirOwnerItems<$tcx>,
|
||||||
|
@ -307,7 +307,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
|
|||||||
/// deep walking so that we walk nested items in the context of
|
/// deep walking so that we walk nested items in the context of
|
||||||
/// their outer items.
|
/// their outer items.
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
panic!("`visit_nested_xxx` must be manually implemented in this visitor");
|
panic!("`visit_nested_xxx` must be manually implemented in this visitor");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use crate::hir::map::EarlyMap;
|
use crate::ty::TyCtxt;
|
||||||
/*use rustc_data_structures::fx::FxHashSet;
|
/*use rustc_data_structures::fx::FxHashSet;
|
||||||
use rustc_data_structures::sync::{par_iter, Lock, ParallelIterator};
|
use rustc_data_structures::sync::{par_iter, Lock, ParallelIterator};
|
||||||
use rustc_hir as hir;
|
use rustc_hir as hir;
|
||||||
@ -7,8 +7,8 @@ use rustc_hir::intravisit;
|
|||||||
use rustc_hir::itemlikevisit::ItemLikeVisitor;
|
use rustc_hir::itemlikevisit::ItemLikeVisitor;
|
||||||
use rustc_hir::{HirId, ItemLocalId};*/
|
use rustc_hir::{HirId, ItemLocalId};*/
|
||||||
|
|
||||||
pub fn check_crate(_: &EarlyMap<'_>, sess: &rustc_session::Session) {
|
pub fn check_crate(_tcx: TyCtxt<'_>) {
|
||||||
/*hir_map.dep_graph.assert_ignored();
|
/*tcx.dep_graph.assert_ignored();
|
||||||
|
|
||||||
let errors = Lock::new(Vec::new());
|
let errors = Lock::new(Vec::new());
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ pub fn check_crate(_: &EarlyMap<'_>, sess: &rustc_session::Session) {
|
|||||||
|
|
||||||
if !errors.is_empty() {
|
if !errors.is_empty() {
|
||||||
let message = errors.iter().fold(String::new(), |s1, s2| s1 + "\n" + s2);
|
let message = errors.iter().fold(String::new(), |s1, s2| s1 + "\n" + s2);
|
||||||
sess.delay_span_bug(rustc_span::DUMMY_SP, &message);
|
tcx.sess.delay_span_bug(rustc_span::DUMMY_SP, &message);
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -135,7 +135,7 @@ impl<'a, 'hir> HirIdValidator<'a, 'hir> {
|
|||||||
impl<'a, 'hir> intravisit::Visitor<'hir> for HirIdValidator<'a, 'hir> {
|
impl<'a, 'hir> intravisit::Visitor<'hir> for HirIdValidator<'a, 'hir> {
|
||||||
type Map = EarlyMap<'hir>;
|
type Map = EarlyMap<'hir>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> intravisit::NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> intravisit::NestedVisitorMap<Self::Map> {
|
||||||
intravisit::NestedVisitorMap::OnlyBodies(self.hir_map)
|
intravisit::NestedVisitorMap::OnlyBodies(self.hir_map)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,16 +3,14 @@ pub use self::definitions::{
|
|||||||
DefKey, DefPath, DefPathData, DefPathHash, Definitions, DisambiguatedDefPathData,
|
DefKey, DefPath, DefPathData, DefPathHash, Definitions, DisambiguatedDefPathData,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::arena::Arena;
|
|
||||||
use crate::hir::{HirOwner, HirOwnerItems};
|
use crate::hir::{HirOwner, HirOwnerItems};
|
||||||
use crate::middle::cstore::CrateStoreDyn;
|
|
||||||
use crate::ty::query::Providers;
|
use crate::ty::query::Providers;
|
||||||
use crate::ty::TyCtxt;
|
use crate::ty::TyCtxt;
|
||||||
use rustc_ast::ast::{self, Name, NodeId};
|
use rustc_ast::ast::{self, Name, NodeId};
|
||||||
use rustc_data_structures::fx::FxHashMap;
|
use rustc_data_structures::fx::FxHashMap;
|
||||||
use rustc_data_structures::svh::Svh;
|
use rustc_data_structures::svh::Svh;
|
||||||
use rustc_hir::def::{DefKind, Res};
|
use rustc_hir::def::{DefKind, Res};
|
||||||
use rustc_hir::def_id::{DefId, DefIndex, LocalDefId, LOCAL_CRATE};
|
use rustc_hir::def_id::{CrateNum, DefId, DefIndex, LocalDefId, LOCAL_CRATE};
|
||||||
use rustc_hir::intravisit;
|
use rustc_hir::intravisit;
|
||||||
use rustc_hir::itemlikevisit::ItemLikeVisitor;
|
use rustc_hir::itemlikevisit::ItemLikeVisitor;
|
||||||
use rustc_hir::print::Nested;
|
use rustc_hir::print::Nested;
|
||||||
@ -129,38 +127,20 @@ fn is_body_owner<'hir>(node: Node<'hir>, hir_id: HirId) -> bool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Represents a mapping from `NodeId`s to AST elements and their parent `NodeId`s.
|
pub struct IndexedHir<'hir> {
|
||||||
pub struct EarlyMap<'hir> {
|
|
||||||
pub krate: &'hir Crate<'hir>,
|
|
||||||
|
|
||||||
/// The SVH of the local crate.
|
/// The SVH of the local crate.
|
||||||
pub crate_hash: Svh,
|
pub crate_hash: Svh,
|
||||||
|
|
||||||
pub(super) owner_map: FxHashMap<DefIndex, &'hir HirOwner<'hir>>,
|
pub(super) owner_map: FxHashMap<DefIndex, &'hir HirOwner<'hir>>,
|
||||||
pub(super) owner_items_map: FxHashMap<DefIndex, &'hir HirOwnerItems<'hir>>,
|
pub(super) owner_items_map: FxHashMap<DefIndex, &'hir HirOwnerItems<'hir>>,
|
||||||
|
|
||||||
pub(crate) definitions: &'hir Definitions,
|
|
||||||
|
|
||||||
/// The reverse mapping of `node_to_hir_id`.
|
/// The reverse mapping of `node_to_hir_id`.
|
||||||
pub(super) hir_to_node_id: FxHashMap<HirId, NodeId>,
|
pub(super) hir_to_node_id: FxHashMap<HirId, NodeId>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Represents a mapping from `NodeId`s to AST elements and their parent `NodeId`s.
|
#[derive(Copy, Clone)]
|
||||||
pub struct Map<'hir> {
|
pub struct Map<'hir> {
|
||||||
pub(super) tcx: TyCtxt<'hir>,
|
pub(super) tcx: TyCtxt<'hir>,
|
||||||
|
|
||||||
pub(super) krate: &'hir Crate<'hir>,
|
|
||||||
|
|
||||||
/// The SVH of the local crate.
|
|
||||||
pub crate_hash: Svh,
|
|
||||||
|
|
||||||
pub(super) owner_map: FxHashMap<DefIndex, &'hir HirOwner<'hir>>,
|
|
||||||
pub(super) owner_items_map: FxHashMap<DefIndex, &'hir HirOwnerItems<'hir>>,
|
|
||||||
|
|
||||||
pub(super) definitions: &'hir Definitions,
|
|
||||||
|
|
||||||
/// The reverse mapping of `node_to_hir_id`.
|
|
||||||
pub(super) hir_to_node_id: FxHashMap<HirId, NodeId>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An iterator that walks up the ancestor tree of a given `HirId`.
|
/// An iterator that walks up the ancestor tree of a given `HirId`.
|
||||||
@ -196,21 +176,18 @@ impl<'hir> Iterator for ParentHirIterator<'_, 'hir> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'hir> Map<'hir> {
|
impl<'hir> Map<'hir> {
|
||||||
/// This is used internally in the dependency tracking system.
|
pub fn krate(&self) -> &'hir Crate<'hir> {
|
||||||
/// Use the `krate` method to ensure your dependency on the
|
self.tcx.hir_crate(LOCAL_CRATE)
|
||||||
/// crate is tracked.
|
|
||||||
pub fn untracked_krate(&self) -> &Crate<'hir> {
|
|
||||||
&self.krate
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn definitions(&self) -> &Definitions {
|
pub fn definitions(&self) -> &'hir Definitions {
|
||||||
&self.definitions
|
&self.tcx.definitions
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn def_key(&self, def_id: DefId) -> DefKey {
|
pub fn def_key(&self, def_id: DefId) -> DefKey {
|
||||||
assert!(def_id.is_local());
|
assert!(def_id.is_local());
|
||||||
self.definitions.def_key(def_id.index)
|
self.tcx.definitions.def_key(def_id.index)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn def_path_from_hir_id(&self, id: HirId) -> Option<DefPath> {
|
pub fn def_path_from_hir_id(&self, id: HirId) -> Option<DefPath> {
|
||||||
@ -219,7 +196,7 @@ impl<'hir> Map<'hir> {
|
|||||||
|
|
||||||
pub fn def_path(&self, def_id: DefId) -> DefPath {
|
pub fn def_path(&self, def_id: DefId) -> DefPath {
|
||||||
assert!(def_id.is_local());
|
assert!(def_id.is_local());
|
||||||
self.definitions.def_path(def_id.index)
|
self.tcx.definitions.def_path(def_id.index)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
@ -248,42 +225,42 @@ impl<'hir> Map<'hir> {
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn opt_local_def_id(&self, hir_id: HirId) -> Option<DefId> {
|
pub fn opt_local_def_id(&self, hir_id: HirId) -> Option<DefId> {
|
||||||
let node_id = self.hir_to_node_id(hir_id);
|
let node_id = self.hir_to_node_id(hir_id);
|
||||||
self.definitions.opt_local_def_id(node_id)
|
self.tcx.definitions.opt_local_def_id(node_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn opt_local_def_id_from_node_id(&self, node: NodeId) -> Option<DefId> {
|
pub fn opt_local_def_id_from_node_id(&self, node: NodeId) -> Option<DefId> {
|
||||||
self.definitions.opt_local_def_id(node)
|
self.tcx.definitions.opt_local_def_id(node)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn as_local_node_id(&self, def_id: DefId) -> Option<NodeId> {
|
pub fn as_local_node_id(&self, def_id: DefId) -> Option<NodeId> {
|
||||||
self.definitions.as_local_node_id(def_id)
|
self.tcx.definitions.as_local_node_id(def_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn as_local_hir_id(&self, def_id: DefId) -> Option<HirId> {
|
pub fn as_local_hir_id(&self, def_id: DefId) -> Option<HirId> {
|
||||||
self.definitions.as_local_hir_id(def_id)
|
self.tcx.definitions.as_local_hir_id(def_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn hir_to_node_id(&self, hir_id: HirId) -> NodeId {
|
pub fn hir_to_node_id(&self, hir_id: HirId) -> NodeId {
|
||||||
self.hir_to_node_id[&hir_id]
|
self.tcx.index_hir(LOCAL_CRATE).hir_to_node_id[&hir_id]
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn node_to_hir_id(&self, node_id: NodeId) -> HirId {
|
pub fn node_to_hir_id(&self, node_id: NodeId) -> HirId {
|
||||||
self.definitions.node_to_hir_id(node_id)
|
self.tcx.definitions.node_to_hir_id(node_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn def_index_to_hir_id(&self, def_index: DefIndex) -> HirId {
|
pub fn def_index_to_hir_id(&self, def_index: DefIndex) -> HirId {
|
||||||
self.definitions.def_index_to_hir_id(def_index)
|
self.tcx.definitions.def_index_to_hir_id(def_index)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn local_def_id_to_hir_id(&self, def_id: LocalDefId) -> HirId {
|
pub fn local_def_id_to_hir_id(&self, def_id: LocalDefId) -> HirId {
|
||||||
self.definitions.def_index_to_hir_id(def_id.to_def_id().index)
|
self.tcx.definitions.def_index_to_hir_id(def_id.to_def_id().index)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn def_kind(&self, hir_id: HirId) -> Option<DefKind> {
|
pub fn def_kind(&self, hir_id: HirId) -> Option<DefKind> {
|
||||||
@ -1045,45 +1022,42 @@ impl Named for ImplItem<'_> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn map_crate<'hir>(
|
pub(super) fn index_hir<'tcx>(tcx: TyCtxt<'tcx>, cnum: CrateNum) -> &'tcx IndexedHir<'tcx> {
|
||||||
sess: &rustc_session::Session,
|
assert_eq!(cnum, LOCAL_CRATE);
|
||||||
arena: &'hir Arena<'hir>,
|
|
||||||
cstore: &CrateStoreDyn,
|
let _prof_timer = tcx.sess.prof.generic_activity("build_hir_map");
|
||||||
krate: &'hir Crate<'hir>,
|
|
||||||
definitions: Definitions,
|
|
||||||
) -> EarlyMap<'hir> {
|
|
||||||
let _prof_timer = sess.prof.generic_activity("build_hir_map");
|
|
||||||
|
|
||||||
// Build the reverse mapping of `node_to_hir_id`.
|
// Build the reverse mapping of `node_to_hir_id`.
|
||||||
let hir_to_node_id = definitions
|
let hir_to_node_id = tcx
|
||||||
|
.definitions
|
||||||
.node_to_hir_id
|
.node_to_hir_id
|
||||||
.iter_enumerated()
|
.iter_enumerated()
|
||||||
.map(|(node_id, &hir_id)| (hir_id, node_id))
|
.map(|(node_id, &hir_id)| (hir_id, node_id))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let (owner_map, owner_items_map, crate_hash) = {
|
let (owner_map, owner_items_map, crate_hash) = {
|
||||||
let hcx = crate::ich::StableHashingContext::new(sess, krate, &definitions, cstore);
|
let hcx = tcx.create_stable_hashing_context();
|
||||||
|
|
||||||
let mut collector =
|
let mut collector = NodeCollector::root(
|
||||||
NodeCollector::root(sess, arena, krate, &definitions, &hir_to_node_id, hcx);
|
tcx.sess,
|
||||||
intravisit::walk_crate(&mut collector, krate);
|
&**tcx.arena,
|
||||||
|
tcx.untracked_crate,
|
||||||
|
&tcx.definitions,
|
||||||
|
&hir_to_node_id,
|
||||||
|
hcx,
|
||||||
|
);
|
||||||
|
intravisit::walk_crate(&mut collector, tcx.untracked_crate);
|
||||||
|
|
||||||
let crate_disambiguator = sess.local_crate_disambiguator();
|
let crate_disambiguator = tcx.sess.local_crate_disambiguator();
|
||||||
let cmdline_args = sess.opts.dep_tracking_hash();
|
let cmdline_args = tcx.sess.opts.dep_tracking_hash();
|
||||||
collector.finalize_and_compute_crate_hash(crate_disambiguator, cstore, cmdline_args)
|
collector.finalize_and_compute_crate_hash(crate_disambiguator, &*tcx.cstore, cmdline_args)
|
||||||
};
|
};
|
||||||
|
|
||||||
let map = EarlyMap {
|
let map = tcx.arena.alloc(IndexedHir {
|
||||||
krate,
|
|
||||||
crate_hash,
|
crate_hash,
|
||||||
owner_map,
|
owner_map,
|
||||||
owner_items_map: owner_items_map.into_iter().map(|(k, v)| (k, &*v)).collect(),
|
owner_items_map: owner_items_map.into_iter().map(|(k, v)| (k, &*v)).collect(),
|
||||||
hir_to_node_id,
|
hir_to_node_id,
|
||||||
definitions: arena.alloc(definitions),
|
|
||||||
};
|
|
||||||
|
|
||||||
sess.time("validate_HIR_map", || {
|
|
||||||
hir_id_validator::check_crate(&map, sess);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
map
|
map
|
||||||
|
@ -8,18 +8,14 @@ pub mod map;
|
|||||||
use crate::ich::StableHashingContext;
|
use crate::ich::StableHashingContext;
|
||||||
use crate::ty::query::Providers;
|
use crate::ty::query::Providers;
|
||||||
use crate::ty::TyCtxt;
|
use crate::ty::TyCtxt;
|
||||||
use rustc_data_structures::cold_path;
|
|
||||||
use rustc_data_structures::fx::FxHashMap;
|
use rustc_data_structures::fx::FxHashMap;
|
||||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||||
use rustc_hir::def_id::{DefId, LOCAL_CRATE};
|
use rustc_hir::def_id::{DefId, LOCAL_CRATE};
|
||||||
use rustc_hir::print;
|
|
||||||
use rustc_hir::Body;
|
use rustc_hir::Body;
|
||||||
use rustc_hir::Crate;
|
|
||||||
use rustc_hir::HirId;
|
use rustc_hir::HirId;
|
||||||
use rustc_hir::ItemLocalId;
|
use rustc_hir::ItemLocalId;
|
||||||
use rustc_hir::Node;
|
use rustc_hir::Node;
|
||||||
use rustc_index::vec::IndexVec;
|
use rustc_index::vec::IndexVec;
|
||||||
use std::ops::Deref;
|
|
||||||
|
|
||||||
#[derive(HashStable)]
|
#[derive(HashStable)]
|
||||||
pub struct HirOwner<'tcx> {
|
pub struct HirOwner<'tcx> {
|
||||||
@ -60,48 +56,10 @@ impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for HirOwnerItems<'tcx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A wrapper type which allows you to access HIR.
|
|
||||||
#[derive(Clone)]
|
|
||||||
pub struct Hir<'tcx> {
|
|
||||||
tcx: TyCtxt<'tcx>,
|
|
||||||
map: &'tcx map::Map<'tcx>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'tcx> Hir<'tcx> {
|
|
||||||
pub fn krate(&self) -> &'tcx Crate<'tcx> {
|
|
||||||
self.tcx.hir_crate(LOCAL_CRATE)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'tcx> Deref for Hir<'tcx> {
|
|
||||||
type Target = &'tcx map::Map<'tcx>;
|
|
||||||
|
|
||||||
#[inline(always)]
|
|
||||||
fn deref(&self) -> &Self::Target {
|
|
||||||
&self.map
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'hir> print::PpAnn for Hir<'hir> {
|
|
||||||
fn nested(&self, state: &mut print::State<'_>, nested: print::Nested) {
|
|
||||||
self.map.nested(state, nested)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'tcx> TyCtxt<'tcx> {
|
impl<'tcx> TyCtxt<'tcx> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn hir(self) -> Hir<'tcx> {
|
pub fn hir(self) -> map::Map<'tcx> {
|
||||||
let map = self.late_hir_map.load();
|
map::Map { tcx: self }
|
||||||
let map = if unlikely!(map.is_none()) {
|
|
||||||
cold_path(|| {
|
|
||||||
let map = self.hir_map(LOCAL_CRATE);
|
|
||||||
self.late_hir_map.store(Some(map));
|
|
||||||
map
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
map.unwrap()
|
|
||||||
};
|
|
||||||
Hir { tcx: self, map }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn parent_module(self, id: HirId) -> DefId {
|
pub fn parent_module(self, id: HirId) -> DefId {
|
||||||
@ -114,37 +72,16 @@ pub fn provide(providers: &mut Providers<'_>) {
|
|||||||
let hir = tcx.hir();
|
let hir = tcx.hir();
|
||||||
hir.local_def_id(hir.get_module_parent_node(hir.as_local_hir_id(id).unwrap()))
|
hir.local_def_id(hir.get_module_parent_node(hir.as_local_hir_id(id).unwrap()))
|
||||||
};
|
};
|
||||||
providers.hir_crate = |tcx, _| tcx.hir_map(LOCAL_CRATE).untracked_krate();
|
providers.hir_crate = |tcx, _| tcx.untracked_crate;
|
||||||
providers.hir_map = |tcx, id| {
|
providers.index_hir = map::index_hir;
|
||||||
assert_eq!(id, LOCAL_CRATE);
|
|
||||||
let early = tcx.hir_map.steal();
|
|
||||||
tcx.arena.alloc(map::Map {
|
|
||||||
tcx,
|
|
||||||
krate: early.krate,
|
|
||||||
|
|
||||||
crate_hash: early.crate_hash,
|
|
||||||
|
|
||||||
owner_map: early.owner_map,
|
|
||||||
owner_items_map: early.owner_items_map,
|
|
||||||
|
|
||||||
definitions: early.definitions,
|
|
||||||
|
|
||||||
hir_to_node_id: early.hir_to_node_id,
|
|
||||||
})
|
|
||||||
};
|
|
||||||
providers.hir_module_items = |tcx, id| {
|
providers.hir_module_items = |tcx, id| {
|
||||||
assert_eq!(id.krate, LOCAL_CRATE);
|
assert_eq!(id.krate, LOCAL_CRATE);
|
||||||
let hir = tcx.hir();
|
let hir = tcx.hir();
|
||||||
let module = hir.as_local_hir_id(id).unwrap();
|
let module = hir.as_local_hir_id(id).unwrap();
|
||||||
&hir.untracked_krate().modules[&module]
|
&tcx.untracked_crate.modules[&module]
|
||||||
};
|
|
||||||
providers.hir_owner = |tcx, id| {
|
|
||||||
assert_eq!(id.krate, LOCAL_CRATE);
|
|
||||||
*tcx.hir().map.owner_map.get(&id.index).unwrap()
|
|
||||||
};
|
|
||||||
providers.hir_owner_items = |tcx, id| {
|
|
||||||
assert_eq!(id.krate, LOCAL_CRATE);
|
|
||||||
*tcx.hir().map.owner_items_map.get(&id.index).unwrap()
|
|
||||||
};
|
};
|
||||||
|
providers.hir_owner = |tcx, id| *tcx.index_hir(id.krate).owner_map.get(&id.index).unwrap();
|
||||||
|
providers.hir_owner_items =
|
||||||
|
|tcx, id| *tcx.index_hir(id.krate).owner_items_map.get(&id.index).unwrap();
|
||||||
map::provide(providers);
|
map::provide(providers);
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ rustc_queries! {
|
|||||||
desc { "get the crate HIR" }
|
desc { "get the crate HIR" }
|
||||||
}
|
}
|
||||||
|
|
||||||
query hir_map(_: CrateNum) -> &'tcx map::Map<'tcx> {
|
query index_hir(_: CrateNum) -> &'tcx map::IndexedHir<'tcx> {
|
||||||
eval_always
|
eval_always
|
||||||
no_hash
|
no_hash
|
||||||
desc { "index HIR" }
|
desc { "index HIR" }
|
||||||
|
@ -53,7 +53,7 @@ use rustc_data_structures::sharded::{IntoPointer, ShardedHashMap};
|
|||||||
use rustc_data_structures::stable_hasher::{
|
use rustc_data_structures::stable_hasher::{
|
||||||
hash_stable_hashmap, HashStable, StableHasher, StableVec,
|
hash_stable_hashmap, HashStable, StableHasher, StableVec,
|
||||||
};
|
};
|
||||||
use rustc_data_structures::sync::{self, AtomicCell, Lock, Lrc, WorkerLocal};
|
use rustc_data_structures::sync::{self, Lock, Lrc, WorkerLocal};
|
||||||
use rustc_hir as hir;
|
use rustc_hir as hir;
|
||||||
use rustc_hir::def::{DefKind, Res};
|
use rustc_hir::def::{DefKind, Res};
|
||||||
use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, DefIdSet, DefIndex, LOCAL_CRATE};
|
use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, DefIdSet, DefIndex, LOCAL_CRATE};
|
||||||
@ -939,7 +939,7 @@ pub struct GlobalCtxt<'tcx> {
|
|||||||
|
|
||||||
interners: CtxtInterners<'tcx>,
|
interners: CtxtInterners<'tcx>,
|
||||||
|
|
||||||
cstore: Box<CrateStoreDyn>,
|
pub(crate) cstore: Box<CrateStoreDyn>,
|
||||||
|
|
||||||
pub sess: &'tcx Session,
|
pub sess: &'tcx Session,
|
||||||
|
|
||||||
@ -972,9 +972,6 @@ pub struct GlobalCtxt<'tcx> {
|
|||||||
/// Export map produced by name resolution.
|
/// Export map produced by name resolution.
|
||||||
export_map: FxHashMap<DefId, Vec<Export<hir::HirId>>>,
|
export_map: FxHashMap<DefId, Vec<Export<hir::HirId>>>,
|
||||||
|
|
||||||
/// These should usually be accessed with the `tcx.hir()` method.
|
|
||||||
pub(crate) hir_map: Steal<hir_map::EarlyMap<'tcx>>,
|
|
||||||
pub(crate) late_hir_map: AtomicCell<Option<&'tcx hir_map::Map<'tcx>>>,
|
|
||||||
pub(crate) untracked_crate: &'tcx hir::Crate<'tcx>,
|
pub(crate) untracked_crate: &'tcx hir::Crate<'tcx>,
|
||||||
pub(crate) definitions: &'tcx Definitions,
|
pub(crate) definitions: &'tcx Definitions,
|
||||||
|
|
||||||
@ -1120,7 +1117,8 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||||||
extern_providers: ty::query::Providers<'tcx>,
|
extern_providers: ty::query::Providers<'tcx>,
|
||||||
arena: &'tcx WorkerLocal<Arena<'tcx>>,
|
arena: &'tcx WorkerLocal<Arena<'tcx>>,
|
||||||
resolutions: ty::ResolverOutputs,
|
resolutions: ty::ResolverOutputs,
|
||||||
hir: hir_map::EarlyMap<'tcx>,
|
krate: &'tcx hir::Crate<'tcx>,
|
||||||
|
definitions: &'tcx Definitions,
|
||||||
dep_graph: DepGraph,
|
dep_graph: DepGraph,
|
||||||
on_disk_query_result_cache: query::OnDiskCache<'tcx>,
|
on_disk_query_result_cache: query::OnDiskCache<'tcx>,
|
||||||
crate_name: &str,
|
crate_name: &str,
|
||||||
@ -1133,7 +1131,6 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||||||
let common_types = CommonTypes::new(&interners);
|
let common_types = CommonTypes::new(&interners);
|
||||||
let common_lifetimes = CommonLifetimes::new(&interners);
|
let common_lifetimes = CommonLifetimes::new(&interners);
|
||||||
let common_consts = CommonConsts::new(&interners, &common_types);
|
let common_consts = CommonConsts::new(&interners, &common_types);
|
||||||
let definitions = hir.definitions;
|
|
||||||
let cstore = resolutions.cstore;
|
let cstore = resolutions.cstore;
|
||||||
let crates = cstore.crates_untracked();
|
let crates = cstore.crates_untracked();
|
||||||
let max_cnum = crates.iter().map(|c| c.as_usize()).max().unwrap_or(0);
|
let max_cnum = crates.iter().map(|c| c.as_usize()).max().unwrap_or(0);
|
||||||
@ -1213,9 +1210,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||||||
.map(|(id, names)| (definitions.local_def_id(id), names))
|
.map(|(id, names)| (definitions.local_def_id(id), names))
|
||||||
.collect(),
|
.collect(),
|
||||||
extern_prelude: resolutions.extern_prelude,
|
extern_prelude: resolutions.extern_prelude,
|
||||||
untracked_crate: hir.krate,
|
untracked_crate: krate,
|
||||||
hir_map: Steal::new(hir),
|
|
||||||
late_hir_map: AtomicCell::new(None),
|
|
||||||
definitions,
|
definitions,
|
||||||
def_path_hash_to_def_id,
|
def_path_hash_to_def_id,
|
||||||
queries: query::Queries::new(providers, extern_providers, on_disk_query_result_cache),
|
queries: query::Queries::new(providers, extern_providers, on_disk_query_result_cache),
|
||||||
|
@ -1462,7 +1462,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
|||||||
impl<'r, 'a, 'v, 'hir> intravisit::Visitor<'v> for ImplTraitLifetimeCollector<'r, 'a, 'hir> {
|
impl<'r, 'a, 'v, 'hir> intravisit::Visitor<'v> for ImplTraitLifetimeCollector<'r, 'a, 'hir> {
|
||||||
type Map = Map<'v>;
|
type Map = Map<'v>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> intravisit::NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> intravisit::NestedVisitorMap<Self::Map> {
|
||||||
intravisit::NestedVisitorMap::None
|
intravisit::NestedVisitorMap::None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ trait HirPrinterSupport<'hir>: pprust_hir::PpAnn {
|
|||||||
|
|
||||||
/// Provides a uniform interface for re-extracting a reference to an
|
/// Provides a uniform interface for re-extracting a reference to an
|
||||||
/// `hir_map::Map` from a value that now owns it.
|
/// `hir_map::Map` from a value that now owns it.
|
||||||
fn hir_map(&self) -> Option<&hir_map::Map<'hir>>;
|
fn hir_map(&self) -> Option<hir_map::Map<'hir>>;
|
||||||
|
|
||||||
/// Produces the pretty-print annotation object.
|
/// Produces the pretty-print annotation object.
|
||||||
///
|
///
|
||||||
@ -142,8 +142,8 @@ impl<'hir> HirPrinterSupport<'hir> for NoAnn<'hir> {
|
|||||||
self.sess
|
self.sess
|
||||||
}
|
}
|
||||||
|
|
||||||
fn hir_map(&self) -> Option<&hir_map::Map<'hir>> {
|
fn hir_map(&self) -> Option<hir_map::Map<'hir>> {
|
||||||
self.tcx.map(|tcx| *tcx.hir())
|
self.tcx.map(|tcx| tcx.hir())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn pp_ann(&self) -> &dyn pprust_hir::PpAnn {
|
fn pp_ann(&self) -> &dyn pprust_hir::PpAnn {
|
||||||
@ -155,7 +155,7 @@ impl<'hir> pprust::PpAnn for NoAnn<'hir> {}
|
|||||||
impl<'hir> pprust_hir::PpAnn for NoAnn<'hir> {
|
impl<'hir> pprust_hir::PpAnn for NoAnn<'hir> {
|
||||||
fn nested(&self, state: &mut pprust_hir::State<'_>, nested: pprust_hir::Nested) {
|
fn nested(&self, state: &mut pprust_hir::State<'_>, nested: pprust_hir::Nested) {
|
||||||
if let Some(tcx) = self.tcx {
|
if let Some(tcx) = self.tcx {
|
||||||
pprust_hir::PpAnn::nested(*tcx.hir(), state, nested)
|
pprust_hir::PpAnn::nested(&tcx.hir(), state, nested)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -216,8 +216,8 @@ impl<'hir> HirPrinterSupport<'hir> for IdentifiedAnnotation<'hir> {
|
|||||||
self.sess
|
self.sess
|
||||||
}
|
}
|
||||||
|
|
||||||
fn hir_map(&self) -> Option<&hir_map::Map<'hir>> {
|
fn hir_map(&self) -> Option<hir_map::Map<'hir>> {
|
||||||
self.tcx.map(|tcx| *tcx.hir())
|
self.tcx.map(|tcx| tcx.hir())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn pp_ann(&self) -> &dyn pprust_hir::PpAnn {
|
fn pp_ann(&self) -> &dyn pprust_hir::PpAnn {
|
||||||
@ -228,7 +228,7 @@ impl<'hir> HirPrinterSupport<'hir> for IdentifiedAnnotation<'hir> {
|
|||||||
impl<'hir> pprust_hir::PpAnn for IdentifiedAnnotation<'hir> {
|
impl<'hir> pprust_hir::PpAnn for IdentifiedAnnotation<'hir> {
|
||||||
fn nested(&self, state: &mut pprust_hir::State<'_>, nested: pprust_hir::Nested) {
|
fn nested(&self, state: &mut pprust_hir::State<'_>, nested: pprust_hir::Nested) {
|
||||||
if let Some(ref tcx) = self.tcx {
|
if let Some(ref tcx) = self.tcx {
|
||||||
pprust_hir::PpAnn::nested(*tcx.hir(), state, nested)
|
pprust_hir::PpAnn::nested(&tcx.hir(), state, nested)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn pre(&self, s: &mut pprust_hir::State<'_>, node: pprust_hir::AnnNode<'_>) {
|
fn pre(&self, s: &mut pprust_hir::State<'_>, node: pprust_hir::AnnNode<'_>) {
|
||||||
@ -315,8 +315,8 @@ impl<'b, 'tcx> HirPrinterSupport<'tcx> for TypedAnnotation<'b, 'tcx> {
|
|||||||
&self.tcx.sess
|
&self.tcx.sess
|
||||||
}
|
}
|
||||||
|
|
||||||
fn hir_map(&self) -> Option<&hir_map::Map<'tcx>> {
|
fn hir_map(&self) -> Option<hir_map::Map<'tcx>> {
|
||||||
Some(&self.tcx.hir())
|
Some(self.tcx.hir())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn pp_ann(&self) -> &dyn pprust_hir::PpAnn {
|
fn pp_ann(&self) -> &dyn pprust_hir::PpAnn {
|
||||||
@ -334,7 +334,7 @@ impl<'a, 'tcx> pprust_hir::PpAnn for TypedAnnotation<'a, 'tcx> {
|
|||||||
if let pprust_hir::Nested::Body(id) = nested {
|
if let pprust_hir::Nested::Body(id) = nested {
|
||||||
self.tables.set(self.tcx.body_tables(id));
|
self.tables.set(self.tcx.body_tables(id));
|
||||||
}
|
}
|
||||||
pprust_hir::PpAnn::nested(*self.tcx.hir(), state, nested);
|
pprust_hir::PpAnn::nested(&self.tcx.hir(), state, nested);
|
||||||
self.tables.set(old_tables);
|
self.tables.set(old_tables);
|
||||||
}
|
}
|
||||||
fn pre(&self, s: &mut pprust_hir::State<'_>, node: pprust_hir::AnnNode<'_>) {
|
fn pre(&self, s: &mut pprust_hir::State<'_>, node: pprust_hir::AnnNode<'_>) {
|
||||||
|
@ -134,7 +134,7 @@ pub trait Map<'hir> {
|
|||||||
///
|
///
|
||||||
/// See the comments on `ItemLikeVisitor` for more details on the overall
|
/// See the comments on `ItemLikeVisitor` for more details on the overall
|
||||||
/// visit strategy.
|
/// visit strategy.
|
||||||
pub enum NestedVisitorMap<'this, M> {
|
pub enum NestedVisitorMap<M> {
|
||||||
/// Do not visit any nested things. When you add a new
|
/// Do not visit any nested things. When you add a new
|
||||||
/// "non-nested" thing, you will want to audit such uses to see if
|
/// "non-nested" thing, you will want to audit such uses to see if
|
||||||
/// they remain valid.
|
/// they remain valid.
|
||||||
@ -151,20 +151,20 @@ pub enum NestedVisitorMap<'this, M> {
|
|||||||
/// to use `visit_all_item_likes()` as an outer loop,
|
/// to use `visit_all_item_likes()` as an outer loop,
|
||||||
/// and to have the visitor that visits the contents of each item
|
/// and to have the visitor that visits the contents of each item
|
||||||
/// using this setting.
|
/// using this setting.
|
||||||
OnlyBodies(&'this M),
|
OnlyBodies(M),
|
||||||
|
|
||||||
/// Visits all nested things, including item-likes.
|
/// Visits all nested things, including item-likes.
|
||||||
///
|
///
|
||||||
/// **This is an unusual choice.** It is used when you want to
|
/// **This is an unusual choice.** It is used when you want to
|
||||||
/// process everything within their lexical context. Typically you
|
/// process everything within their lexical context. Typically you
|
||||||
/// kick off the visit by doing `walk_krate()`.
|
/// kick off the visit by doing `walk_krate()`.
|
||||||
All(&'this M),
|
All(M),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'this, M> NestedVisitorMap<'this, M> {
|
impl<M> NestedVisitorMap<M> {
|
||||||
/// Returns the map to use for an "intra item-like" thing (if any).
|
/// Returns the map to use for an "intra item-like" thing (if any).
|
||||||
/// E.g., function body.
|
/// E.g., function body.
|
||||||
fn intra(self) -> Option<&'this M> {
|
fn intra(self) -> Option<M> {
|
||||||
match self {
|
match self {
|
||||||
NestedVisitorMap::None => None,
|
NestedVisitorMap::None => None,
|
||||||
NestedVisitorMap::OnlyBodies(map) => Some(map),
|
NestedVisitorMap::OnlyBodies(map) => Some(map),
|
||||||
@ -174,7 +174,7 @@ impl<'this, M> NestedVisitorMap<'this, M> {
|
|||||||
|
|
||||||
/// Returns the map to use for an "item-like" thing (if any).
|
/// Returns the map to use for an "item-like" thing (if any).
|
||||||
/// E.g., item, impl-item.
|
/// E.g., item, impl-item.
|
||||||
fn inter(self) -> Option<&'this M> {
|
fn inter(self) -> Option<M> {
|
||||||
match self {
|
match self {
|
||||||
NestedVisitorMap::None => None,
|
NestedVisitorMap::None => None,
|
||||||
NestedVisitorMap::OnlyBodies(_) => None,
|
NestedVisitorMap::OnlyBodies(_) => None,
|
||||||
@ -221,7 +221,7 @@ pub trait Visitor<'v>: Sized {
|
|||||||
/// `panic!()`. This way, if a new `visit_nested_XXX` variant is
|
/// `panic!()`. This way, if a new `visit_nested_XXX` variant is
|
||||||
/// added in the future, we will see the panic in your code and
|
/// added in the future, we will see the panic in your code and
|
||||||
/// fix it appropriately.
|
/// fix it appropriately.
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map>;
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map>;
|
||||||
|
|
||||||
/// Invoked when a nested item is encountered. By default does
|
/// Invoked when a nested item is encountered. By default does
|
||||||
/// nothing unless you override `nested_visit_map` to return other than
|
/// nothing unless you override `nested_visit_map` to return other than
|
||||||
|
@ -162,8 +162,8 @@ impl IfThisChanged<'tcx> {
|
|||||||
impl Visitor<'tcx> for IfThisChanged<'tcx> {
|
impl Visitor<'tcx> for IfThisChanged<'tcx> {
|
||||||
type Map = Map<'tcx>;
|
type Map = Map<'tcx>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::OnlyBodies(&self.tcx.hir())
|
NestedVisitorMap::OnlyBodies(self.tcx.hir())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
|
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
|
||||||
|
@ -547,8 +547,8 @@ impl FindAllAttrs<'tcx> {
|
|||||||
impl intravisit::Visitor<'tcx> for FindAllAttrs<'tcx> {
|
impl intravisit::Visitor<'tcx> for FindAllAttrs<'tcx> {
|
||||||
type Map = Map<'tcx>;
|
type Map = Map<'tcx>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> intravisit::NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> intravisit::NestedVisitorMap<Self::Map> {
|
||||||
intravisit::NestedVisitorMap::All(&self.tcx.hir())
|
intravisit::NestedVisitorMap::All(self.tcx.hir())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_attribute(&mut self, attr: &'tcx Attribute) {
|
fn visit_attribute(&mut self, attr: &'tcx Attribute) {
|
||||||
|
@ -16,7 +16,7 @@ use std::borrow::Cow;
|
|||||||
struct FindLocalByTypeVisitor<'a, 'tcx> {
|
struct FindLocalByTypeVisitor<'a, 'tcx> {
|
||||||
infcx: &'a InferCtxt<'a, 'tcx>,
|
infcx: &'a InferCtxt<'a, 'tcx>,
|
||||||
target_ty: Ty<'tcx>,
|
target_ty: Ty<'tcx>,
|
||||||
hir_map: &'a Map<'tcx>,
|
hir_map: Map<'tcx>,
|
||||||
found_local_pattern: Option<&'tcx Pat<'tcx>>,
|
found_local_pattern: Option<&'tcx Pat<'tcx>>,
|
||||||
found_arg_pattern: Option<&'tcx Pat<'tcx>>,
|
found_arg_pattern: Option<&'tcx Pat<'tcx>>,
|
||||||
found_ty: Option<Ty<'tcx>>,
|
found_ty: Option<Ty<'tcx>>,
|
||||||
@ -25,7 +25,7 @@ struct FindLocalByTypeVisitor<'a, 'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'tcx> FindLocalByTypeVisitor<'a, 'tcx> {
|
impl<'a, 'tcx> FindLocalByTypeVisitor<'a, 'tcx> {
|
||||||
fn new(infcx: &'a InferCtxt<'a, 'tcx>, target_ty: Ty<'tcx>, hir_map: &'a Map<'tcx>) -> Self {
|
fn new(infcx: &'a InferCtxt<'a, 'tcx>, target_ty: Ty<'tcx>, hir_map: Map<'tcx>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
infcx,
|
infcx,
|
||||||
target_ty,
|
target_ty,
|
||||||
@ -69,8 +69,8 @@ impl<'a, 'tcx> FindLocalByTypeVisitor<'a, 'tcx> {
|
|||||||
impl<'a, 'tcx> Visitor<'tcx> for FindLocalByTypeVisitor<'a, 'tcx> {
|
impl<'a, 'tcx> Visitor<'tcx> for FindLocalByTypeVisitor<'a, 'tcx> {
|
||||||
type Map = Map<'tcx>;
|
type Map = Map<'tcx>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::OnlyBodies(&self.hir_map)
|
NestedVisitorMap::OnlyBodies(self.hir_map)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_local(&mut self, local: &'tcx Local<'tcx>) {
|
fn visit_local(&mut self, local: &'tcx Local<'tcx>) {
|
||||||
@ -223,7 +223,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
|||||||
let ty = self.resolve_vars_if_possible(&ty);
|
let ty = self.resolve_vars_if_possible(&ty);
|
||||||
let (name, name_sp, descr, parent_name, parent_descr) = self.extract_type_name(&ty, None);
|
let (name, name_sp, descr, parent_name, parent_descr) = self.extract_type_name(&ty, None);
|
||||||
|
|
||||||
let mut local_visitor = FindLocalByTypeVisitor::new(&self, ty, &self.tcx.hir());
|
let mut local_visitor = FindLocalByTypeVisitor::new(&self, ty, self.tcx.hir());
|
||||||
let ty_to_string = |ty: Ty<'tcx>| -> String {
|
let ty_to_string = |ty: Ty<'tcx>| -> String {
|
||||||
let mut s = String::new();
|
let mut s = String::new();
|
||||||
let mut printer = ty::print::FmtPrinter::new(self.tcx, &mut s, Namespace::TypeNS);
|
let mut printer = ty::print::FmtPrinter::new(self.tcx, &mut s, Namespace::TypeNS);
|
||||||
|
@ -93,8 +93,8 @@ struct FindNestedTypeVisitor<'tcx> {
|
|||||||
impl Visitor<'tcx> for FindNestedTypeVisitor<'tcx> {
|
impl Visitor<'tcx> for FindNestedTypeVisitor<'tcx> {
|
||||||
type Map = Map<'tcx>;
|
type Map = Map<'tcx>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::OnlyBodies(&self.tcx.hir())
|
NestedVisitorMap::OnlyBodies(self.tcx.hir())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_ty(&mut self, arg: &'tcx hir::Ty<'tcx>) {
|
fn visit_ty(&mut self, arg: &'tcx hir::Ty<'tcx>) {
|
||||||
@ -212,8 +212,8 @@ struct TyPathVisitor<'tcx> {
|
|||||||
impl Visitor<'tcx> for TyPathVisitor<'tcx> {
|
impl Visitor<'tcx> for TyPathVisitor<'tcx> {
|
||||||
type Map = Map<'tcx>;
|
type Map = Map<'tcx>;
|
||||||
|
|
||||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, Map<'tcx>> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Map<'tcx>> {
|
||||||
NestedVisitorMap::OnlyBodies(&self.tcx.hir())
|
NestedVisitorMap::OnlyBodies(self.tcx.hir())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_lifetime(&mut self, lifetime: &hir::Lifetime) {
|
fn visit_lifetime(&mut self, lifetime: &hir::Lifetime) {
|
||||||
|
@ -5,7 +5,7 @@ use crate::util;
|
|||||||
use log::{info, log_enabled, warn};
|
use log::{info, log_enabled, warn};
|
||||||
use rustc::arena::Arena;
|
use rustc::arena::Arena;
|
||||||
use rustc::dep_graph::DepGraph;
|
use rustc::dep_graph::DepGraph;
|
||||||
use rustc::hir::map;
|
use rustc::hir::map::Definitions;
|
||||||
use rustc::lint;
|
use rustc::lint;
|
||||||
use rustc::middle;
|
use rustc::middle;
|
||||||
use rustc::middle::cstore::{CrateStore, MetadataLoader, MetadataLoaderDyn};
|
use rustc::middle::cstore::{CrateStore, MetadataLoader, MetadataLoaderDyn};
|
||||||
@ -713,10 +713,7 @@ pub fn create_global_ctxt<'tcx>(
|
|||||||
arena: &'tcx WorkerLocal<Arena<'tcx>>,
|
arena: &'tcx WorkerLocal<Arena<'tcx>>,
|
||||||
) -> QueryContext<'tcx> {
|
) -> QueryContext<'tcx> {
|
||||||
let sess = &compiler.session();
|
let sess = &compiler.session();
|
||||||
let defs = mem::take(&mut resolver_outputs.definitions);
|
let defs: &'tcx Definitions = arena.alloc(mem::take(&mut resolver_outputs.definitions));
|
||||||
|
|
||||||
// Construct the HIR map.
|
|
||||||
let hir_map = map::map_crate(sess, &**arena, &*resolver_outputs.cstore, krate, defs);
|
|
||||||
|
|
||||||
let query_result_on_disk_cache = rustc_incremental::load_query_result_cache(sess);
|
let query_result_on_disk_cache = rustc_incremental::load_query_result_cache(sess);
|
||||||
|
|
||||||
@ -742,7 +739,8 @@ pub fn create_global_ctxt<'tcx>(
|
|||||||
extern_providers,
|
extern_providers,
|
||||||
arena,
|
arena,
|
||||||
resolver_outputs,
|
resolver_outputs,
|
||||||
hir_map,
|
krate,
|
||||||
|
defs,
|
||||||
dep_graph,
|
dep_graph,
|
||||||
query_result_on_disk_cache,
|
query_result_on_disk_cache,
|
||||||
&crate_name,
|
&crate_name,
|
||||||
|
@ -1073,7 +1073,7 @@ impl TypeAliasBounds {
|
|||||||
impl<'a, 'db, 'v> Visitor<'v> for WalkAssocTypes<'a, 'db> {
|
impl<'a, 'db, 'v> Visitor<'v> for WalkAssocTypes<'a, 'db> {
|
||||||
type Map = Map<'v>;
|
type Map = Map<'v>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> intravisit::NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> intravisit::NestedVisitorMap<Self::Map> {
|
||||||
intravisit::NestedVisitorMap::None
|
intravisit::NestedVisitorMap::None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,8 +99,8 @@ impl<'a, 'tcx, T: LateLintPass<'a, 'tcx>> hir_visit::Visitor<'tcx>
|
|||||||
/// Because lints are scoped lexically, we want to walk nested
|
/// Because lints are scoped lexically, we want to walk nested
|
||||||
/// items in the context of the outer item, so enable
|
/// items in the context of the outer item, so enable
|
||||||
/// deep-walking.
|
/// deep-walking.
|
||||||
fn nested_visit_map(&mut self) -> hir_visit::NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> hir_visit::NestedVisitorMap<Self::Map> {
|
||||||
hir_visit::NestedVisitorMap::All(&self.context.tcx.hir())
|
hir_visit::NestedVisitorMap::All(self.context.tcx.hir())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_nested_body(&mut self, body: hir::BodyId) {
|
fn visit_nested_body(&mut self, body: hir::BodyId) {
|
||||||
|
@ -438,8 +438,8 @@ impl LintLevelMapBuilder<'_, '_> {
|
|||||||
impl<'tcx> intravisit::Visitor<'tcx> for LintLevelMapBuilder<'_, 'tcx> {
|
impl<'tcx> intravisit::Visitor<'tcx> for LintLevelMapBuilder<'_, 'tcx> {
|
||||||
type Map = Map<'tcx>;
|
type Map = Map<'tcx>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> intravisit::NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> intravisit::NestedVisitorMap<Self::Map> {
|
||||||
intravisit::NestedVisitorMap::All(&self.tcx.hir())
|
intravisit::NestedVisitorMap::All(self.tcx.hir())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_param(&mut self, param: &'tcx hir::Param<'tcx>) {
|
fn visit_param(&mut self, param: &'tcx hir::Param<'tcx>) {
|
||||||
|
@ -1505,8 +1505,8 @@ impl EncodeContext<'tcx> {
|
|||||||
impl Visitor<'tcx> for EncodeContext<'tcx> {
|
impl Visitor<'tcx> for EncodeContext<'tcx> {
|
||||||
type Map = Map<'tcx>;
|
type Map = Map<'tcx>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::OnlyBodies(&self.tcx.hir())
|
NestedVisitorMap::OnlyBodies(self.tcx.hir())
|
||||||
}
|
}
|
||||||
fn visit_expr(&mut self, ex: &'tcx hir::Expr<'tcx>) {
|
fn visit_expr(&mut self, ex: &'tcx hir::Expr<'tcx>) {
|
||||||
intravisit::walk_expr(self, ex);
|
intravisit::walk_expr(self, ex);
|
||||||
|
@ -453,7 +453,7 @@ struct UnusedUnsafeVisitor<'a> {
|
|||||||
impl<'a, 'tcx> intravisit::Visitor<'tcx> for UnusedUnsafeVisitor<'a> {
|
impl<'a, 'tcx> intravisit::Visitor<'tcx> for UnusedUnsafeVisitor<'a> {
|
||||||
type Map = Map<'tcx>;
|
type Map = Map<'tcx>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> intravisit::NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> intravisit::NestedVisitorMap<Self::Map> {
|
||||||
intravisit::NestedVisitorMap::None
|
intravisit::NestedVisitorMap::None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ fn mir_keys(tcx: TyCtxt<'_>, krate: CrateNum) -> &DefIdSet {
|
|||||||
intravisit::walk_struct_def(self, v)
|
intravisit::walk_struct_def(self, v)
|
||||||
}
|
}
|
||||||
type Map = Map<'tcx>;
|
type Map = Map<'tcx>;
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::None
|
NestedVisitorMap::None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ struct MatchVisitor<'a, 'tcx> {
|
|||||||
impl<'tcx> Visitor<'tcx> for MatchVisitor<'_, 'tcx> {
|
impl<'tcx> Visitor<'tcx> for MatchVisitor<'_, 'tcx> {
|
||||||
type Map = Map<'tcx>;
|
type Map = Map<'tcx>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::None
|
NestedVisitorMap::None
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -752,7 +752,7 @@ fn check_legality_of_bindings_in_at_patterns(cx: &MatchVisitor<'_, '_>, pat: &Pa
|
|||||||
impl<'v> Visitor<'v> for AtBindingPatternVisitor<'_, '_, '_> {
|
impl<'v> Visitor<'v> for AtBindingPatternVisitor<'_, '_, '_> {
|
||||||
type Map = Map<'v>;
|
type Map = Map<'v>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::None
|
NestedVisitorMap::None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -418,8 +418,8 @@ impl CheckAttrVisitor<'tcx> {
|
|||||||
impl Visitor<'tcx> for CheckAttrVisitor<'tcx> {
|
impl Visitor<'tcx> for CheckAttrVisitor<'tcx> {
|
||||||
type Map = Map<'tcx>;
|
type Map = Map<'tcx>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::OnlyBodies(&self.tcx.hir())
|
NestedVisitorMap::OnlyBodies(self.tcx.hir())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_item(&mut self, item: &'tcx Item<'tcx>) {
|
fn visit_item(&mut self, item: &'tcx Item<'tcx>) {
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
//! through, but errors for structured control flow in a `const` should be emitted here.
|
//! through, but errors for structured control flow in a `const` should be emitted here.
|
||||||
|
|
||||||
use rustc::hir::map::Map;
|
use rustc::hir::map::Map;
|
||||||
use rustc::hir::Hir;
|
|
||||||
use rustc::session::config::nightly_options;
|
use rustc::session::config::nightly_options;
|
||||||
use rustc::session::parse::feature_err;
|
use rustc::session::parse::feature_err;
|
||||||
use rustc::ty::query::Providers;
|
use rustc::ty::query::Providers;
|
||||||
@ -75,7 +74,7 @@ enum ConstKind {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ConstKind {
|
impl ConstKind {
|
||||||
fn for_body(body: &hir::Body<'_>, hir_map: Hir<'_>) -> Option<Self> {
|
fn for_body(body: &hir::Body<'_>, hir_map: Map<'_>) -> Option<Self> {
|
||||||
let is_const_fn = |id| hir_map.fn_sig_by_hir_id(id).unwrap().header.is_const();
|
let is_const_fn = |id| hir_map.fn_sig_by_hir_id(id).unwrap().header.is_const();
|
||||||
|
|
||||||
let owner = hir_map.body_owner(body.id());
|
let owner = hir_map.body_owner(body.id());
|
||||||
@ -202,8 +201,8 @@ impl<'tcx> CheckConstVisitor<'tcx> {
|
|||||||
impl<'tcx> Visitor<'tcx> for CheckConstVisitor<'tcx> {
|
impl<'tcx> Visitor<'tcx> for CheckConstVisitor<'tcx> {
|
||||||
type Map = Map<'tcx>;
|
type Map = Map<'tcx>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> intravisit::NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> intravisit::NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::OnlyBodies(&self.tcx.hir())
|
NestedVisitorMap::OnlyBodies(self.tcx.hir())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_anon_const(&mut self, anon: &'tcx hir::AnonConst) {
|
fn visit_anon_const(&mut self, anon: &'tcx hir::AnonConst) {
|
||||||
|
@ -212,7 +212,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
|
|||||||
impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> {
|
impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> {
|
||||||
type Map = Map<'tcx>;
|
type Map = Map<'tcx>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> intravisit::NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> intravisit::NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::None
|
NestedVisitorMap::None
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -568,8 +568,8 @@ impl Visitor<'tcx> for DeadVisitor<'tcx> {
|
|||||||
/// on inner functions when the outer function is already getting
|
/// on inner functions when the outer function is already getting
|
||||||
/// an error. We could do this also by checking the parents, but
|
/// an error. We could do this also by checking the parents, but
|
||||||
/// this is how the code is setup and it seems harmless enough.
|
/// this is how the code is setup and it seems harmless enough.
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::All(&self.tcx.hir())
|
NestedVisitorMap::All(self.tcx.hir())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
|
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use rustc::hir::Hir;
|
use rustc::hir::map::Map;
|
||||||
use rustc::session::config::EntryFnType;
|
use rustc::session::config::EntryFnType;
|
||||||
use rustc::session::{config, Session};
|
use rustc::session::{config, Session};
|
||||||
use rustc::ty::query::Providers;
|
use rustc::ty::query::Providers;
|
||||||
@ -15,7 +15,7 @@ use rustc_span::{Span, DUMMY_SP};
|
|||||||
struct EntryContext<'a, 'tcx> {
|
struct EntryContext<'a, 'tcx> {
|
||||||
session: &'a Session,
|
session: &'a Session,
|
||||||
|
|
||||||
map: Hir<'tcx>,
|
map: Map<'tcx>,
|
||||||
|
|
||||||
/// The top-level function called `main`.
|
/// The top-level function called `main`.
|
||||||
main_fn: Option<(HirId, Span)>,
|
main_fn: Option<(HirId, Span)>,
|
||||||
|
@ -95,7 +95,7 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
|
|||||||
|
|
||||||
type Map = Map<'v>;
|
type Map = Map<'v>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> hir_visit::NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> hir_visit::NestedVisitorMap<Self::Map> {
|
||||||
panic!("visit_nested_xxx must be manually implemented in this visitor")
|
panic!("visit_nested_xxx must be manually implemented in this visitor")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ impl ExprVisitor<'tcx> {
|
|||||||
impl Visitor<'tcx> for ItemVisitor<'tcx> {
|
impl Visitor<'tcx> for ItemVisitor<'tcx> {
|
||||||
type Map = Map<'tcx>;
|
type Map = Map<'tcx>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::None
|
NestedVisitorMap::None
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ impl Visitor<'tcx> for ItemVisitor<'tcx> {
|
|||||||
impl Visitor<'tcx> for ExprVisitor<'tcx> {
|
impl Visitor<'tcx> for ExprVisitor<'tcx> {
|
||||||
type Map = Map<'tcx>;
|
type Map = Map<'tcx>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::None
|
NestedVisitorMap::None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,8 +114,8 @@ impl LibFeatureCollector<'tcx> {
|
|||||||
impl Visitor<'tcx> for LibFeatureCollector<'tcx> {
|
impl Visitor<'tcx> for LibFeatureCollector<'tcx> {
|
||||||
type Map = Map<'tcx>;
|
type Map = Map<'tcx>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::All(&self.tcx.hir())
|
NestedVisitorMap::All(self.tcx.hir())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_attribute(&mut self, attr: &'tcx Attribute) {
|
fn visit_attribute(&mut self, attr: &'tcx Attribute) {
|
||||||
|
@ -156,8 +156,8 @@ fn live_node_kind_to_string(lnk: LiveNodeKind, tcx: TyCtxt<'_>) -> String {
|
|||||||
impl<'tcx> Visitor<'tcx> for IrMaps<'tcx> {
|
impl<'tcx> Visitor<'tcx> for IrMaps<'tcx> {
|
||||||
type Map = Map<'tcx>;
|
type Map = Map<'tcx>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::OnlyBodies(&self.tcx.hir())
|
NestedVisitorMap::OnlyBodies(self.tcx.hir())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_fn(
|
fn visit_fn(
|
||||||
@ -1361,7 +1361,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
|
|||||||
impl<'a, 'tcx> Visitor<'tcx> for Liveness<'a, 'tcx> {
|
impl<'a, 'tcx> Visitor<'tcx> for Liveness<'a, 'tcx> {
|
||||||
type Map = Map<'tcx>;
|
type Map = Map<'tcx>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::None
|
NestedVisitorMap::None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,15 +24,14 @@ enum Context {
|
|||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
struct CheckLoopVisitor<'a, 'hir> {
|
struct CheckLoopVisitor<'a, 'hir> {
|
||||||
sess: &'a Session,
|
sess: &'a Session,
|
||||||
hir_map: &'a Map<'hir>,
|
hir_map: Map<'hir>,
|
||||||
cx: Context,
|
cx: Context,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_mod_loops(tcx: TyCtxt<'_>, module_def_id: DefId) {
|
fn check_mod_loops(tcx: TyCtxt<'_>, module_def_id: DefId) {
|
||||||
tcx.hir().visit_item_likes_in_module(
|
tcx.hir().visit_item_likes_in_module(
|
||||||
module_def_id,
|
module_def_id,
|
||||||
&mut CheckLoopVisitor { sess: &tcx.sess, hir_map: &tcx.hir(), cx: Normal }
|
&mut CheckLoopVisitor { sess: &tcx.sess, hir_map: tcx.hir(), cx: Normal }.as_deep_visitor(),
|
||||||
.as_deep_visitor(),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,8 +42,8 @@ pub(crate) fn provide(providers: &mut Providers<'_>) {
|
|||||||
impl<'a, 'hir> Visitor<'hir> for CheckLoopVisitor<'a, 'hir> {
|
impl<'a, 'hir> Visitor<'hir> for CheckLoopVisitor<'a, 'hir> {
|
||||||
type Map = Map<'hir>;
|
type Map = Map<'hir>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::OnlyBodies(&self.hir_map)
|
NestedVisitorMap::OnlyBodies(self.hir_map)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_anon_const(&mut self, c: &'hir hir::AnonConst) {
|
fn visit_anon_const(&mut self, c: &'hir hir::AnonConst) {
|
||||||
|
@ -85,7 +85,7 @@ struct ReachableContext<'a, 'tcx> {
|
|||||||
impl<'a, 'tcx> Visitor<'tcx> for ReachableContext<'a, 'tcx> {
|
impl<'a, 'tcx> Visitor<'tcx> for ReachableContext<'a, 'tcx> {
|
||||||
type Map = Map<'tcx>;
|
type Map = Map<'tcx>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::None
|
NestedVisitorMap::None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -698,7 +698,7 @@ impl<'tcx> RegionResolutionVisitor<'tcx> {
|
|||||||
impl<'tcx> Visitor<'tcx> for RegionResolutionVisitor<'tcx> {
|
impl<'tcx> Visitor<'tcx> for RegionResolutionVisitor<'tcx> {
|
||||||
type Map = Map<'tcx>;
|
type Map = Map<'tcx>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::None
|
NestedVisitorMap::None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,8 +259,8 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
|
|||||||
/// deep-walking.
|
/// deep-walking.
|
||||||
type Map = Map<'tcx>;
|
type Map = Map<'tcx>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::All(&self.tcx.hir())
|
NestedVisitorMap::All(self.tcx.hir())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_item(&mut self, i: &'tcx Item<'tcx>) {
|
fn visit_item(&mut self, i: &'tcx Item<'tcx>) {
|
||||||
@ -350,8 +350,8 @@ impl<'a, 'tcx> MissingStabilityAnnotations<'a, 'tcx> {
|
|||||||
impl<'a, 'tcx> Visitor<'tcx> for MissingStabilityAnnotations<'a, 'tcx> {
|
impl<'a, 'tcx> Visitor<'tcx> for MissingStabilityAnnotations<'a, 'tcx> {
|
||||||
type Map = Map<'tcx>;
|
type Map = Map<'tcx>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::OnlyBodies(&self.tcx.hir())
|
NestedVisitorMap::OnlyBodies(self.tcx.hir())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_item(&mut self, i: &'tcx Item<'tcx>) {
|
fn visit_item(&mut self, i: &'tcx Item<'tcx>) {
|
||||||
@ -492,8 +492,8 @@ impl Visitor<'tcx> for Checker<'tcx> {
|
|||||||
/// Because stability levels are scoped lexically, we want to walk
|
/// Because stability levels are scoped lexically, we want to walk
|
||||||
/// nested items in the context of the outer item, so enable
|
/// nested items in the context of the outer item, so enable
|
||||||
/// deep-walking.
|
/// deep-walking.
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::OnlyBodies(&self.tcx.hir())
|
NestedVisitorMap::OnlyBodies(self.tcx.hir())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
|
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
|
||||||
|
@ -46,7 +46,7 @@ struct LocalCollector {
|
|||||||
impl Visitor<'tcx> for LocalCollector {
|
impl Visitor<'tcx> for LocalCollector {
|
||||||
type Map = Map<'tcx>;
|
type Map = Map<'tcx>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::None
|
NestedVisitorMap::None
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ impl CaptureCollector<'_, '_> {
|
|||||||
impl Visitor<'tcx> for CaptureCollector<'a, 'tcx> {
|
impl Visitor<'tcx> for CaptureCollector<'a, 'tcx> {
|
||||||
type Map = Map<'tcx>;
|
type Map = Map<'tcx>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::None
|
NestedVisitorMap::None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ impl<'a, 'tcx> Context<'a, 'tcx> {
|
|||||||
impl<'a, 'tcx, 'v> Visitor<'v> for Context<'a, 'tcx> {
|
impl<'a, 'tcx, 'v> Visitor<'v> for Context<'a, 'tcx> {
|
||||||
type Map = Map<'v>;
|
type Map = Map<'v>;
|
||||||
|
|
||||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, Map<'v>> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Map<'v>> {
|
||||||
NestedVisitorMap::None
|
NestedVisitorMap::None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -373,8 +373,8 @@ struct PubRestrictedVisitor<'tcx> {
|
|||||||
impl Visitor<'tcx> for PubRestrictedVisitor<'tcx> {
|
impl Visitor<'tcx> for PubRestrictedVisitor<'tcx> {
|
||||||
type Map = Map<'tcx>;
|
type Map = Map<'tcx>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::All(&self.tcx.hir())
|
NestedVisitorMap::All(self.tcx.hir())
|
||||||
}
|
}
|
||||||
fn visit_vis(&mut self, vis: &'tcx hir::Visibility<'tcx>) {
|
fn visit_vis(&mut self, vis: &'tcx hir::Visibility<'tcx>) {
|
||||||
self.has_pub_restricted = self.has_pub_restricted || vis.node.is_pub_restricted();
|
self.has_pub_restricted = self.has_pub_restricted || vis.node.is_pub_restricted();
|
||||||
@ -678,8 +678,8 @@ impl Visitor<'tcx> for EmbargoVisitor<'tcx> {
|
|||||||
|
|
||||||
/// We want to visit items in the context of their containing
|
/// We want to visit items in the context of their containing
|
||||||
/// module and so forth, so supply a crate for doing a deep walk.
|
/// module and so forth, so supply a crate for doing a deep walk.
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::All(&self.tcx.hir())
|
NestedVisitorMap::All(self.tcx.hir())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
|
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
|
||||||
@ -1049,8 +1049,8 @@ impl<'a, 'tcx> Visitor<'tcx> for NamePrivacyVisitor<'a, 'tcx> {
|
|||||||
|
|
||||||
/// We want to visit items in the context of their containing
|
/// We want to visit items in the context of their containing
|
||||||
/// module and so forth, so supply a crate for doing a deep walk.
|
/// module and so forth, so supply a crate for doing a deep walk.
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::All(&self.tcx.hir())
|
NestedVisitorMap::All(self.tcx.hir())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_mod(&mut self, _m: &'tcx hir::Mod<'tcx>, _s: Span, _n: hir::HirId) {
|
fn visit_mod(&mut self, _m: &'tcx hir::Mod<'tcx>, _s: Span, _n: hir::HirId) {
|
||||||
@ -1191,8 +1191,8 @@ impl<'a, 'tcx> Visitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> {
|
|||||||
|
|
||||||
/// We want to visit items in the context of their containing
|
/// We want to visit items in the context of their containing
|
||||||
/// module and so forth, so supply a crate for doing a deep walk.
|
/// module and so forth, so supply a crate for doing a deep walk.
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::All(&self.tcx.hir())
|
NestedVisitorMap::All(self.tcx.hir())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_mod(&mut self, _m: &'tcx hir::Mod<'tcx>, _s: Span, _n: hir::HirId) {
|
fn visit_mod(&mut self, _m: &'tcx hir::Mod<'tcx>, _s: Span, _n: hir::HirId) {
|
||||||
@ -1449,7 +1449,7 @@ impl<'a, 'tcx> ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> {
|
|||||||
impl<'a, 'b, 'tcx, 'v> Visitor<'v> for ObsoleteCheckTypeForPrivatenessVisitor<'a, 'b, 'tcx> {
|
impl<'a, 'b, 'tcx, 'v> Visitor<'v> for ObsoleteCheckTypeForPrivatenessVisitor<'a, 'b, 'tcx> {
|
||||||
type Map = Map<'v>;
|
type Map = Map<'v>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::None
|
NestedVisitorMap::None
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1479,8 +1479,8 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> {
|
|||||||
|
|
||||||
/// We want to visit items in the context of their containing
|
/// We want to visit items in the context of their containing
|
||||||
/// module and so forth, so supply a crate for doing a deep walk.
|
/// module and so forth, so supply a crate for doing a deep walk.
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::All(&self.tcx.hir())
|
NestedVisitorMap::All(self.tcx.hir())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
|
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
|
||||||
@ -1925,8 +1925,8 @@ impl<'a, 'tcx> PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> {
|
|||||||
impl<'a, 'tcx> Visitor<'tcx> for PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> {
|
impl<'a, 'tcx> Visitor<'tcx> for PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> {
|
||||||
type Map = Map<'tcx>;
|
type Map = Map<'tcx>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::OnlyBodies(&self.tcx.hir())
|
NestedVisitorMap::OnlyBodies(self.tcx.hir())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
|
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
|
||||||
|
@ -367,8 +367,8 @@ fn sub_items_have_self_param(node: &hir::ItemKind<'_>) -> bool {
|
|||||||
impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
|
impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
|
||||||
type Map = Map<'tcx>;
|
type Map = Map<'tcx>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::All(&self.tcx.hir())
|
NestedVisitorMap::All(self.tcx.hir())
|
||||||
}
|
}
|
||||||
|
|
||||||
// We want to nest trait/impl items in their parent, but nothing else.
|
// We want to nest trait/impl items in their parent, but nothing else.
|
||||||
@ -1125,7 +1125,7 @@ fn extract_labels(ctxt: &mut LifetimeContext<'_, '_>, body: &hir::Body<'_>) {
|
|||||||
impl<'v, 'a, 'tcx> Visitor<'v> for GatherLabels<'a, 'tcx> {
|
impl<'v, 'a, 'tcx> Visitor<'v> for GatherLabels<'a, 'tcx> {
|
||||||
type Map = Map<'v>;
|
type Map = Map<'v>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::None
|
NestedVisitorMap::None
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2174,7 +2174,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
|
|||||||
impl<'a> Visitor<'a> for SelfVisitor<'a> {
|
impl<'a> Visitor<'a> for SelfVisitor<'a> {
|
||||||
type Map = Map<'a>;
|
type Map = Map<'a>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::None
|
NestedVisitorMap::None
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2265,7 +2265,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
|
|||||||
impl<'v, 'a> Visitor<'v> for GatherLifetimes<'a> {
|
impl<'v, 'a> Visitor<'v> for GatherLifetimes<'a> {
|
||||||
type Map = Map<'v>;
|
type Map = Map<'v>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::None
|
NestedVisitorMap::None
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2854,7 +2854,7 @@ fn insert_late_bound_lifetimes(
|
|||||||
impl<'v> Visitor<'v> for ConstrainedCollector {
|
impl<'v> Visitor<'v> for ConstrainedCollector {
|
||||||
type Map = Map<'v>;
|
type Map = Map<'v>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::None
|
NestedVisitorMap::None
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2897,7 +2897,7 @@ fn insert_late_bound_lifetimes(
|
|||||||
impl<'v> Visitor<'v> for AllCollector {
|
impl<'v> Visitor<'v> for AllCollector {
|
||||||
type Map = Map<'v>;
|
type Map = Map<'v>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::None
|
NestedVisitorMap::None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1569,7 +1569,7 @@ struct ReturnsVisitor<'v> {
|
|||||||
impl<'v> Visitor<'v> for ReturnsVisitor<'v> {
|
impl<'v> Visitor<'v> for ReturnsVisitor<'v> {
|
||||||
type Map = rustc::hir::map::Map<'v>;
|
type Map = rustc::hir::map::Map<'v>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> hir::intravisit::NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> hir::intravisit::NestedVisitorMap<Self::Map> {
|
||||||
hir::intravisit::NestedVisitorMap::None
|
hir::intravisit::NestedVisitorMap::None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -603,8 +603,8 @@ impl ClauseDumper<'tcx> {
|
|||||||
impl Visitor<'tcx> for ClauseDumper<'tcx> {
|
impl Visitor<'tcx> for ClauseDumper<'tcx> {
|
||||||
type Map = Map<'tcx>;
|
type Map = Map<'tcx>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::OnlyBodies(&self.tcx.hir())
|
NestedVisitorMap::OnlyBodies(self.tcx.hir())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
|
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
|
||||||
|
@ -273,8 +273,7 @@ fn original_crate_name(tcx: TyCtxt<'_>, crate_num: CrateNum) -> Symbol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn crate_hash(tcx: TyCtxt<'_>, crate_num: CrateNum) -> Svh {
|
fn crate_hash(tcx: TyCtxt<'_>, crate_num: CrateNum) -> Svh {
|
||||||
assert_eq!(crate_num, LOCAL_CRATE);
|
tcx.index_hir(crate_num).crate_hash
|
||||||
tcx.hir().crate_hash
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn instance_def_size_estimate<'tcx>(
|
fn instance_def_size_estimate<'tcx>(
|
||||||
|
@ -893,7 +893,7 @@ fn compare_synthetic_generics<'tcx>(
|
|||||||
type Map = Map<'v>;
|
type Map = Map<'v>;
|
||||||
fn nested_visit_map(
|
fn nested_visit_map(
|
||||||
&mut self,
|
&mut self,
|
||||||
) -> intravisit::NestedVisitorMap<'_, Self::Map>
|
) -> intravisit::NestedVisitorMap<Self::Map>
|
||||||
{
|
{
|
||||||
intravisit::NestedVisitorMap::None
|
intravisit::NestedVisitorMap::None
|
||||||
}
|
}
|
||||||
|
@ -211,7 +211,7 @@ pub fn resolve_interior<'a, 'tcx>(
|
|||||||
impl<'a, 'tcx> Visitor<'tcx> for InteriorVisitor<'a, 'tcx> {
|
impl<'a, 'tcx> Visitor<'tcx> for InteriorVisitor<'a, 'tcx> {
|
||||||
type Map = Map<'tcx>;
|
type Map = Map<'tcx>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::None
|
NestedVisitorMap::None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1349,7 +1349,7 @@ impl intravisit::Visitor<'tcx> for UsePlacementFinder<'tcx> {
|
|||||||
|
|
||||||
type Map = Map<'tcx>;
|
type Map = Map<'tcx>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> intravisit::NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> intravisit::NestedVisitorMap<Self::Map> {
|
||||||
intravisit::NestedVisitorMap::None
|
intravisit::NestedVisitorMap::None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1179,7 +1179,7 @@ impl<'a, 'tcx> GatherLocalsVisitor<'a, 'tcx> {
|
|||||||
impl<'a, 'tcx> Visitor<'tcx> for GatherLocalsVisitor<'a, 'tcx> {
|
impl<'a, 'tcx> Visitor<'tcx> for GatherLocalsVisitor<'a, 'tcx> {
|
||||||
type Map = Map<'tcx>;
|
type Map = Map<'tcx>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::None
|
NestedVisitorMap::None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -419,7 +419,7 @@ impl<'a, 'tcx> Visitor<'tcx> for RegionCtxt<'a, 'tcx> {
|
|||||||
|
|
||||||
type Map = Map<'tcx>;
|
type Map = Map<'tcx>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::None
|
NestedVisitorMap::None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ struct InferBorrowKindVisitor<'a, 'tcx> {
|
|||||||
impl<'a, 'tcx> Visitor<'tcx> for InferBorrowKindVisitor<'a, 'tcx> {
|
impl<'a, 'tcx> Visitor<'tcx> for InferBorrowKindVisitor<'a, 'tcx> {
|
||||||
type Map = Map<'tcx>;
|
type Map = Map<'tcx>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::None
|
NestedVisitorMap::None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,7 +246,7 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
|
|||||||
impl<'cx, 'tcx> Visitor<'tcx> for WritebackCx<'cx, 'tcx> {
|
impl<'cx, 'tcx> Visitor<'tcx> for WritebackCx<'cx, 'tcx> {
|
||||||
type Map = Map<'tcx>;
|
type Map = Map<'tcx>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::None
|
NestedVisitorMap::None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ crate struct PlaceholderHirTyCollector(crate Vec<Span>);
|
|||||||
impl<'v> Visitor<'v> for PlaceholderHirTyCollector {
|
impl<'v> Visitor<'v> for PlaceholderHirTyCollector {
|
||||||
type Map = Map<'v>;
|
type Map = Map<'v>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::None
|
NestedVisitorMap::None
|
||||||
}
|
}
|
||||||
fn visit_ty(&mut self, t: &'v hir::Ty<'v>) {
|
fn visit_ty(&mut self, t: &'v hir::Ty<'v>) {
|
||||||
@ -201,8 +201,8 @@ fn reject_placeholder_type_signatures_in_item(tcx: TyCtxt<'tcx>, item: &'tcx hir
|
|||||||
impl Visitor<'tcx> for CollectItemTypesVisitor<'tcx> {
|
impl Visitor<'tcx> for CollectItemTypesVisitor<'tcx> {
|
||||||
type Map = Map<'tcx>;
|
type Map = Map<'tcx>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::OnlyBodies(&self.tcx.hir())
|
NestedVisitorMap::OnlyBodies(self.tcx.hir())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
|
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
|
||||||
@ -1047,7 +1047,7 @@ fn has_late_bound_regions<'tcx>(tcx: TyCtxt<'tcx>, node: Node<'tcx>) -> Option<S
|
|||||||
impl Visitor<'tcx> for LateBoundRegionsDetector<'tcx> {
|
impl Visitor<'tcx> for LateBoundRegionsDetector<'tcx> {
|
||||||
type Map = Map<'tcx>;
|
type Map = Map<'tcx>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
|
||||||
NestedVisitorMap::None
|
NestedVisitorMap::None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -529,8 +529,8 @@ fn find_opaque_ty_constraints(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> {
|
|||||||
impl<'tcx> intravisit::Visitor<'tcx> for ConstraintLocator<'tcx> {
|
impl<'tcx> intravisit::Visitor<'tcx> for ConstraintLocator<'tcx> {
|
||||||
type Map = Map<'tcx>;
|
type Map = Map<'tcx>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> intravisit::NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> intravisit::NestedVisitorMap<Self::Map> {
|
||||||
intravisit::NestedVisitorMap::All(&self.tcx.hir())
|
intravisit::NestedVisitorMap::All(self.tcx.hir())
|
||||||
}
|
}
|
||||||
fn visit_expr(&mut self, ex: &'tcx Expr<'tcx>) {
|
fn visit_expr(&mut self, ex: &'tcx Expr<'tcx>) {
|
||||||
if let hir::ExprKind::Closure(..) = ex.kind {
|
if let hir::ExprKind::Closure(..) = ex.kind {
|
||||||
|
@ -107,7 +107,7 @@ pub fn run(options: Options) -> i32 {
|
|||||||
let mut hir_collector = HirCollector {
|
let mut hir_collector = HirCollector {
|
||||||
sess: compiler.session(),
|
sess: compiler.session(),
|
||||||
collector: &mut collector,
|
collector: &mut collector,
|
||||||
map: *tcx.hir(),
|
map: tcx.hir(),
|
||||||
codes: ErrorCodes::from(
|
codes: ErrorCodes::from(
|
||||||
compiler.session().opts.unstable_features.is_nightly_build(),
|
compiler.session().opts.unstable_features.is_nightly_build(),
|
||||||
),
|
),
|
||||||
@ -856,7 +856,7 @@ impl Tester for Collector {
|
|||||||
struct HirCollector<'a, 'hir> {
|
struct HirCollector<'a, 'hir> {
|
||||||
sess: &'a session::Session,
|
sess: &'a session::Session,
|
||||||
collector: &'a mut Collector,
|
collector: &'a mut Collector,
|
||||||
map: &'a Map<'hir>,
|
map: Map<'hir>,
|
||||||
codes: ErrorCodes,
|
codes: ErrorCodes,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -904,8 +904,8 @@ impl<'a, 'hir> HirCollector<'a, 'hir> {
|
|||||||
impl<'a, 'hir> intravisit::Visitor<'hir> for HirCollector<'a, 'hir> {
|
impl<'a, 'hir> intravisit::Visitor<'hir> for HirCollector<'a, 'hir> {
|
||||||
type Map = Map<'hir>;
|
type Map = Map<'hir>;
|
||||||
|
|
||||||
fn nested_visit_map(&mut self) -> intravisit::NestedVisitorMap<'_, Self::Map> {
|
fn nested_visit_map(&mut self) -> intravisit::NestedVisitorMap<Self::Map> {
|
||||||
intravisit::NestedVisitorMap::All(&self.map)
|
intravisit::NestedVisitorMap::All(self.map)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_item(&mut self, item: &'hir hir::Item) {
|
fn visit_item(&mut self, item: &'hir hir::Item) {
|
||||||
|
Loading…
Reference in New Issue
Block a user