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

suggest candidates for unresolved import #102876

Merged
merged 1 commit into from
Oct 11, 2022

Conversation

SparrowLii
Copy link
Member

Currently we prompt suggestion of candidates(help notes of use xxx::yyy) for names which cannot be resolved, but we don't do that for import statements themselves that couldn't be resolved. It seems reasonable to add candidate help information for these statements as well.
Fixes #102711

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Oct 10, 2022
@rust-highfive
Copy link
Collaborator

r? @fee1-dead

(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 Oct 10, 2022
@fee1-dead
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Oct 10, 2022

📌 Commit 0571b0a has been approved by fee1-dead

It is now in the queue for this repository.

@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 Oct 10, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Oct 10, 2022
…1-dead

suggest candidates for unresolved import

Currently we prompt suggestion of candidates(help notes of `use xxx::yyy`) for names which cannot be resolved, but we don't do that for import statements themselves that couldn't be resolved. It seems reasonable to add candidate help information for these statements as well.
Fixes rust-lang#102711
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Oct 10, 2022
…1-dead

suggest candidates for unresolved import

Currently we prompt suggestion of candidates(help notes of `use xxx::yyy`) for names which cannot be resolved, but we don't do that for import statements themselves that couldn't be resolved. It seems reasonable to add candidate help information for these statements as well.
Fixes rust-lang#102711
|
help: a similar name exists in the module
|
LL | use test as y;
Copy link
Member

Choose a reason for hiding this comment

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

What's this suggesting? Turning test into test?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think this is the original problem of the test module and not a problem caused by this PR

Comment on lines +2478 to +2479
IsPattern::No,
IsImport::Yes,
Copy link
Member

Choose a reason for hiding this comment

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

Are these mutually exclusive? If so, they probably should be unified into one enum

Copy link
Member Author

Choose a reason for hiding this comment

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

These two parameters cannot be Yes at the same time, but can be No at the same time, or one of them is Yes, so if they are unified into one enumeration, at least three variants are required.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, that's what I meant -- the Yes+Yes state being invalid would be better represented as an enum.

Copy link
Member Author

Choose a reason for hiding this comment

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

That makes sense. I think we can rename IsPattern enum to Mode and add a new variant in it. Since this PR is already in a rollup, should I just modify this PR or submit a new one?

Copy link
Member

Choose a reason for hiding this comment

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

A follow-up is fine.

bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 11, 2022
…iaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#101360 (Point out incompatible closure bounds)
 - rust-lang#101789 (`let`'s not needed in struct field definitions)
 - rust-lang#102846 (update to syn-1.0.102)
 - rust-lang#102871 (rustdoc: clean up overly complex `.trait-impl` CSS selectors)
 - rust-lang#102876 (suggest candidates for unresolved import)
 - rust-lang#102888 (Improve rustdoc-gui search-color test)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 0bd1cba into rust-lang:master Oct 11, 2022
@rustbot rustbot added this to the 1.66.0 milestone Oct 11, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Oct 12, 2022
…piler-errors

unify `IsPattern` and `IsImport` enum in `show_candidates`

Follow-up of rust-lang#102876
A binding cannot appear in both pattern and import at the same time, so it makes sense to unify them
r? `@compiler-errors`
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. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Recover from missing crate or other scope resolution in use where appropriate
6 participants