about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2025-03-17 15:20:22 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2025-03-17 15:20:22 +1100
commit87457f6e00bf53119db370ba5ee9b95def9a617b (patch)
treea062763054992b98f662bfbc605ff727e15942c7
parent8b87fefd76665236a304d3c0998e1021710ce1b0 (diff)
downloadrust-87457f6e00bf53119db370ba5ee9b95def9a617b.tar.gz
rust-87457f6e00bf53119db370ba5ee9b95def9a617b.zip
Inline and remove `LoweringContext::new_named_lifetime_with_res`.
It has a single call site.
-rw-r--r--compiler/rustc_ast_lowering/src/lib.rs18
1 files changed, 4 insertions, 14 deletions
diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs
index df671cf4b86..0de2dd2ba20 100644
--- a/compiler/rustc_ast_lowering/src/lib.rs
+++ b/compiler/rustc_ast_lowering/src/lib.rs
@@ -1774,12 +1774,13 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
     }
 
     #[instrument(level = "debug", skip(self))]
-    fn new_named_lifetime_with_res(
+    fn new_named_lifetime(
         &mut self,
         id: NodeId,
+        new_id: NodeId,
         ident: Ident,
-        res: LifetimeRes,
     ) -> &'hir hir::Lifetime {
+        let res = self.resolver.get_lifetime_res(id).unwrap_or(LifetimeRes::Error);
         let res = match res {
             LifetimeRes::Param { param, .. } => hir::LifetimeName::Param(param),
             LifetimeRes::Fresh { param, .. } => {
@@ -1797,23 +1798,12 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
 
         debug!(?res);
         self.arena.alloc(hir::Lifetime {
-            hir_id: self.lower_node_id(id),
+            hir_id: self.lower_node_id(new_id),
             ident: self.lower_ident(ident),
             res,
         })
     }
 
-    #[instrument(level = "debug", skip(self))]
-    fn new_named_lifetime(
-        &mut self,
-        id: NodeId,
-        new_id: NodeId,
-        ident: Ident,
-    ) -> &'hir hir::Lifetime {
-        let res = self.resolver.get_lifetime_res(id).unwrap_or(LifetimeRes::Error);
-        self.new_named_lifetime_with_res(new_id, ident, res)
-    }
-
     fn lower_generic_params_mut(
         &mut self,
         params: &[GenericParam],