Skip to content

Commit 701a149

Browse files
committed
Auto merge of #139256 - zetanumbers:ensure_ok_predicates_of, r=<try>
Try use `tcx.ensure_ok` for some predicates_of queries.
2 parents ae9173d + c76ca6d commit 701a149

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

compiler/rustc_hir_analysis/src/collect.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -726,14 +726,14 @@ fn lower_item(tcx: TyCtxt<'_>, item_id: hir::ItemId) {
726726
hir::ItemKind::Trait(..) => {
727727
tcx.ensure_ok().generics_of(def_id);
728728
tcx.ensure_ok().trait_def(def_id);
729-
tcx.at(it.span).explicit_super_predicates_of(def_id);
729+
tcx.ensure_ok().explicit_super_predicates_of(def_id);
730730
tcx.ensure_ok().predicates_of(def_id);
731731
tcx.ensure_ok().associated_items(def_id);
732732
}
733733
hir::ItemKind::TraitAlias(..) => {
734734
tcx.ensure_ok().generics_of(def_id);
735-
tcx.at(it.span).explicit_implied_predicates_of(def_id);
736-
tcx.at(it.span).explicit_super_predicates_of(def_id);
735+
tcx.ensure_ok().explicit_implied_predicates_of(def_id);
736+
tcx.ensure_ok().explicit_super_predicates_of(def_id);
737737
tcx.ensure_ok().predicates_of(def_id);
738738
}
739739
hir::ItemKind::Struct(_, struct_def, _) | hir::ItemKind::Union(_, struct_def, _) => {

compiler/rustc_hir_analysis/src/collect/predicates_of.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ pub(super) fn implied_predicates_with_filter<'tcx>(
645645
if let ty::ClauseKind::Trait(bound) = pred.kind().skip_binder()
646646
&& bound.polarity == ty::PredicatePolarity::Positive
647647
{
648-
tcx.at(span).explicit_super_predicates_of(bound.def_id());
648+
tcx.ensure_ok().explicit_super_predicates_of(bound.def_id());
649649
}
650650
}
651651
}
@@ -655,7 +655,7 @@ pub(super) fn implied_predicates_with_filter<'tcx>(
655655
if let ty::ClauseKind::Trait(bound) = pred.kind().skip_binder()
656656
&& bound.polarity == ty::PredicatePolarity::Positive
657657
{
658-
tcx.at(span).explicit_implied_predicates_of(bound.def_id());
658+
tcx.ensure_ok().explicit_implied_predicates_of(bound.def_id());
659659
}
660660
}
661661
}

0 commit comments

Comments
 (0)