diff options
| author | Michael Goulet <michael@errs.io> | 2025-05-23 09:44:22 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2025-05-23 10:43:21 +0000 |
| commit | 11392f4978fe3a81a87e4fd8abcb78a0dcf166e5 (patch) | |
| tree | ccbf91fbce58e381cb9a0a1116cf4cbb6bc86849 /compiler/rustc_mir_transform/src | |
| parent | 52bf0cf795dfecc8b929ebb1c1e2545c3f41d4c9 (diff) | |
| download | rust-11392f4978fe3a81a87e4fd8abcb78a0dcf166e5.tar.gz rust-11392f4978fe3a81a87e4fd8abcb78a0dcf166e5.zip | |
Emit dummy open drop for unsafe binder
Diffstat (limited to 'compiler/rustc_mir_transform/src')
| -rw-r--r-- | compiler/rustc_mir_transform/src/elaborate_drop.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/compiler/rustc_mir_transform/src/elaborate_drop.rs b/compiler/rustc_mir_transform/src/elaborate_drop.rs index 14f7c2a263b..211e2a92f73 100644 --- a/compiler/rustc_mir_transform/src/elaborate_drop.rs +++ b/compiler/rustc_mir_transform/src/elaborate_drop.rs @@ -1278,6 +1278,23 @@ where } ty::Slice(ety) => self.drop_loop_trio_for_slice(*ety), + ty::UnsafeBinder(_) => { + // Unsafe binders may elaborate drops if their inner type isn't copy. + // This is enforced in typeck, so this should never happen. + self.tcx().dcx().span_delayed_bug( + self.source_info.span, + "open drop for unsafe binder shouldn't be encountered", + ); + self.elaborator.patch().new_block(BasicBlockData { + statements: vec![], + terminator: Some(Terminator { + source_info: self.source_info, + kind: TerminatorKind::Unreachable, + }), + is_cleanup: self.unwind.is_cleanup(), + }) + } + _ => span_bug!(self.source_info.span, "open drop from non-ADT `{:?}`", ty), } } |
