Skip to content

Commit fe4d144

Browse files
committed
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.
1 parent 87457f6 commit fe4d144

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

compiler/rustc_ast_lowering/src/item.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1757,7 +1757,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
17571757
})
17581758
}
17591759
GenericParamKind::Lifetime => {
1760-
let ident = self.lower_ident(ident);
17611760
let lt_id = self.next_node_id();
17621761
let lifetime = self.new_named_lifetime(id, lt_id, ident);
17631762
hir::WherePredicateKind::RegionPredicate(hir::WhereRegionPredicate {

compiler/rustc_ast_lowering/src/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1769,8 +1769,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
17691769
}
17701770

17711771
fn lower_lifetime(&mut self, l: &Lifetime) -> &'hir hir::Lifetime {
1772-
let ident = self.lower_ident(l.ident);
1773-
self.new_named_lifetime(l.id, l.id, ident)
1772+
self.new_named_lifetime(l.id, l.id, l.ident)
17741773
}
17751774

17761775
#[instrument(level = "debug", skip(self))]

0 commit comments

Comments
 (0)