File tree 1 file changed +5
-1
lines changed
compiler/rustc_middle/src/ty
1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -1929,13 +1929,17 @@ impl<'tcx> TyCtxt<'tcx> {
1929
1929
if arg_cor_ty. is_coroutine ( ) {
1930
1930
let span = self . def_span ( def_id) ;
1931
1931
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.
1932
1934
let variant_fields: IndexVec < VariantIdx , IndexVec < FieldIdx , CoroutineSavedLocal > > =
1933
1935
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 ( ) ;
1934
1938
let proxy_layout = CoroutineLayout {
1935
1939
field_tys : [ ] . into ( ) ,
1936
1940
field_names : [ ] . into ( ) ,
1937
1941
variant_fields,
1938
- variant_source_info : [ source_info ] . into ( ) ,
1942
+ variant_source_info,
1939
1943
storage_conflicts : BitMatrix :: new ( 0 , 0 ) ,
1940
1944
} ;
1941
1945
return Some ( self . arena . alloc ( proxy_layout) ) ;
You can’t perform that action at this time.
0 commit comments