Skip to content

Commit a82b7a6

Browse files
committed
Async drop source info fix for proxy-drop-coroutine - fixes crash at debug info generation
1 parent 097cd98 commit a82b7a6

File tree

1 file changed

+5
-1
lines changed
  • compiler/rustc_middle/src/ty

1 file changed

+5
-1
lines changed

compiler/rustc_middle/src/ty/mod.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -1929,13 +1929,17 @@ impl<'tcx> TyCtxt<'tcx> {
19291929
if arg_cor_ty.is_coroutine() {
19301930
let span = self.def_span(def_id);
19311931
let source_info = SourceInfo::outermost(span);
1932+
// Even minimal, empty coroutine has 3 states (RESERVED_VARIANTS),
1933+
// so variant_fields and variant_source_info should have 3 elements.
19321934
let variant_fields: IndexVec<VariantIdx, IndexVec<FieldIdx, CoroutineSavedLocal>> =
19331935
iter::repeat(IndexVec::new()).take(CoroutineArgs::RESERVED_VARIANTS).collect();
1936+
let variant_source_info: IndexVec<VariantIdx, SourceInfo> =
1937+
iter::repeat(source_info).take(CoroutineArgs::RESERVED_VARIANTS).collect();
19341938
let proxy_layout = CoroutineLayout {
19351939
field_tys: [].into(),
19361940
field_names: [].into(),
19371941
variant_fields,
1938-
variant_source_info: [source_info].into(),
1942+
variant_source_info,
19391943
storage_conflicts: BitMatrix::new(0, 0),
19401944
};
19411945
return Some(self.arena.alloc(proxy_layout));

0 commit comments

Comments
 (0)