Include ForeignItem when visiting types for WF check by PrestonFrom · Pull Request #98159 · rust-lang/rust (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation15 Commits1 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

PrestonFrom

Addresses Issue 95665 by including hir::Node::ForeignItem as a valid
type to visit in diagnostic_hir_wf_check.

Fixes #95665

@rustbot rustbot added the T-compiler

Relevant to the compiler team, which will review and decide on the PR/issue.

label

Jun 16, 2022

@rust-highfive

r? @petrochenkov

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

@PrestonFrom

This fixes the issue originally reported, but I'm wondering if the other variants in hir::Node should be valid to visit. The comment on line 120 seemed like it would justify visiting any Ty that could be extracted, but I definitely don't have a complete understanding of what is happening. Any guidance would be appreciated!

@petrochenkov

The full list can be found by searching for places where WellFormedLoc::Ty is created.
Looks like all nodes except for foreign statics were already processed correctly.

petrochenkov

@cjgillot

HIR WF check is just about getting a more precise diagnostic. Can't we just let the match be None instead of panicking? This would give us a sub-optimal diagnostic, without any chance of ICE.

@PrestonFrom

@cjgillot Apologies if this should be obvious, but I want to confirm that you mean the match on the ForeignItem kind and not the "parent" match on the WellFormedLoc.

@cjgillot

@PrestonFrom in the cases the inner match returns None, the outer one will return the same result, won't it? In doubt: I mean replacing the bug! into None, not changing the other cases that already return Some.

@PrestonFrom

@cjgillot The outer match currently uses bug! for the non-matching case, which I think is why it was suggested to use bug! here as well. So, I wasn't sure if you wanted to update both to return None or just the new addition.

@petrochenkov

r=me after squashing commits.

@PrestonFrom

Addresses Issue 95665 by including hir::Node::ForeignItem as a valid type to visit in diagnostic_hir_wf_check.

Fixes rust-lang#95665

@PrestonFrom

@PrestonFrom

@petrochenkov

@bors

📌 Commit f725b97 has been approved by petrochenkov

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

Status: This is awaiting some action (such as code changes or more information) from the author.

labels

Jun 20, 2022

bors added a commit to rust-lang-ci/rust that referenced this pull request

Jun 20, 2022

@bors

Rollup of 8 pull requests

Successful merges:

Failed merges:

r? @ghost @rustbot modify labels: rollup

Labels

S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

T-compiler

Relevant to the compiler team, which will review and decide on the PR/issue.