Avoid double lowering of lifetime identifiers.

`LoweringContext::new_named_lifetime` lowers the `ident` passed in. Both
of its call sites *also* lower `ident` *before* passing it in. I.e. both
call sites cause the ident to be lowered twice. This commit removes the
lowering at the two call sites, so the ident is only lowered once.
This commit is contained in:
Nicholas Nethercote
2025-03-17 15:23:05 +11:00
parent 87457f6e00
commit fe4d14495f
2 changed files with 1 additions and 3 deletions
-1
View File
@@ -1757,7 +1757,6 @@ pub(super) fn lower_generic_bound_predicate(
})
}
GenericParamKind::Lifetime => {
let ident = self.lower_ident(ident);
let lt_id = self.next_node_id();
let lifetime = self.new_named_lifetime(id, lt_id, ident);
hir::WherePredicateKind::RegionPredicate(hir::WhereRegionPredicate {
+1 -2
View File
@@ -1769,8 +1769,7 @@ fn lower_param_bound(
}
fn lower_lifetime(&mut self, l: &Lifetime) -> &'hir hir::Lifetime {
let ident = self.lower_ident(l.ident);
self.new_named_lifetime(l.id, l.id, ident)
self.new_named_lifetime(l.id, l.id, l.ident)
}
#[instrument(level = "debug", skip(self))]