Skip to content

Commit 604ffab

Browse files
committed
Avoid going through queries if a value of type AssocItem is already available
1 parent 42f28f9 commit 604ffab

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

Diff for: compiler/rustc_hir_analysis/src/astconv/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1601,7 +1601,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
16011601
tcx.associated_items(pred.def_id())
16021602
.in_definition_order()
16031603
.filter(|item| item.kind == ty::AssocKind::Type)
1604-
.filter(|item| tcx.opt_rpitit_info(item.def_id).is_none())
1604+
.filter(|item| item.opt_rpitit_info.is_none())
16051605
.map(|item| item.def_id),
16061606
);
16071607
}

Diff for: compiler/rustc_hir_analysis/src/check/compare_impl_item.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1216,7 +1216,7 @@ fn compare_number_of_generics<'tcx>(
12161216
// has mismatched type or const generic arguments, then the method that it's
12171217
// inheriting the generics from will also have mismatched arguments, and
12181218
// we'll report an error for that instead. Delay a bug for safety, though.
1219-
if tcx.opt_rpitit_info(trait_.def_id).is_some() {
1219+
if trait_.opt_rpitit_info.is_some() {
12201220
return Err(tcx.sess.delay_span_bug(
12211221
rustc_span::DUMMY_SP,
12221222
"errors comparing numbers of generics of trait/impl functions were not emitted",
@@ -2006,7 +2006,7 @@ pub(super) fn check_type_bounds<'tcx>(
20062006
// A synthetic impl Trait for RPITIT desugaring has no HIR, which we currently use to get the
20072007
// span for an impl's associated type. Instead, for these, use the def_span for the synthesized
20082008
// associated type.
2009-
let impl_ty_span = if tcx.opt_rpitit_info(impl_ty.def_id).is_some() {
2009+
let impl_ty_span = if impl_ty.opt_rpitit_info.is_some() {
20102010
tcx.def_span(impl_ty_def_id)
20112011
} else {
20122012
match tcx.hir().get_by_def_id(impl_ty_def_id) {

Diff for: compiler/rustc_hir_analysis/src/check/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ fn missing_items_err(
188188
full_impl_span: Span,
189189
) {
190190
let missing_items =
191-
missing_items.iter().filter(|trait_item| tcx.opt_rpitit_info(trait_item.def_id).is_none());
191+
missing_items.iter().filter(|trait_item| trait_item.opt_rpitit_info.is_none());
192192

193193
let missing_items_msg = missing_items
194194
.clone()

Diff for: compiler/rustc_trait_selection/src/traits/object_safety.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ fn object_safety_violations_for_trait(
161161
.in_definition_order()
162162
.filter(|item| item.kind == ty::AssocKind::Type)
163163
.filter(|item| !tcx.generics_of(item.def_id).params.is_empty())
164-
.filter(|item| tcx.opt_rpitit_info(item.def_id).is_none())
164+
.filter(|item| item.opt_rpitit_info.is_none())
165165
.map(|item| {
166166
let ident = item.ident(tcx);
167167
ObjectSafetyViolation::GAT(ident.name, ident.span)

0 commit comments

Comments
 (0)