diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2017-01-27 14:41:18 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2017-01-27 16:42:06 -0800 |
| commit | e1a5c467c7e592221e63832e4493a9b11f3eb4d6 (patch) | |
| tree | 89ad0a3a4d012d1585c4bed3580d39fc80273496 | |
| parent | 0edc3d37bb23784f9ad7927a5b84244ccfd85ca6 (diff) | |
| parent | 8ad06af1311e7112d6f21709ba344d43867b547c (diff) | |
| download | rust-e1a5c467c7e592221e63832e4493a9b11f3eb4d6.tar.gz rust-e1a5c467c7e592221e63832e4493a9b11f3eb4d6.zip | |
Rollup merge of #39311 - solson:fix-unpretty-mir-non-local, r=eddyb
Avoid ICE when pretty-printing non-local MIR item. 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. This was reported in #rust: [this playground code](https://is.gd/PSMBZS) causes an ICE if you click the MIR button. The problem is the mention of the non-local item `std::usize::MAX`, so you can reduce the test case [a lot](https://is.gd/SaLjaa). r? @eddyb
| -rw-r--r-- | src/librustc_mir/pretty.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/librustc_mir/pretty.rs b/src/librustc_mir/pretty.rs index bfe3e143e7c..35734dcce2b 100644 --- a/src/librustc_mir/pretty.rs +++ b/src/librustc_mir/pretty.rs @@ -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 { |
