-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Resolver: Batched Import Resolution #145108
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
base: master
Are you sure you want to change the base?
Resolver: Batched Import Resolution #145108
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Code looks a little better now and should be more correct than the previous commits, but I have yet to find a way to resolve the current test failures. |
This comment has been minimized.
This comment has been minimized.
|
Okey, I did fix |
a3f8ae2 to
4a2a0dc
Compare
This comment has been minimized.
This comment has been minimized.
|
Could you update the tests to make CI green, so I can see the difference? |
|
Moving |
|
I'll create a pr for it. |
be968c5 to
9e951c9
Compare
|
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
This comment has been minimized.
This comment has been minimized.
|
I can reproduce that locally, but when I remove that import, everything compiles just fine. I'm guessing this has nothing to do with this pr, so I'll just wait. |
@LorrensP-2158466 Could you send a PR with a fix to the |
If the import is legitimately unused, then it should be removed. |
Nice! I'll remove it. |
|
rust-analyzer is developed in its own repository. If possible, consider making this change to rust-lang/rust-analyzer instead. cc @rust-lang/rust-analyzer |
| self.greatest_vis_map.get(&def_id).copied().unwrap_or(binding.vis); | ||
| // macros exported through `macro_export` are not placed in this map, so | ||
| // hack the hack and make sure we still keep the best visibility. | ||
| if !vis.is_at_least(binding.vis, self.tcx()) { binding.vis } else { vis } |
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.
This hack has a chance to promote too many unrelated bindings to pub.
Unrelated public item with the same DefId in a different module? Promote to pub.
The glob import never shadows any #[macro_rules] and is never reexported? Nevermind, still promote to pub.
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.
So the hack doesn't actually track when a reexport glob shadows a #[macro_use] binding.
This comment was marked as off-topic.
This comment was marked as off-topic.
|
This is blocked on me doing some work, rather than reviewing (reexporting ambiguities to other crates, removing mutability from extern underscore disambiguators, finding better solution for the |
https://pyrossh.dev has the author's email. |
…, r=petrochenkov use module_child index as disambiguator for external items When defining the items of an external module, if that item is an underscore we use it's index as the disambiguator. This is needed for parallel import resolution, which is being worked on in rust-lang#145108. r? `@petrochenkov`
Rollup merge of #147805 - LorrensP-2158466:extern-mod-disamb, r=petrochenkov use module_child index as disambiguator for external items When defining the items of an external module, if that item is an underscore we use it's index as the disambiguator. This is needed for parallel import resolution, which is being worked on in #145108. r? `@petrochenkov`
…enkov Resolve: (Ref)Cell wrappers to deny mutation during spec resolution. Introduces wrappers around `Cell` and `RefCell` that only allow mutation when we are not in speculative resolution. This is preparatory work for rust-lang/rust#145108. It would allow us to make `ImportData` and `ModuleData` sync and send safe. r? ``@petrochenkov``
…etrochenkov Test: Ambigious bindings in same namespace with the same res Add a test based on the discussion [here](https://rust-lang.zulipchat.com/#narrow/channel/421156-gsoc/topic/Project.3A.20Parallel.20Macro.20Expansion/near/542316157) and related to rust-lang/rust#145575 (comment). This is the most reduced form I could create that passes on nightly but fails with rust-lang/rust#145108 (see [#gsoc > Project: Parallel Macro Expansion @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/421156-gsoc/topic/Project.3A.20Parallel.20Macro.20Expansion/near/542335131)). Also not sure about the test names. r? `@petrochenkov`
e3a3239 to
88b3daf
Compare
Transforms the current algorithm for resolving imports to a batched algorithm. Every import in the
indeterminate_importsset is resolved in isolation. This is the only real difference from the current algorithm.r? petrochenkov