Use an ItemLikeVisitor for CheckTypeWellFormedVisitor
This commit is contained in:
parent
2a4eeba70f
commit
eb8fb53425
2 changed files with 9 additions and 16 deletions
|
|
@ -695,7 +695,7 @@ impl<'a, 'tcx> ItemLikeVisitor<'tcx> for CheckItemTypesVisitor<'a, 'tcx> {
|
|||
pub fn check_wf_new<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Result<(), ErrorReported> {
|
||||
tcx.sess.track_errors(|| {
|
||||
let mut visit = wfcheck::CheckTypeWellFormedVisitor::new(tcx);
|
||||
tcx.hir().krate().visit_all_item_likes(&mut visit.as_deep_visitor());
|
||||
tcx.hir().krate().visit_all_item_likes(&mut visit);
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ use syntax::feature_gate::{self, GateIssue};
|
|||
use syntax_pos::Span;
|
||||
use errors::{DiagnosticBuilder, DiagnosticId};
|
||||
|
||||
use rustc::hir::intravisit::{self, Visitor, NestedVisitorMap};
|
||||
use rustc::hir::itemlikevisit::ItemLikeVisitor;
|
||||
use rustc::hir;
|
||||
|
||||
/// Helper type of a temporary returned by `.for_item(...)`.
|
||||
|
|
@ -1015,30 +1015,23 @@ impl<'a, 'gcx> CheckTypeWellFormedVisitor<'a, 'gcx> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx, 'v> Visitor<'v> for CheckTypeWellFormedVisitor<'a, 'tcx> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'v> {
|
||||
NestedVisitorMap::None
|
||||
}
|
||||
|
||||
fn visit_item(&mut self, i: &hir::Item) {
|
||||
impl<'a, 'tcx> ItemLikeVisitor<'tcx> for CheckTypeWellFormedVisitor<'a, 'tcx> {
|
||||
fn visit_item(&mut self, i: &'tcx hir::Item) {
|
||||
debug!("visit_item: {:?}", i);
|
||||
let def_id = self.tcx.hir().local_def_id(i.id);
|
||||
ty::query::queries::check_item_well_formed::ensure(self.tcx, def_id);
|
||||
intravisit::walk_item(self, i);
|
||||
self.tcx.ensure().check_item_well_formed(def_id);
|
||||
}
|
||||
|
||||
fn visit_trait_item(&mut self, trait_item: &'v hir::TraitItem) {
|
||||
fn visit_trait_item(&mut self, trait_item: &'tcx hir::TraitItem) {
|
||||
debug!("visit_trait_item: {:?}", trait_item);
|
||||
let def_id = self.tcx.hir().local_def_id(trait_item.id);
|
||||
ty::query::queries::check_trait_item_well_formed::ensure(self.tcx, def_id);
|
||||
intravisit::walk_trait_item(self, trait_item)
|
||||
self.tcx.ensure().check_trait_item_well_formed(def_id);
|
||||
}
|
||||
|
||||
fn visit_impl_item(&mut self, impl_item: &'v hir::ImplItem) {
|
||||
fn visit_impl_item(&mut self, impl_item: &'tcx hir::ImplItem) {
|
||||
debug!("visit_impl_item: {:?}", impl_item);
|
||||
let def_id = self.tcx.hir().local_def_id(impl_item.id);
|
||||
ty::query::queries::check_impl_item_well_formed::ensure(self.tcx, def_id);
|
||||
intravisit::walk_impl_item(self, impl_item)
|
||||
self.tcx.ensure().check_impl_item_well_formed(def_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue