Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions compiler/rustc_mir_transform/src/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1303,7 +1303,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
}
}
CastKind::Transmute => {
if let MirPhase::Runtime(..) = self.body.phase {
if self.body.phase >= MirPhase::Analysis(AnalysisPhase::PostCleanup) {
// Unlike `mem::transmute`, a MIR `Transmute` is well-formed
// for any two `Sized` types, just potentially UB to run.

Expand Down Expand Up @@ -1331,7 +1331,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
self.fail(
location,
format!(
"Transmute is not supported in non-runtime phase {:?}.",
"Transmute is not supported until Analysis(PostCleanup), but was used in {:?}.",
self.body.phase
),
);
Expand Down
16 changes: 16 additions & 0 deletions tests/ui/mir/drop_in_async.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//@ run-pass
//@ compile-flags: --edition=2024 -Zvalidate-mir

// async drops are elaborated earlier than non-async ones.
// See <https://github.com/rust-lang/rust/issues/137243>

struct HasDrop;
impl Drop for HasDrop {
fn drop(&mut self) {}
}

fn main() {
let _ = async {
vec![async { HasDrop }.await];
};
}
Loading