From adf2bb75ea4643d061a1c0933c7f3c8ea8f86808 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Mon, 17 Mar 2025 15:47:33 +1100 Subject: [PATCH] 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`. --- compiler/rustc_ast_lowering/src/item.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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,