Rollup merge of #118766 - compiler-errors:lower-spans, r=spastorino

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.
This commit is contained in:
Guillaume Gomez 2023-12-09 14:05:11 +01:00 committed by GitHub
commit fd60c5a788
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 5 deletions

View File

@ -634,7 +634,7 @@ pub(super) fn make_async_expr(
// Resume argument type: `ResumeTy` // Resume argument type: `ResumeTy`
let unstable_span = self.mark_span_with_reason( let unstable_span = self.mark_span_with_reason(
DesugaringKind::Async, DesugaringKind::Async,
span, self.lower_span(span),
Some(self.allow_gen_future.clone()), Some(self.allow_gen_future.clone()),
); );
let resume_ty = hir::QPath::LangItem(hir::LangItem::ResumeTy, unstable_span); let resume_ty = hir::QPath::LangItem(hir::LangItem::ResumeTy, unstable_span);
@ -766,7 +766,7 @@ pub(super) fn make_async_gen_expr(
// Resume argument type: `ResumeTy` // Resume argument type: `ResumeTy`
let unstable_span = self.mark_span_with_reason( let unstable_span = self.mark_span_with_reason(
DesugaringKind::Async, DesugaringKind::Async,
span, self.lower_span(span),
Some(self.allow_gen_future.clone()), Some(self.allow_gen_future.clone()),
); );
let resume_ty = hir::QPath::LangItem(hir::LangItem::ResumeTy, unstable_span); let resume_ty = hir::QPath::LangItem(hir::LangItem::ResumeTy, unstable_span);

View File

@ -1382,6 +1382,7 @@ fn lower_generics<T>(
let host_param_parts = if let Const::Yes(span) = constness let host_param_parts = if let Const::Yes(span) = constness
&& self.tcx.features().effects && self.tcx.features().effects
{ {
let span = self.lower_span(span);
let param_node_id = self.next_node_id(); let param_node_id = self.next_node_id();
let hir_id = self.next_id(); let hir_id = self.next_id();
let def_id = self.create_def( let def_id = self.create_def(

View File

@ -1679,7 +1679,7 @@ fn lower_opaque_inner(
duplicated_lifetime_node_id, duplicated_lifetime_node_id,
lifetime.ident.name, lifetime.ident.name,
DefKind::LifetimeParam, DefKind::LifetimeParam,
lifetime.ident.span, self.lower_span(lifetime.ident.span),
); );
captured_to_synthesized_mapping.insert(old_def_id, duplicated_lifetime_def_id); captured_to_synthesized_mapping.insert(old_def_id, duplicated_lifetime_def_id);
// FIXME: Instead of doing this, we could move this whole loop // FIXME: Instead of doing this, we could move this whole loop
@ -1688,7 +1688,7 @@ fn lower_opaque_inner(
synthesized_lifetime_definitions.push(( synthesized_lifetime_definitions.push((
duplicated_lifetime_node_id, duplicated_lifetime_node_id,
duplicated_lifetime_def_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. // Now make an arg that we can use for the generic params of the opaque tykind.
@ -2253,7 +2253,7 @@ fn lower_array_length(&mut self, c: &AnonConst) -> hir::ArrayLen {
match c.value.kind { match c.value.kind {
ExprKind::Underscore => { ExprKind::Underscore => {
if self.tcx.features().generic_arg_infer { 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 { } else {
feature_err( feature_err(
&self.tcx.sess.parse_sess, &self.tcx.sess.parse_sess,