about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-03-17 00:48:10 +0000
committerbors <bors@rust-lang.org>2018-03-17 00:48:10 +0000
commitcf5cc2e41eafabd23b3b99331a2a08cde13ba4e1 (patch)
treee7d94a329887ffcc6da666f5687f54ba07e1c9ac /src
parent55c984ee5db73db2379024951457d1139db57f24 (diff)
parentee4a7eba451cc631a8fb7ab4562d37074ec7b048 (diff)
downloadrust-cf5cc2e41eafabd23b3b99331a2a08cde13ba4e1.tar.gz
rust-cf5cc2e41eafabd23b3b99331a2a08cde13ba4e1.zip
Auto merge of #49088 - michaelwoerister:fix-49070, r=nikomatsakis
incr.comp.: Make sanity check in try_mark_green() aware of error conditions.

Before this PR, `DepGraph::try_mark_green()` assumed that forcing a query would always set the color of the corresponding dep-node. However, it did not take into account that queries could also fail (e.g. with a cycle error). This PR makes the method handle that condition gracefully.

Fixes #49070.

r? @nikomatsakis
Diffstat (limited to 'src')
-rw-r--r--src/librustc/dep_graph/graph.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/librustc/dep_graph/graph.rs b/src/librustc/dep_graph/graph.rs
index 210bdd8d5dd..0ad79eacd2b 100644
--- a/src/librustc/dep_graph/graph.rs
+++ b/src/librustc/dep_graph/graph.rs
@@ -648,8 +648,15 @@ impl DepGraph {
                                 return None
                             }
                             None => {
-                                bug!("try_mark_green() - Forcing the DepNode \
-                                      should have set its color")
+                                if !tcx.sess.has_errors() {
+                                    bug!("try_mark_green() - Forcing the DepNode \
+                                          should have set its color")
+                                } else {
+                                    // If the query we just forced has resulted
+                                    // in some kind of compilation error, we
+                                    // don't expect that the corresponding
+                                    // dep-node color has been updated.
+                                }
                             }
                         }
                     } else {