]> git.lizzy.rs Git - rust.git/commitdiff
Avoid ICE when pretty-printing non-local MIR item.
authorScott Olson <scott@solson.me>
Thu, 26 Jan 2017 05:16:38 +0000 (21:16 -0800)
committerScott Olson <scott@solson.me>
Thu, 26 Jan 2017 18:44:28 +0000 (10:44 -0800)
This comes up when using `-Zunstable-options --unpretty=mir`.
Previously, rustc would ICE due to an unwrap later in this function
(after `as_local_node_id`). Instead, we should just ignore items from
other crates when pretty-printing MIR.

src/librustc_mir/pretty.rs

index e7188d536980fccde9dd1d76342a0aaa8761e9a8..6602d26f17fc53b6cbd8966f6c816f29d738c020 100644 (file)
@@ -92,7 +92,7 @@ pub fn write_mir_pretty<'a, 'b, 'tcx, I>(tcx: TyCtxt<'b, 'tcx, 'tcx>,
     where I: Iterator<Item=DefId>, 'tcx: 'a
 {
     let mut first = true;
-    for def_id in iter {
+    for def_id in iter.filter(DefId::is_local) {
         let mir = &tcx.item_mir(def_id);
 
         if first {