about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2025-03-17 15:47:33 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2025-03-17 15:48:37 +1100
commitadf2bb75ea4643d061a1c0933c7f3c8ea8f86808 (patch)
treeca0bd1e36400e85a5d0f80f8b2d2aadf28bc3887 /compiler
parent6496d6943fbf152d54149797558dccb87434de31 (diff)
downloadrust-adf2bb75ea4643d061a1c0933c7f3c8ea8f86808.tar.gz
rust-adf2bb75ea4643d061a1c0933c7f3c8ea8f86808.zip
Avoid double lowering of generic identifiers.
`lower_generic_bound_predicate` calls `lower_ident`, and then passes the
lowered ident into `new_named_lifetime`, which lowers it again. This
commit avoids the first lowering. This requires adding a `lower_ident`
call on a path that doesn't involve `new_named_lifetime`.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_ast_lowering/src/item.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_ast_lowering/src/item.rs b/compiler/rustc_ast_lowering/src/item.rs
index c419ac988c9..3b2e8581c00 100644
--- a/compiler/rustc_ast_lowering/src/item.rs
+++ b/compiler/rustc_ast_lowering/src/item.rs
@@ -1720,7 +1720,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
 
         let bounds = self.lower_param_bounds(bounds, itctx);
 
-        let ident = self.lower_ident(ident);
         let param_span = ident.span;
 
         // Reconstruct the span of the entire predicate from the individual generic bounds.
@@ -1739,6 +1738,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
                 let def_id = self.local_def_id(id).to_def_id();
                 let hir_id = self.next_id();
                 let res = Res::Def(DefKind::TyParam, def_id);
+                let ident = self.lower_ident(ident);
                 let ty_path = self.arena.alloc(hir::Path {
                     span: param_span,
                     res,