From c76ca6d38efc85eeac909a63a16ee610d8974412 Mon Sep 17 00:00:00 2001 From: Daria Sukhonina Date: Wed, 2 Apr 2025 16:46:40 +0300 Subject: [PATCH] Draft change for ensure_ok --- compiler/rustc_hir_analysis/src/collect.rs | 6 +++--- compiler/rustc_hir_analysis/src/collect/predicates_of.rs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/compiler/rustc_hir_analysis/src/collect.rs b/compiler/rustc_hir_analysis/src/collect.rs index 075abc3259449..c7da5c4f467f2 100644 --- a/compiler/rustc_hir_analysis/src/collect.rs +++ b/compiler/rustc_hir_analysis/src/collect.rs @@ -726,14 +726,14 @@ fn lower_item(tcx: TyCtxt<'_>, item_id: hir::ItemId) { hir::ItemKind::Trait(..) => { tcx.ensure_ok().generics_of(def_id); tcx.ensure_ok().trait_def(def_id); - tcx.at(it.span).explicit_super_predicates_of(def_id); + tcx.ensure_ok().explicit_super_predicates_of(def_id); tcx.ensure_ok().predicates_of(def_id); tcx.ensure_ok().associated_items(def_id); } hir::ItemKind::TraitAlias(..) => { tcx.ensure_ok().generics_of(def_id); - tcx.at(it.span).explicit_implied_predicates_of(def_id); - tcx.at(it.span).explicit_super_predicates_of(def_id); + tcx.ensure_ok().explicit_implied_predicates_of(def_id); + tcx.ensure_ok().explicit_super_predicates_of(def_id); tcx.ensure_ok().predicates_of(def_id); } hir::ItemKind::Struct(_, struct_def, _) | hir::ItemKind::Union(_, struct_def, _) => { diff --git a/compiler/rustc_hir_analysis/src/collect/predicates_of.rs b/compiler/rustc_hir_analysis/src/collect/predicates_of.rs index 4bd89861a9e5a..ab3d822198023 100644 --- a/compiler/rustc_hir_analysis/src/collect/predicates_of.rs +++ b/compiler/rustc_hir_analysis/src/collect/predicates_of.rs @@ -645,7 +645,7 @@ pub(super) fn implied_predicates_with_filter<'tcx>( if let ty::ClauseKind::Trait(bound) = pred.kind().skip_binder() && bound.polarity == ty::PredicatePolarity::Positive { - tcx.at(span).explicit_super_predicates_of(bound.def_id()); + tcx.ensure_ok().explicit_super_predicates_of(bound.def_id()); } } } @@ -655,7 +655,7 @@ pub(super) fn implied_predicates_with_filter<'tcx>( if let ty::ClauseKind::Trait(bound) = pred.kind().skip_binder() && bound.polarity == ty::PredicatePolarity::Positive { - tcx.at(span).explicit_implied_predicates_of(bound.def_id()); + tcx.ensure_ok().explicit_implied_predicates_of(bound.def_id()); } } }