From 3818fc02c4a55eb8cb12c90505bc88ae6cb983e8 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Sat, 9 Dec 2023 00:00:53 +0000 Subject: [PATCH 1/3] Lower constness span in host param --- compiler/rustc_ast_lowering/src/item.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler/rustc_ast_lowering/src/item.rs b/compiler/rustc_ast_lowering/src/item.rs index 9d1f2684c394d..ced267b8a3650 100644 --- a/compiler/rustc_ast_lowering/src/item.rs +++ b/compiler/rustc_ast_lowering/src/item.rs @@ -1385,6 +1385,7 @@ impl<'hir> LoweringContext<'_, 'hir> { let host_param_parts = if let Const::Yes(span) = constness && self.tcx.features().effects { + let span = self.lower_span(span); let param_node_id = self.next_node_id(); let hir_id = self.next_id(); let def_id = self.create_def( From 97de8fba56f762edea9c55f27207657aff065114 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Sat, 9 Dec 2023 00:02:34 +0000 Subject: [PATCH 2/3] Lower spans for opaque duplicated lifetimes, const infer vars --- compiler/rustc_ast_lowering/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index 753650f732410..dd52c5def54a1 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -1678,7 +1678,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { duplicated_lifetime_node_id, lifetime.ident.name, DefKind::LifetimeParam, - lifetime.ident.span, + self.lower_span(lifetime.ident.span), ); captured_to_synthesized_mapping.insert(old_def_id, duplicated_lifetime_def_id); // FIXME: Instead of doing this, we could move this whole loop @@ -1687,7 +1687,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { synthesized_lifetime_definitions.push(( duplicated_lifetime_node_id, duplicated_lifetime_def_id, - lifetime.ident, + self.lower_ident(lifetime.ident), )); // Now make an arg that we can use for the generic params of the opaque tykind. @@ -2252,7 +2252,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { match c.value.kind { ExprKind::Underscore => { if self.tcx.features().generic_arg_infer { - hir::ArrayLen::Infer(self.lower_node_id(c.id), c.value.span) + hir::ArrayLen::Infer(self.lower_node_id(c.id), self.lower_span(c.value.span)) } else { feature_err( &self.tcx.sess.parse_sess, From c980fae35cf07ed73ff52ff099c21999c1e91a15 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Sat, 9 Dec 2023 00:10:29 +0000 Subject: [PATCH 3/3] Lower some forgotten coroutine spans --- compiler/rustc_ast_lowering/src/expr.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_ast_lowering/src/expr.rs b/compiler/rustc_ast_lowering/src/expr.rs index c287c65ff3627..99691f43f9108 100644 --- a/compiler/rustc_ast_lowering/src/expr.rs +++ b/compiler/rustc_ast_lowering/src/expr.rs @@ -634,7 +634,7 @@ impl<'hir> LoweringContext<'_, 'hir> { // Resume argument type: `ResumeTy` let unstable_span = self.mark_span_with_reason( DesugaringKind::Async, - span, + self.lower_span(span), Some(self.allow_gen_future.clone()), ); let resume_ty = hir::QPath::LangItem(hir::LangItem::ResumeTy, unstable_span); @@ -766,7 +766,7 @@ impl<'hir> LoweringContext<'_, 'hir> { // Resume argument type: `ResumeTy` let unstable_span = self.mark_span_with_reason( DesugaringKind::Async, - span, + self.lower_span(span), Some(self.allow_gen_future.clone()), ); let resume_ty = hir::QPath::LangItem(hir::LangItem::ResumeTy, unstable_span);