-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid ICE when pretty-printing non-local MIR item. #39311
Conversation
@@ -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.into_iter().filter(DefId::is_local) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need .into_iter()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops... I've built up too much of a reflex going from in collection
to in collection.into_iter().foo()
.
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.
@bors r+ rollup |
📌 Commit 8ad06af has been approved by |
…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
This comes up when using
-Zunstable-options --unpretty=mir
. Previously, rustc would ICE due to an unwrap later in this function (afteras_local_node_id
). Instead, we should just ignore items from other crates when pretty-printing MIR.This was reported in #rust: this playground code 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.r? @eddyb