Skip to content

Commit

Permalink
move generics_of call outside of iter
Browse files Browse the repository at this point in the history
  • Loading branch information
BoxyUwU committed May 24, 2024
1 parent 796cb80 commit ed8e436
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion compiler/rustc_lint/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1998,6 +1998,8 @@ impl ExplicitOutlivesRequirements {
) -> Vec<(usize, Span)> {
use rustc_middle::middle::resolve_bound_vars::ResolvedArg;

let item_generics = tcx.generics_of(item);

bounds
.iter()
.enumerate()
Expand All @@ -2009,7 +2011,7 @@ impl ExplicitOutlivesRequirements {
let is_inferred = match tcx.named_bound_var(lifetime.hir_id) {
Some(ResolvedArg::EarlyBound(def_id)) => inferred_outlives
.iter()
.any(|r| matches!(**r, ty::ReEarlyParam(ebr) if { tcx.generics_of(item).region_param(ebr, tcx).def_id == def_id })),
.any(|r| matches!(**r, ty::ReEarlyParam(ebr) if { item_generics.region_param(ebr, tcx).def_id == def_id })),
_ => false,
};

Expand Down

0 comments on commit ed8e436

Please sign in to comment.