about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorBoxy <supbscripter@gmail.com>2024-05-24 20:15:54 +0100
committerBoxy <supbscripter@gmail.com>2024-05-24 20:15:54 +0100
commited8e43691632645d7ca3cf0583a1a822d2eb3c48 (patch)
treedc99ac8d94216f4a7d08fc9c2f4b0b0a6c4fb695 /compiler
parent796cb8031d4b3a12bceb95c8b029e90fd5d4e568 (diff)
move generics_of call outside of iter
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_lint/src/builtin.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs
index 0129b8f842f..ba42eae3441 100644
--- a/compiler/rustc_lint/src/builtin.rs
+++ b/compiler/rustc_lint/src/builtin.rs
@@ -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()
@@ -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,
                 };