Skip to content

Conversation

FabianWolff
Copy link
Contributor

This PR fixes #86721. The ICE described there is apparently due to a misunderstanding:

let encl_item_id = self.tcx.hir().get_parent_item(expr.hir_id);
let encl_item = self.tcx.hir().expect_item(encl_item_id);

Intuitively, one would think that calling expect_item() after get_parent_item() should succeed, but as it turns out, get_parent_item() can also return foreign, trait, and impl items as well as crates, whereas expect_item() specifically expects a Node::Item. I have therefore added an extra check to prevent this ICE.

@rust-highfive
Copy link
Contributor

r? @LeSeulArtichaut

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 29, 2021
Copy link
Contributor

@LeSeulArtichaut LeSeulArtichaut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, left some nits

Copy link
Contributor

@LeSeulArtichaut LeSeulArtichaut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, looks good to me, thanks for the PR!

@LeSeulArtichaut
Copy link
Contributor

@bors r+

@bors
Copy link
Collaborator

bors commented Jun 30, 2021

📌 Commit 0c26783 has been approved by LeSeulArtichaut

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 30, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 1, 2021
Rollup of 8 pull requests

Successful merges:

 - rust-lang#85504 (the foundation owns rust trademarks)
 - rust-lang#85520 (Fix typo and improve documentation for E0632)
 - rust-lang#86680 (Improve error for missing -Z with debugging option)
 - rust-lang#86728 (Check node kind to avoid ICE in `check_expr_return()`)
 - rust-lang#86740 (copy rust-lld as ld in dist)
 - rust-lang#86746 (Fix rustdoc query type filter)
 - rust-lang#86750 (Test cross-crate usage of `feature(const_trait_impl)`)
 - rust-lang#86755 (alloc: `RawVec<T, A>::shrink` can be in `no_global_oom_handling`.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit dfe05c0 into rust-lang:master Jul 1, 2021
@rustbot rustbot added this to the 1.55.0 milestone Jul 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
5 participants