1
Fork 0

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`.
This commit is contained in:
Nicholas Nethercote 2025-03-17 15:47:33 +11:00
parent 6496d6943f
commit adf2bb75ea

View file

@ -1720,7 +1720,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
let bounds = self.lower_param_bounds(bounds, itctx); let bounds = self.lower_param_bounds(bounds, itctx);
let ident = self.lower_ident(ident);
let param_span = ident.span; let param_span = ident.span;
// Reconstruct the span of the entire predicate from the individual generic bounds. // 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 def_id = self.local_def_id(id).to_def_id();
let hir_id = self.next_id(); let hir_id = self.next_id();
let res = Res::Def(DefKind::TyParam, def_id); let res = Res::Def(DefKind::TyParam, def_id);
let ident = self.lower_ident(ident);
let ty_path = self.arena.alloc(hir::Path { let ty_path = self.arena.alloc(hir::Path {
span: param_span, span: param_span,
res, res,