diff options
| author | Jonas Schievink <jonasschievink@gmail.com> | 2020-02-16 00:57:48 +0100 |
|---|---|---|
| committer | Jonas Schievink <jonasschievink@gmail.com> | 2020-02-16 00:57:48 +0100 |
| commit | 759526e513f28443b845b63176f15424686d0254 (patch) | |
| tree | 27744c148fdf9b4d45a186410747054dca0f89ed | |
| parent | 61d9231ff2604a0467987042d9ebf9ff9ea739b5 (diff) | |
| download | rust-759526e513f28443b845b63176f15424686d0254.tar.gz rust-759526e513f28443b845b63176f15424686d0254.zip | |
Fix printing of `Yield` terminator
| -rw-r--r-- | src/librustc/mir/mod.rs | 18 | ||||
| -rw-r--r-- | src/test/mir-opt/generator-storage-dead-unwind.rs | 2 |
2 files changed, 11 insertions, 9 deletions
diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index 4520d3a3333..a3e3a26db05 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -1468,21 +1468,23 @@ 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, "{:?} = suspend({:?})", 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 +1496,7 @@ impl<'tcx> TerminatorKind<'tcx> { } write!(fmt, ")") } - Assert { ref cond, expected, ref msg, .. } => { + Assert { cond, expected, msg, .. } => { write!(fmt, "assert(")?; if !expected { write!(fmt, "!")?; diff --git a/src/test/mir-opt/generator-storage-dead-unwind.rs b/src/test/mir-opt/generator-storage-dead-unwind.rs index 4442fa5f521..98acce83759 100644 --- a/src/test/mir-opt/generator-storage-dead-unwind.rs +++ b/src/test/mir-opt/generator-storage-dead-unwind.rs @@ -49,7 +49,7 @@ fn main() { // StorageLive(_4); // _4 = Bar(const 6i32,); // ... -// _1 = suspend(move _6) -> [resume: bb2, drop: bb4]; +// _5 = suspend(move _6) -> [resume: bb2, drop: bb4]; // } // bb1 (cleanup): { // resume; |
