diff options
| author | Andrew Zhogin <andrew.zhogin@gmail.com> | 2025-05-13 20:26:22 +0700 |
|---|---|---|
| committer | Andrew Zhogin <andrew.zhogin@gmail.com> | 2025-05-23 03:40:27 +0700 |
| commit | cb8fdb4d80a855c87c5a56a0652aa8f91b0d545d (patch) | |
| tree | 5767f3ad921a8827548c4242d213f424e52cca53 /compiler/rustc_mir_transform/src | |
| parent | 356f2d077498d0ebe5ec4f9cfef04293a2b17611 (diff) | |
| download | rust-cb8fdb4d80a855c87c5a56a0652aa8f91b0d545d.tar.gz rust-cb8fdb4d80a855c87c5a56a0652aa8f91b0d545d.zip | |
Async drop poll shim for error dropee generates noop body (fixes #140930)
Diffstat (limited to 'compiler/rustc_mir_transform/src')
| -rw-r--r-- | compiler/rustc_mir_transform/src/shim/async_destructor_ctor.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler/rustc_mir_transform/src/shim/async_destructor_ctor.rs b/compiler/rustc_mir_transform/src/shim/async_destructor_ctor.rs index 7976b65aae7..fbc8ee9b06c 100644 --- a/compiler/rustc_mir_transform/src/shim/async_destructor_ctor.rs +++ b/compiler/rustc_mir_transform/src/shim/async_destructor_ctor.rs @@ -6,7 +6,7 @@ use rustc_middle::mir::{ BasicBlock, BasicBlockData, Body, Local, LocalDecl, MirSource, Operand, Place, Rvalue, SourceInfo, Statement, StatementKind, Terminator, TerminatorKind, }; -use rustc_middle::ty::{self, EarlyBinder, Ty, TyCtxt}; +use rustc_middle::ty::{self, EarlyBinder, Ty, TyCtxt, TypeVisitableExt}; use super::*; use crate::patch::MirPatch; @@ -121,9 +121,10 @@ pub(super) fn build_async_drop_shim<'tcx>( parent_args.as_coroutine().resume_ty(), ))); body.phase = MirPhase::Runtime(RuntimePhase::Initial); - if !needs_async_drop { + if !needs_async_drop || drop_ty.references_error() { // Returning noop body for types without `need async drop` - // (or sync Drop in case of !`need async drop` && `need drop`) + // (or sync Drop in case of !`need async drop` && `need drop`). + // And also for error types. return body; } |
