Skip to content

Commit e1a5c46

Browse files
committed
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
2 parents 0edc3d3 + 8ad06af commit e1a5c46

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/librustc_mir/pretty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ pub fn write_mir_pretty<'a, 'b, 'tcx, I>(tcx: TyCtxt<'b, 'tcx, 'tcx>,
9292
where I: Iterator<Item=DefId>, 'tcx: 'a
9393
{
9494
let mut first = true;
95-
for def_id in iter {
95+
for def_id in iter.filter(DefId::is_local) {
9696
let mir = &tcx.item_mir(def_id);
9797

9898
if first {

0 commit comments

Comments
 (0)