Skip to content

Commit 200b67b

Browse files
committed
Auto merge of rust-lang#118766 - compiler-errors:lower-spans, r=<try>
Lower some forgotten spans I wrote a HIR visitor that visited all of the spans in the HIR, and made it ICE when we have a unlowered span. That led me to discover these unlowered spans.
2 parents 2d2f1b2 + c980fae commit 200b67b

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

compiler/rustc_ast_lowering/src/expr.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
634634
// Resume argument type: `ResumeTy`
635635
let unstable_span = self.mark_span_with_reason(
636636
DesugaringKind::Async,
637-
span,
637+
self.lower_span(span),
638638
Some(self.allow_gen_future.clone()),
639639
);
640640
let resume_ty = hir::QPath::LangItem(hir::LangItem::ResumeTy, unstable_span);
@@ -766,7 +766,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
766766
// Resume argument type: `ResumeTy`
767767
let unstable_span = self.mark_span_with_reason(
768768
DesugaringKind::Async,
769-
span,
769+
self.lower_span(span),
770770
Some(self.allow_gen_future.clone()),
771771
);
772772
let resume_ty = hir::QPath::LangItem(hir::LangItem::ResumeTy, unstable_span);

compiler/rustc_ast_lowering/src/item.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1385,6 +1385,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
13851385
let host_param_parts = if let Const::Yes(span) = constness
13861386
&& self.tcx.features().effects
13871387
{
1388+
let span = self.lower_span(span);
13881389
let param_node_id = self.next_node_id();
13891390
let hir_id = self.next_id();
13901391
let def_id = self.create_def(

compiler/rustc_ast_lowering/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1678,7 +1678,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
16781678
duplicated_lifetime_node_id,
16791679
lifetime.ident.name,
16801680
DefKind::LifetimeParam,
1681-
lifetime.ident.span,
1681+
self.lower_span(lifetime.ident.span),
16821682
);
16831683
captured_to_synthesized_mapping.insert(old_def_id, duplicated_lifetime_def_id);
16841684
// FIXME: Instead of doing this, we could move this whole loop
@@ -1687,7 +1687,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
16871687
synthesized_lifetime_definitions.push((
16881688
duplicated_lifetime_node_id,
16891689
duplicated_lifetime_def_id,
1690-
lifetime.ident,
1690+
self.lower_ident(lifetime.ident),
16911691
));
16921692

16931693
// 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> {
22522252
match c.value.kind {
22532253
ExprKind::Underscore => {
22542254
if self.tcx.features().generic_arg_infer {
2255-
hir::ArrayLen::Infer(self.lower_node_id(c.id), c.value.span)
2255+
hir::ArrayLen::Infer(self.lower_node_id(c.id), self.lower_span(c.value.span))
22562256
} else {
22572257
feature_err(
22582258
&self.tcx.sess.parse_sess,

0 commit comments

Comments
 (0)