about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTyler Mandry <tmandry@gmail.com>2019-10-01 23:06:22 -0700
committerGitHub <noreply@github.com>2019-10-01 23:06:22 -0700
commit643ae957d24ee994ea64d7a0d476fa5115723453 (patch)
tree72cb35cf579cdbda67e58e52a638acff579c94c5
parent2f29548cb452627831493fdacfce1cea06500c7d (diff)
parentffc52a7fe6b5b928b5e1dce43cf04e188c34f9e4 (diff)
downloadrust-643ae957d24ee994ea64d7a0d476fa5115723453.tar.gz
rust-643ae957d24ee994ea64d7a0d476fa5115723453.zip
Rollup merge of #64974 - ecstatic-morse:generic-graphviz-zebra, r=petrochenkov
Fix zebra-striping in generic dataflow visualization

A small formatting improvement to #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 #5](https://github.com/rust-lang/rust/pull/64828#issuecomment-536690047) under "New table". Now it is always light.

This also updates the example table to match the current output.
-rw-r--r--src/librustc_mir/dataflow/generic/graphviz.rs39
1 files changed, 20 insertions, 19 deletions
diff --git a/src/librustc_mir/dataflow/generic/graphviz.rs b/src/librustc_mir/dataflow/generic/graphviz.rs
index 2a08feff9e7..47ace8f33ec 100644
--- a/src/librustc_mir/dataflow/generic/graphviz.rs
+++ b/src/librustc_mir/dataflow/generic/graphviz.rs
@@ -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,
@@ -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());