Rollup merge of #117858 - compiler-errors:span, r=lcnr
Compute layout with spans for better cycle errors in coroutines Split out from #117703, this PR at least gives us a nicer span to point at when we hit a cycle error in coroutine layout cycles.
This commit is contained in:
commit
cf21b6ef28
5 changed files with 30 additions and 19 deletions
|
@ -792,8 +792,11 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
|||
// debuggers and debugger extensions expect it to be called `__awaitee`. They use
|
||||
// this name to identify what is being awaited by a suspended async functions.
|
||||
let awaitee_ident = Ident::with_dummy_span(sym::__awaitee);
|
||||
let (awaitee_pat, awaitee_pat_hid) =
|
||||
self.pat_ident_binding_mode(span, awaitee_ident, hir::BindingAnnotation::MUT);
|
||||
let (awaitee_pat, awaitee_pat_hid) = self.pat_ident_binding_mode(
|
||||
gen_future_span,
|
||||
awaitee_ident,
|
||||
hir::BindingAnnotation::MUT,
|
||||
);
|
||||
|
||||
let task_context_ident = Ident::with_dummy_span(sym::_task_context);
|
||||
|
||||
|
|
|
@ -740,11 +740,11 @@ fn coroutine_layout<'tcx>(
|
|||
};
|
||||
let tag_layout = cx.tcx.mk_layout(LayoutS::scalar(cx, tag));
|
||||
|
||||
let promoted_layouts = ineligible_locals
|
||||
.iter()
|
||||
.map(|local| subst_field(info.field_tys[local].ty))
|
||||
.map(|ty| Ty::new_maybe_uninit(tcx, ty))
|
||||
.map(|ty| Ok(cx.layout_of(ty)?.layout));
|
||||
let promoted_layouts = ineligible_locals.iter().map(|local| {
|
||||
let field_ty = subst_field(info.field_tys[local].ty);
|
||||
let uninit_ty = Ty::new_maybe_uninit(tcx, field_ty);
|
||||
Ok(cx.spanned_layout_of(uninit_ty, info.field_tys[local].source_info.span)?.layout)
|
||||
});
|
||||
let prefix_layouts = args
|
||||
.as_coroutine()
|
||||
.prefix_tys()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue