Skip to content

Commit

Permalink
Rollup merge of rust-lang#64974 - ecstatic-morse:generic-graphviz-zeb…
Browse files Browse the repository at this point in the history
…ra, r=petrochenkov

Fix zebra-striping in generic dataflow visualization

A small formatting improvement to rust-lang#64828.

Prior to this, the background color of the first row of the table for each basic block changed seemingly at random. You can see this in [basic block rust-lang#5](rust-lang#64828 (comment)) under "New table". Now it is always light.

This also updates the example table to match the current output.
  • Loading branch information
tmandry authored Oct 2, 2019
2 parents 2f29548 + ffc52a7 commit 643ae95
Showing 1 changed file with 20 additions and 19 deletions.
39 changes: 20 additions & 19 deletions src/librustc_mir/dataflow/generic/graphviz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,25 +165,25 @@ where
block: BasicBlock,
) -> io::Result<()> {
// Sample output:
// +-+--------------------------------------------------+
// A | bb4 |
// +-+----------------------------------+---------------+
// B | MIR | STATE |
// +-+----------------------------------+---------------+
// C | | (on entry) | {_0,_2,_3} |
// +-+----------------------------------+---------------+
// D |0| 0: StorageLive(_7) | |
// +-+----------------------------------+---------------+
// |1| 1: StorageLive(_8) | |
// +-+----------------------------------+---------------+
// |2| 2: _8 = &mut _1 | +_8 |
// +-+----------------------------------+---------------+
// E |T| _7 = const Foo::twiddle(move _8) | -_8 |
// +-+----------------------------------+---------------+
// F | | (on unwind) | {_0,_2,_3,_7} |
// +-+----------------------------------+---------------+
// | | (on successful return) | +_7 |
// +-+----------------------------------+---------------+
// +-+-----------------------------------------------+
// A | bb4 |
// +-+----------------------------------+------------+
// B | MIR | STATE |
// +-+----------------------------------+------------+
// C | | (on entry) | {_0,_2,_3} |
// +-+----------------------------------+------------+
// D |0| StorageLive(_7) | |
// +-+----------------------------------+------------+
// |1| StorageLive(_8) | |
// +-+----------------------------------+------------+
// |2| _8 = &mut _1 | +_8 |
// +-+----------------------------------+------------+
// E |T| _4 = const Foo::twiddle(move _2) | -_2 |
// +-+----------------------------------+------------+
// F | | (on unwind) | {_0,_3,_8} |
// +-+----------------------------------+------------+
// | | (on successful return) | +_4 |
// +-+----------------------------------+------------+

write!(
w,
Expand Down Expand Up @@ -211,6 +211,7 @@ where
)?;

// C: Entry state
self.bg = Background::Light;
self.results.seek_to_block_start(block);
self.write_row_with_curr_state(w, "", "(on entry)")?;
self.prev_state.overwrite(self.results.get());
Expand Down

0 comments on commit 643ae95

Please sign in to comment.