-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Check node kind to avoid ICE in check_expr_return()
#86728
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
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
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.
Looks good, left some nits
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.
Okay, looks good to me, thanks for the PR!
@bors r+ |
📌 Commit 0c26783 has been approved by |
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
This PR fixes #86721. The ICE described there is apparently due to a misunderstanding:
rust/compiler/rustc_typeck/src/check/expr.rs
Lines 684 to 685 in e98897e
Intuitively, one would think that calling
expect_item()
afterget_parent_item()
should succeed, but as it turns out,get_parent_item()
can also return foreign, trait, and impl items as well as crates, whereasexpect_item()
specifically expects aNode::Item
. I have therefore added an extra check to prevent this ICE.