resolve: Extend ambiguous_import_visibilities deprecation lint to glob-vs-glob ambiguities#154149
Open
petrochenkov wants to merge 2 commits intorust-lang:mainfrom
Open
resolve: Extend ambiguous_import_visibilities deprecation lint to glob-vs-glob ambiguities#154149petrochenkov wants to merge 2 commits intorust-lang:mainfrom
ambiguous_import_visibilities deprecation lint to glob-vs-glob ambiguities#154149petrochenkov wants to merge 2 commits intorust-lang:mainfrom
Conversation
petrochenkov
commented
Mar 20, 2026
| && let ItemKind::Use(_, UseKind::Glob) = item.kind | ||
| { | ||
| // Glob import visibilities can be increasee by other | ||
| // more public glob imports in cases of ambiguity. |
petrochenkov
commented
Mar 20, 2026
| tcx, | ||
| ); | ||
| if let Some(max_vis_decl) = decl.ambiguity_vis_max.get() { | ||
| // Avoid the most visible import in an ambiguous glob set being reported as unused. |
petrochenkov
commented
Mar 20, 2026
|
|
||
| if let Some(binding) = resolution.binding() | ||
| && old_decl != Some(binding) | ||
| && (old_decl != Some(binding) || old_vis != Some(binding.vis())) |
Contributor
Author
There was a problem hiding this comment.
And this is a fix for #152347.
Here we are triggering the glob re-fetching on visibility updates.
…lob-vs-glob ambiguities
171ed29 to
8c30e81
Compare
Collaborator
|
This PR was rebased onto a different main 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. |
Contributor
Author
|
@bors try |
This comment has been minimized.
This comment has been minimized.
rust-bors bot
pushed a commit
that referenced
this pull request
Mar 20, 2026
resolve: Extend `ambiguous_import_visibilities` deprecation lint to glob-vs-glob ambiguities
Collaborator
|
The job Click to see the possible cause of the failure (guessed by this bot) |
Contributor
Contributor
Author
|
@craterbot check |
Collaborator
|
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Continuation of #149596, implementation of this comment #149596 (comment) in particular.
FCP for the lint in general - #149596 (comment).
#152498 is reverted as a part of the change, but fixes are applied to keep the tests added in that PR working.
To implement this we have to have to track the most and the least visible declarations in an ambiguous glob set.
Part of #153961.
r? @yaahc maybe