rustc_privacy: visit Ty instead of HIR types in EmbargoVisitor.
This commit is contained in:
parent
9aaf26e7aa
commit
36d33d6b71
8 changed files with 227 additions and 167 deletions
|
|
@ -298,7 +298,8 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
|
|||
// Nothing to recurse on for these
|
||||
ast_map::NodeForeignItem(_) |
|
||||
ast_map::NodeVariant(_) |
|
||||
ast_map::NodeStructCtor(_) => {}
|
||||
ast_map::NodeStructCtor(_) |
|
||||
ast_map::NodeTy(_) => {}
|
||||
_ => {
|
||||
bug!("found unexpected thingy in worklist: {}",
|
||||
self.tcx.map.node_to_string(search_item))
|
||||
|
|
|
|||
|
|
@ -191,6 +191,10 @@ pub trait TypeVisitor<'tcx> : Sized {
|
|||
t.super_visit_with(self)
|
||||
}
|
||||
|
||||
fn visit_trait_ref(&mut self, trait_ref: ty::TraitRef<'tcx>) -> bool {
|
||||
trait_ref.super_visit_with(self)
|
||||
}
|
||||
|
||||
fn visit_region(&mut self, r: &'tcx ty::Region) -> bool {
|
||||
r.super_visit_with(self)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1280,8 +1280,13 @@ impl<'a, 'tcx> ParameterEnvironment<'tcx> {
|
|||
}
|
||||
Some(ast_map::NodeExpr(expr)) => {
|
||||
// This is a convenience to allow closures to work.
|
||||
if let hir::ExprClosure(..) = expr.node {
|
||||
ParameterEnvironment::for_item(tcx, tcx.map.get_parent(id))
|
||||
if let hir::ExprClosure(.., ref body, _) = expr.node {
|
||||
let def_id = tcx.map.local_def_id(id);
|
||||
let base_def_id = tcx.closure_base_def_id(def_id);
|
||||
tcx.construct_parameter_environment(
|
||||
expr.span,
|
||||
base_def_id,
|
||||
tcx.region_maps.call_site_extent(id, body.id))
|
||||
} else {
|
||||
tcx.empty_parameter_environment()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -599,6 +599,10 @@ impl<'tcx> TypeFoldable<'tcx> for ty::TraitRef<'tcx> {
|
|||
fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool {
|
||||
self.substs.visit_with(visitor)
|
||||
}
|
||||
|
||||
fn visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool {
|
||||
visitor.visit_trait_ref(*self)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> TypeFoldable<'tcx> for ty::ExistentialTraitRef<'tcx> {
|
||||
|
|
@ -766,6 +770,36 @@ impl<'tcx> TypeFoldable<'tcx> for ty::RegionParameterDef<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'tcx> TypeFoldable<'tcx> for ty::Generics<'tcx> {
|
||||
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self {
|
||||
ty::Generics {
|
||||
parent: self.parent,
|
||||
parent_regions: self.parent_regions,
|
||||
parent_types: self.parent_types,
|
||||
regions: self.regions.fold_with(folder),
|
||||
types: self.types.fold_with(folder),
|
||||
has_self: self.has_self,
|
||||
}
|
||||
}
|
||||
|
||||
fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool {
|
||||
self.regions.visit_with(visitor) || self.types.visit_with(visitor)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> TypeFoldable<'tcx> for ty::GenericPredicates<'tcx> {
|
||||
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self {
|
||||
ty::GenericPredicates {
|
||||
parent: self.parent,
|
||||
predicates: self.predicates.fold_with(folder),
|
||||
}
|
||||
}
|
||||
|
||||
fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool {
|
||||
self.predicates.visit_with(visitor)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> TypeFoldable<'tcx> for ty::Predicate<'tcx> {
|
||||
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self {
|
||||
match *self {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue