Skip to content

Commit 454784a

Browse files
committedNov 27, 2022
Auto merge of #104048 - cjgillot:split-lifetime, r=compiler-errors
Separate lifetime ident from lifetime resolution in HIR Drive-by: change how suggested generic args are computed. Fixes #103815 I recommend reviewing commit-by-commit.
2 parents df04d28 + 5de9c84 commit 454784a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+583
-437
lines changed
 

‎compiler/rustc_ast_lowering/src/expr.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
605605
output,
606606
c_variadic: false,
607607
implicit_self: hir::ImplicitSelfKind::None,
608+
lifetime_elision_allowed: false,
608609
});
609610

610611
// Lower the argument pattern/ident. The ident is used again in the `.await` lowering.
@@ -917,7 +918,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
917918

918919
let bound_generic_params = self.lower_lifetime_binder(closure_id, generic_params);
919920
// Lower outside new scope to preserve `is_in_loop_condition`.
920-
let fn_decl = self.lower_fn_decl(decl, None, fn_decl_span, FnDeclKind::Closure, None);
921+
let fn_decl = self.lower_fn_decl(decl, closure_id, fn_decl_span, FnDeclKind::Closure, None);
921922

922923
let c = self.arena.alloc(hir::Closure {
923924
def_id: self.local_def_id(closure_id),
@@ -1027,7 +1028,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
10271028
// have to conserve the state of being inside a loop condition for the
10281029
// closure argument types.
10291030
let fn_decl =
1030-
self.lower_fn_decl(&outer_decl, None, fn_decl_span, FnDeclKind::Closure, None);
1031+
self.lower_fn_decl(&outer_decl, closure_id, fn_decl_span, FnDeclKind::Closure, None);
10311032

10321033
let c = self.arena.alloc(hir::Closure {
10331034
def_id: self.local_def_id(closure_id),

‎compiler/rustc_ast_lowering/src/index.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
303303
}
304304

305305
fn visit_lifetime(&mut self, lifetime: &'hir Lifetime) {
306-
self.insert(lifetime.span, lifetime.hir_id, Node::Lifetime(lifetime));
306+
self.insert(lifetime.ident.span, lifetime.hir_id, Node::Lifetime(lifetime));
307307
}
308308

309309
fn visit_variant(&mut self, v: &'hir Variant<'hir>) {

0 commit comments

Comments
 (0)