Skip to content

resolve: Extend ambiguous_import_visibilities deprecation lint to glob-vs-glob ambiguities#154149

Open
petrochenkov wants to merge 1 commit intorust-lang:mainfrom
petrochenkov:globvisglob
Open

resolve: Extend ambiguous_import_visibilities deprecation lint to glob-vs-glob ambiguities#154149
petrochenkov wants to merge 1 commit intorust-lang:mainfrom
petrochenkov:globvisglob

Conversation

@petrochenkov
Copy link
Copy Markdown
Contributor

@petrochenkov petrochenkov commented Mar 20, 2026

View all comments

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

@rustbot 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 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.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is a fix for #151124.

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.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is a fix for #152004.


if let Some(binding) = resolution.binding()
&& old_decl != Some(binding)
&& (old_decl != Some(binding) || old_vis != Some(binding.vis()))
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

And this is a fix for #152347.
Here we are triggering the glob re-fetching on visibility updates.

@rustbot

This comment has been minimized.

@petrochenkov
Copy link
Copy Markdown
Contributor Author

@bors try

@rust-bors

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
@petrochenkov petrochenkov added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 20, 2026
@rust-log-analyzer

This comment has been minimized.

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Mar 20, 2026

☀️ Try build successful (CI)
Build commit: 4907eac (4907eac94165faff6c5e5e015670b1c584275f7b, parent: bfc05d6b072585dfd0c792ec1b8728c08a3511fe)

@petrochenkov
Copy link
Copy Markdown
Contributor Author

@craterbot check

@craterbot
Copy link
Copy Markdown
Collaborator

👌 Experiment pr-154149 created and queued.
🤖 Automatically detected try build 4907eac
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot
Copy link
Copy Markdown
Collaborator

🚧 Experiment pr-154149 is now running

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot
Copy link
Copy Markdown
Collaborator

🎉 Experiment pr-154149 is completed!
📊 136 regressed and 4 fixed (858234 total)
📊 5129 spurious results on the retry-regressed-list.txt, consider a retry1 if this is a significant amount.
📰 Open the summary report.

⚠️ If you notice any spurious failure please add them to the denylist!
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

Footnotes

  1. re-run the experiment with crates=https://crater-reports.s3.amazonaws.com/pr-154149/retry-regressed-list.txt

@craterbot craterbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels Mar 30, 2026
@petrochenkov 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 Mar 31, 2026
@rustbot

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rustbot

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 10, 2026

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.

@petrochenkov
Copy link
Copy Markdown
Contributor Author

@bors try

@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Apr 10, 2026
resolve: Extend `ambiguous_import_visibilities` deprecation lint to glob-vs-glob ambiguities
@petrochenkov petrochenkov added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 10, 2026
@petrochenkov
Copy link
Copy Markdown
Contributor Author

TODO: @craterbot run mode=check-only p=1 crates=https://crater-reports.s3.amazonaws.com/pr-154149/retry-regressed-list.txt

@rust-log-analyzer
Copy link
Copy Markdown
Collaborator

The job aarch64-gnu-llvm-21-2 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
##[endgroup]
Executing "/scripts/stage_2_test_set2.sh"
+ /scripts/stage_2_test_set2.sh
+ '[' 1 == 1 ']'
+ echo 'PR_CI_JOB set; skipping tidy'
+ SKIP_TIDY='--skip tidy'
+ ../x.py --stage 2 test --skip tidy --skip tests --skip coverage-map --skip coverage-run --skip library --skip tidyselftest
PR_CI_JOB set; skipping tidy
##[group]Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.04s
##[endgroup]
---

test result: FAILED. 70 passed; 1 failed; 3 ignored; 0 measured; 0 filtered out; finished in 1.10s

all doctests ran in 3.09s; merged doctests compilation took 1.96s
error: doctest failed, to rerun pass `-p rustc_lint_defs --doc`
Bootstrap failed while executing `--stage 2 test --skip tidy --skip tests --skip coverage-map --skip coverage-run --skip library --skip tidyselftest`
Build completed unsuccessfully in 0:30:41
  local time: Fri Apr 10 16:56:14 UTC 2026
  network time: Fri, 10 Apr 2026 16:56:15 GMT
##[error]Process completed with exit code 1.

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Apr 10, 2026

☀️ Try build successful (CI)
Build commit: fe84aa3 (fe84aa3583bb2681b5d0580316bde6d58ccfd6b5, parent: 8317fef20409adedaa7c385fa6e954867bf626fc)

@petrochenkov
Copy link
Copy Markdown
Contributor Author

@craterbot
Copy link
Copy Markdown
Collaborator

👌 Experiment pr-154149-1 created and queued.
🤖 Automatically detected try build fe84aa3
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@petrochenkov
Copy link
Copy Markdown
Contributor Author

@craterbot p=11
This is a tiny run, and beta-1.95-5 is a full run.

@craterbot
Copy link
Copy Markdown
Collaborator

📝 Configuration of the pr-154149-1 experiment changed.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-crater Status: Waiting on a crater run to be completed. 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.

5 participants