-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Conversation
shadowed_glob
when there had diff res for TypeNS
All checks had passed, so @rustbot ready |
@@ -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+ |
…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
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