Rollup merge of #69200 - jonas-schievink:yield-print, r=eddyb,Zoxc
Fix printing of `Yield` terminator Addresses the bug found in https://github.com/rust-lang/rust/issues/69039#issuecomment-586633495
This commit is contained in:
commit
8b93e67c32
@ -1468,21 +1468,21 @@ impl<'tcx> TerminatorKind<'tcx> {
|
||||
/// successors, which may be rendered differently between the text and the graphviz format.
|
||||
pub fn fmt_head<W: Write>(&self, fmt: &mut W) -> fmt::Result {
|
||||
use self::TerminatorKind::*;
|
||||
match *self {
|
||||
match self {
|
||||
Goto { .. } => write!(fmt, "goto"),
|
||||
SwitchInt { discr: ref place, .. } => write!(fmt, "switchInt({:?})", place),
|
||||
SwitchInt { discr, .. } => write!(fmt, "switchInt({:?})", discr),
|
||||
Return => write!(fmt, "return"),
|
||||
GeneratorDrop => write!(fmt, "generator_drop"),
|
||||
Resume => write!(fmt, "resume"),
|
||||
Abort => write!(fmt, "abort"),
|
||||
Yield { ref value, .. } => write!(fmt, "_1 = suspend({:?})", value),
|
||||
Yield { value, resume_arg, .. } => write!(fmt, "{:?} = yield({:?})", resume_arg, value),
|
||||
Unreachable => write!(fmt, "unreachable"),
|
||||
Drop { ref location, .. } => write!(fmt, "drop({:?})", location),
|
||||
DropAndReplace { ref location, ref value, .. } => {
|
||||
Drop { location, .. } => write!(fmt, "drop({:?})", location),
|
||||
DropAndReplace { location, value, .. } => {
|
||||
write!(fmt, "replace({:?} <- {:?})", location, value)
|
||||
}
|
||||
Call { ref func, ref args, ref destination, .. } => {
|
||||
if let Some((ref destination, _)) = *destination {
|
||||
Call { func, args, destination, .. } => {
|
||||
if let Some((destination, _)) = destination {
|
||||
write!(fmt, "{:?} = ", destination)?;
|
||||
}
|
||||
write!(fmt, "{:?}(", func)?;
|
||||
@ -1494,7 +1494,7 @@ pub fn fmt_head<W: Write>(&self, fmt: &mut W) -> fmt::Result {
|
||||
}
|
||||
write!(fmt, ")")
|
||||
}
|
||||
Assert { ref cond, expected, ref msg, .. } => {
|
||||
Assert { cond, expected, msg, .. } => {
|
||||
write!(fmt, "assert(")?;
|
||||
if !expected {
|
||||
write!(fmt, "!")?;
|
||||
|
@ -49,7 +49,7 @@ fn main() {
|
||||
// StorageLive(_4);
|
||||
// _4 = Bar(const 6i32,);
|
||||
// ...
|
||||
// _1 = suspend(move _6) -> [resume: bb2, drop: bb4];
|
||||
// _5 = yield(move _6) -> [resume: bb2, drop: bb4];
|
||||
// }
|
||||
// bb1 (cleanup): {
|
||||
// resume;
|
||||
|
Loading…
Reference in New Issue
Block a user