-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
fix(resolve): update shadowed_glob more precision #112495
Merged
Merged
Conversation
This file contains 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
rustbot
added
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
labels
Jun 10, 2023
bvanjoi
commented
Jun 11, 2023
petrochenkov
added
S-waiting-on-author
Status: This is awaiting some action (such as code changes or more information) from the author.
and removed
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
labels
Jun 13, 2023
bvanjoi
commented
Jun 13, 2023
bvanjoi
commented
Jun 13, 2023
bvanjoi
changed the title
fix(resolve): skip re-assign
fix(resolve): do not re-assign shadowed_glob if it is defined
Jun 13, 2023
shadowed_glob
when there had diff res for TypeNS
All checks had passed, so @rustbot ready |
rustbot
added
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
and removed
S-waiting-on-author
Status: This is awaiting some action (such as code changes or more information) from the author.
labels
Jun 13, 2023
petrochenkov
added
S-waiting-on-author
Status: This is awaiting some action (such as code changes or more information) from the author.
and removed
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
labels
Jun 13, 2023
bvanjoi
commented
Jun 13, 2023
bvanjoi
changed the title
fix(resolve): do not re-assign shadowed_glob if it is defined
fix(resolve): update shadowed_glob more precision
Jun 13, 2023
@@ -4,17 +4,19 @@ error[E0659]: `V` is ambiguous | |||
LL | use V; | |||
| ^ ambiguous name | |||
| | |||
= note: ambiguous because of multiple potential import sources | |||
note: `V` could refer to the variant imported here | |||
= note: ambiguous because of multiple glob imports of a name in the same module |
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 like you just fixed this FIXME - https://github.com/rust-lang/rust/pull/112086/files#diff-54ebaa0715c94a2acf974077e838aa584186e187f3d01edb1791fd71c78408caR937-R939 and we can now remove AmbiguityKind::Import
in #112086.
This comment has been minimized.
This comment has been minimized.
@bors r+ |
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 13, 2023
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jun 14, 2023
…iaskrgr Rollup of 5 pull requests Successful merges: - rust-lang#112197 (Erase regions even if normalization fails in writeback (in new solver)) - rust-lang#112495 (fix(resolve): update shadowed_glob more precision) - rust-lang#112520 (Fix the overflow issue for transmute_generic_consts) - rust-lang#112571 (rustdoc-search: search never type with `!`) - rust-lang#112581 ([rustdoc] Fix URL encoding of % sign) r? `@ghost` `@rustbot` modify labels: rollup
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
inconsistent resolution for an import
#109153assertion failed: import.imported_module.get().is_none()'
#109962Why does it panic?
We use #109153 as an illustration.
The process of
resolve_imports
is:(Mod(root), Ident(bar) in type ns)
use foo::*
binding
-> foo::bar,shallowed_glob
->None
use bar::bar
binding
-> foo::bar::bar,shallowed_glob
-> foo::baruse bar::*
binding
-> foo::bar::bar,shallowed_glob
-> foo::bar::bar::barSo during
finalize_import
, theroot::bar
inuse bar::bar
had been pointed tofoo::bar::bar::bar
, which is different from theinitial_module
valued offoo::bar
, therefore, the panic had been triggered.Try to solve it
I think #109153 should check-pass rather than throw an ambiguous error. Following this idea, there are two ways to solve this problem:1. Give up theinitial_module
and updateimport.imported_module
after each resolution update. However, I think this method may have too much impact.2. Do not update theshadowed_glob
when it is defined.To be honest, I am not sure if this is the right way to solve this ICE. Perhaps there is a better resolution.Edit: we had made the
resolution.shadowed_glob
update more detailed.r? @petrochenkov