Skip to content

Commit 8b93e67

Browse files
authored
Rollup merge of rust-lang#69200 - jonas-schievink:yield-print, r=eddyb,Zoxc
Fix printing of `Yield` terminator Addresses the bug found in rust-lang#69039 (comment)
2 parents d1f175b + bb482eb commit 8b93e67

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/librustc/mir/mod.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -1468,21 +1468,21 @@ impl<'tcx> TerminatorKind<'tcx> {
14681468
/// successors, which may be rendered differently between the text and the graphviz format.
14691469
pub fn fmt_head<W: Write>(&self, fmt: &mut W) -> fmt::Result {
14701470
use self::TerminatorKind::*;
1471-
match *self {
1471+
match self {
14721472
Goto { .. } => write!(fmt, "goto"),
1473-
SwitchInt { discr: ref place, .. } => write!(fmt, "switchInt({:?})", place),
1473+
SwitchInt { discr, .. } => write!(fmt, "switchInt({:?})", discr),
14741474
Return => write!(fmt, "return"),
14751475
GeneratorDrop => write!(fmt, "generator_drop"),
14761476
Resume => write!(fmt, "resume"),
14771477
Abort => write!(fmt, "abort"),
1478-
Yield { ref value, .. } => write!(fmt, "_1 = suspend({:?})", value),
1478+
Yield { value, resume_arg, .. } => write!(fmt, "{:?} = yield({:?})", resume_arg, value),
14791479
Unreachable => write!(fmt, "unreachable"),
1480-
Drop { ref location, .. } => write!(fmt, "drop({:?})", location),
1481-
DropAndReplace { ref location, ref value, .. } => {
1480+
Drop { location, .. } => write!(fmt, "drop({:?})", location),
1481+
DropAndReplace { location, value, .. } => {
14821482
write!(fmt, "replace({:?} <- {:?})", location, value)
14831483
}
1484-
Call { ref func, ref args, ref destination, .. } => {
1485-
if let Some((ref destination, _)) = *destination {
1484+
Call { func, args, destination, .. } => {
1485+
if let Some((destination, _)) = destination {
14861486
write!(fmt, "{:?} = ", destination)?;
14871487
}
14881488
write!(fmt, "{:?}(", func)?;
@@ -1494,7 +1494,7 @@ impl<'tcx> TerminatorKind<'tcx> {
14941494
}
14951495
write!(fmt, ")")
14961496
}
1497-
Assert { ref cond, expected, ref msg, .. } => {
1497+
Assert { cond, expected, msg, .. } => {
14981498
write!(fmt, "assert(")?;
14991499
if !expected {
15001500
write!(fmt, "!")?;

src/test/mir-opt/generator-storage-dead-unwind.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ fn main() {
4949
// StorageLive(_4);
5050
// _4 = Bar(const 6i32,);
5151
// ...
52-
// _1 = suspend(move _6) -> [resume: bb2, drop: bb4];
52+
// _5 = yield(move _6) -> [resume: bb2, drop: bb4];
5353
// }
5454
// bb1 (cleanup): {
5555
// resume;

0 commit comments

Comments
 (0)