diff options
| author | Miguel Guarniz <mi9uel9@gmail.com> | 2022-04-29 11:57:01 -0400 |
|---|---|---|
| committer | Miguel Guarniz <mi9uel9@gmail.com> | 2022-05-06 12:11:04 -0400 |
| commit | 422dd3b8dc4b864020e0369d74ce6f0a919cb936 (patch) | |
| tree | d8c7fdbfbc0c9a7132eeb079a3895f8099f080a6 | |
| parent | f47f39b95fe1b80a4fd2e96819681c0faef93b47 (diff) | |
| download | rust-422dd3b8dc4b864020e0369d74ce6f0a919cb936.tar.gz rust-422dd3b8dc4b864020e0369d74ce6f0a919cb936.zip | |
use hir_module_items instead of visit_all_item_likes in check_mod_impl_wf query
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
| -rw-r--r-- | compiler/rustc_typeck/src/impl_wf_check.rs | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/compiler/rustc_typeck/src/impl_wf_check.rs b/compiler/rustc_typeck/src/impl_wf_check.rs index 8b376e26dee..281e0162d6f 100644 --- a/compiler/rustc_typeck/src/impl_wf_check.rs +++ b/compiler/rustc_typeck/src/impl_wf_check.rs @@ -14,6 +14,7 @@ use min_specialization::check_min_specialization; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_errors::struct_span_err; use rustc_hir as hir; +use rustc_hir::def::DefKind; use rustc_hir::def_id::LocalDefId; use rustc_hir::itemlikevisit::ItemLikeVisitor; use rustc_middle::ty::query::Providers; @@ -63,8 +64,19 @@ pub fn impl_wf_check(tcx: TyCtxt<'_>) { fn check_mod_impl_wf(tcx: TyCtxt<'_>, module_def_id: LocalDefId) { let min_specialization = tcx.features().min_specialization; - tcx.hir() - .visit_item_likes_in_module(module_def_id, &mut ImplWfCheck { tcx, min_specialization }); + let module = tcx.hir_module_items(module_def_id); + for id in module.items() { + if matches!(tcx.hir().def_kind(id.def_id), DefKind::Impl) { + let item = tcx.hir().item(id); + if let hir::ItemKind::Impl(ref impl_) = item.kind { + enforce_impl_params_are_constrained(tcx, item.def_id, impl_.items); + enforce_impl_items_are_distinct(tcx, impl_.items); + if min_specialization { + check_min_specialization(tcx, item.def_id.to_def_id(), item.span); + } + } + } + } } pub fn provide(providers: &mut Providers) { |
