Moved a struct only need by util into util

This commit is contained in:
Nicholas-Baron 2020-09-19 01:20:05 -07:00
parent 6fd80e35e0
commit 3e770645aa
2 changed files with 14 additions and 14 deletions

View File

@ -99,7 +99,6 @@ use rustc_hir as hir;
use rustc_hir::def::{CtorOf, DefKind, Res};
use rustc_hir::def_id::{DefId, DefIdMap, LocalDefId, LOCAL_CRATE};
use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor};
use rustc_hir::itemlikevisit::ItemLikeVisitor;
use rustc_hir::lang_items::LangItem;
use rustc_hir::{ExprKind, GenericArg, HirIdMap, ItemKind, Node, PatKind, QPath};
use rustc_index::bit_set::BitSet;
@ -695,18 +694,6 @@ impl Inherited<'a, 'tcx> {
}
}
struct CheckItemTypesVisitor<'tcx> {
tcx: TyCtxt<'tcx>,
}
impl ItemLikeVisitor<'tcx> for CheckItemTypesVisitor<'tcx> {
fn visit_item(&mut self, i: &'tcx hir::Item<'tcx>) {
check_item_type(self.tcx, i);
}
fn visit_trait_item(&mut self, _: &'tcx hir::TraitItem<'tcx>) {}
fn visit_impl_item(&mut self, _: &'tcx hir::ImplItem<'tcx>) {}
}
pub fn check_wf_new(tcx: TyCtxt<'_>) {
let visit = wfcheck::CheckTypeWellFormedVisitor::new(tcx);
tcx.hir().krate().par_visit_all_item_likes(&visit);

View File

@ -1,9 +1,10 @@
use rustc_hir as hir;
use rustc_hir::def_id::{CrateNum, LocalDefId, LOCAL_CRATE};
use rustc_hir::itemlikevisit::ItemLikeVisitor;
use std::cell::{Ref, RefCell, RefMut};
use super::wfcheck;
use crate::check::CheckItemTypesVisitor;
use crate::{ty, TyCtxt};
/// A wrapper for `InferCtxt`'s `in_progress_typeck_results` field.
@ -32,6 +33,18 @@ impl<'a, 'tcx> MaybeInProgressTables<'a, 'tcx> {
}
}
struct CheckItemTypesVisitor<'tcx> {
tcx: TyCtxt<'tcx>,
}
impl ItemLikeVisitor<'tcx> for CheckItemTypesVisitor<'tcx> {
fn visit_item(&mut self, i: &'tcx hir::Item<'tcx>) {
super::check_item_type(self.tcx, i);
}
fn visit_trait_item(&mut self, _: &'tcx hir::TraitItem<'tcx>) {}
fn visit_impl_item(&mut self, _: &'tcx hir::ImplItem<'tcx>) {}
}
pub(super) fn check_mod_item_types(tcx: TyCtxt<'_>, module_def_id: LocalDefId) {
tcx.hir().visit_item_likes_in_module(module_def_id, &mut CheckItemTypesVisitor { tcx });
}