Skip to content
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

Merged
merged 1 commit into from
Jan 28, 2017
Merged

Avoid ICE when pretty-printing non-local MIR item. #39311

merged 1 commit into from
Jan 28, 2017

Conversation

solson
Copy link
Member

@solson solson commented Jan 26, 2017

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 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

@@ -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) {
Copy link
Member

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().

Copy link
Member Author

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.
@eddyb
Copy link
Member

eddyb commented Jan 26, 2017

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Jan 26, 2017

📌 Commit 8ad06af has been approved by eddyb

alexcrichton added a commit to alexcrichton/rust that referenced this pull request Jan 28, 2017
…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
bors added a commit that referenced this pull request Jan 28, 2017
@bors bors merged commit 8ad06af into rust-lang:master Jan 28, 2017
@solson solson deleted the fix-unpretty-mir-non-local branch January 28, 2017 05:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants