Skip to content

Commit 0c77356

Browse files
authored
Unrolled build for rust-lang#140630
Rollup merge of rust-lang#140630 - azhogin:azhogin/async-drop-proxy-source-info-fix, r=oli-obk Async drop source info fix for proxy-drop-coroutine Fixes crash at debug info generation: rust-lang#140426 . Also, the submitted example requires sync Drop implementation too. Because sync version is required for unwind and when drop is performed in sync context (sync function). Probably, it is also needed to add such a lint/error about missed `impl Drop`, when there is `impl AsyncDrop`. Fix description: even minimal, empty coroutine (for proxy-coroutine) has 3 states and the source info array should have 3 elements too. ``` #![feature(async_drop)] use std::future::AsyncDrop; use std::pin::Pin; #[tokio::main(flavor = "current_thread")] async fn main() { let _st = St; } struct St; impl AsyncDrop for St { async fn drop(self: Pin<&mut Self>) { println!("123"); } } ```
2 parents 13e8790 + a82b7a6 commit 0c77356

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)