Avoid going through queries if a value of type AssocItem
is already available
This commit is contained in:
parent
42f28f9eb4
commit
604ffab063
@ -1601,7 +1601,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
tcx.associated_items(pred.def_id())
|
||||
.in_definition_order()
|
||||
.filter(|item| item.kind == ty::AssocKind::Type)
|
||||
.filter(|item| tcx.opt_rpitit_info(item.def_id).is_none())
|
||||
.filter(|item| item.opt_rpitit_info.is_none())
|
||||
.map(|item| item.def_id),
|
||||
);
|
||||
}
|
||||
|
@ -1216,7 +1216,7 @@ fn compare_number_of_generics<'tcx>(
|
||||
// has mismatched type or const generic arguments, then the method that it's
|
||||
// inheriting the generics from will also have mismatched arguments, and
|
||||
// we'll report an error for that instead. Delay a bug for safety, though.
|
||||
if tcx.opt_rpitit_info(trait_.def_id).is_some() {
|
||||
if trait_.opt_rpitit_info.is_some() {
|
||||
return Err(tcx.sess.delay_span_bug(
|
||||
rustc_span::DUMMY_SP,
|
||||
"errors comparing numbers of generics of trait/impl functions were not emitted",
|
||||
@ -2006,7 +2006,7 @@ pub(super) fn check_type_bounds<'tcx>(
|
||||
// A synthetic impl Trait for RPITIT desugaring has no HIR, which we currently use to get the
|
||||
// span for an impl's associated type. Instead, for these, use the def_span for the synthesized
|
||||
// associated type.
|
||||
let impl_ty_span = if tcx.opt_rpitit_info(impl_ty.def_id).is_some() {
|
||||
let impl_ty_span = if impl_ty.opt_rpitit_info.is_some() {
|
||||
tcx.def_span(impl_ty_def_id)
|
||||
} else {
|
||||
match tcx.hir().get_by_def_id(impl_ty_def_id) {
|
||||
|
@ -188,7 +188,7 @@ fn missing_items_err(
|
||||
full_impl_span: Span,
|
||||
) {
|
||||
let missing_items =
|
||||
missing_items.iter().filter(|trait_item| tcx.opt_rpitit_info(trait_item.def_id).is_none());
|
||||
missing_items.iter().filter(|trait_item| trait_item.opt_rpitit_info.is_none());
|
||||
|
||||
let missing_items_msg = missing_items
|
||||
.clone()
|
||||
|
@ -161,7 +161,7 @@ fn object_safety_violations_for_trait(
|
||||
.in_definition_order()
|
||||
.filter(|item| item.kind == ty::AssocKind::Type)
|
||||
.filter(|item| !tcx.generics_of(item.def_id).params.is_empty())
|
||||
.filter(|item| tcx.opt_rpitit_info(item.def_id).is_none())
|
||||
.filter(|item| item.opt_rpitit_info.is_none())
|
||||
.map(|item| {
|
||||
let ident = item.ident(tcx);
|
||||
ObjectSafetyViolation::GAT(ident.name, ident.span)
|
||||
|
Loading…
x
Reference in New Issue
Block a user