resolve: Extend ambiguous_import_visibilities deprecation lint to glob-vs-glob ambiguities rust-lang/rust#154149
compiler/rustc_middle/src/middle/privacy.rs
| 189 | && let ItemKind::Use(_, UseKind::Glob) = item.kind |
|
| 190 | { |
|
| 191 | // Glob import visibilities can be increasee by other |
|
| 192 | // more public glob imports in cases of ambiguity. |
This is a fix for #151124.
compiler/rustc_resolve/src/effective_visibilities.rs
| 183 | 183 | tcx, |
| 184 | 184 | ); |
| 185 | if let Some(max_vis_decl) = decl.ambiguity_vis_max.get() { |
|
| 186 | // Avoid the most visible import in an ambiguous glob set being reported as unused. |
This is a fix for #152004.
compiler/rustc_resolve/src/imports.rs
| 515 | 524 | |
| 516 | 525 | if let Some(binding) = resolution.binding() |
| 517 | && old_decl != Some(binding) |
|
| 526 | && (old_decl != Some(binding) || old_vis != Some(binding.vis())) |
And this is a fix for #152347.
Here we are triggering the glob re-fetching on visibility updates.
View on GitHub
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.
@bors try
View on GitHub
⌛ Trying commit 8c30e81 with merge 4907eac…
To cancel the try build, run the command @bors try cancel.
Workflow: https://github.com/rust-lang/rust/actions/runs/23355702102
View on GitHub
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)
Executing "/scripts/stage_2_test_set2.sh"
+ /scripts/stage_2_test_set2.sh
PR_CI_JOB set; skipping tidy
+ '[' 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
##[group]Building bootstrap
Finished `dev` profile [unoptimized] target(s) in 0.04s
##[endgroup]
downloading https://static.rust-lang.org/dist/2026-03-05/rustfmt-nightly-aarch64-unknown-linux-gnu.tar.xz
---
test result: FAILED. 69 passed; 1 failed; 3 ignored; 0 measured; 0 filtered out; finished in 1.02s
all doctests ran in 2.92s; merged doctests compilation took 1.87s
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:29:37
local time: Fri Mar 20 18:26:41 UTC 2026
network time: Fri, 20 Mar 2026 18:26:41 GMT
##[error]Process completed with exit code 1.
@craterbot check
👌 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
🚧 Experiment pr-154149 is now running
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more
🎉 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.
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more
Footnotes
-
re-run the experiment with
crates=https://crater-reports.s3.amazonaws.com/pr-154149/retry-regressed-list.txt↩
View on GitHub
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.
View on GitHub
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)
Executing "/scripts/stage_2_test_set2.sh"
+ /scripts/stage_2_test_set2.sh
PR_CI_JOB set; skipping tidy
+ '[' 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
##[group]Building bootstrap
Finished `dev` profile [unoptimized] target(s) in 0.04s
##[endgroup]
downloading https://static.rust-lang.org/dist/2026-03-05/rustfmt-nightly-aarch64-unknown-linux-gnu.tar.xz
---
test result: FAILED. 70 passed; 1 failed; 3 ignored; 0 measured; 0 filtered out; finished in 1.08s
all doctests ran in 3.08s; merged doctests compilation took 1.97s
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:31:25
local time: Wed Apr 8 17:24:53 UTC 2026
network time: Wed, 08 Apr 2026 17:24:53 GMT
##[error]Process completed with exit code 1.
View on GitHub
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.
View on GitHub
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)
Executing "/scripts/stage_2_test_set2.sh"
+ /scripts/stage_2_test_set2.sh
PR_CI_JOB set; skipping tidy
+ '[' 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
##[group]Building bootstrap
Finished `dev` profile [unoptimized] target(s) in 0.04s
##[endgroup]
downloading https://static.rust-lang.org/dist/2026-03-05/rustfmt-nightly-aarch64-unknown-linux-gnu.tar.xz
---
test result: FAILED. 70 passed; 1 failed; 3 ignored; 0 measured; 0 filtered out; finished in 1.05s
all doctests ran in 2.94s; merged doctests compilation took 1.86s
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:01
local time: Thu Apr 9 17:33:47 UTC 2026
network time: Thu, 09 Apr 2026 17:33:48 GMT
##[error]Process completed with exit code 1.
View on GitHub
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.
@bors try
View on GitHub
⌛ Trying commit 3b24e32 with merge fe84aa3…
To cancel the try build, run the command @bors try cancel.
Workflow: https://github.com/rust-lang/rust/actions/runs/24252835068
TODO: @craterbot run mode=check-only p=1 crates=https://crater-reports.s3.amazonaws.com/pr-154149/retry-regressed-list.txt
View on GitHub
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.
@craterbot run mode=check-only p=1 crates=https://crater-reports.s3.amazonaws.com/pr-154149/retry-regressed-list.txt
👌 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
@craterbot p=11
This is a tiny run, and beta-1.95-5 is a full run.
📝 Configuration of the pr-154149-1 experiment changed.
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more
🚧 Experiment pr-154149-1 is now running
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more
🎉 Experiment pr-154149-1 is completed!
📊 22 regressed and 0 fixed (5063 total)
📊 906 spurious results on the retry-regressed-list.txt, consider a retry1 if this is a significant amount.
📰 Open the summary report.
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more
Footnotes
-
re-run the experiment with
crates=https://crater-reports.s3.amazonaws.com/pr-154149-1/retry-regressed-list.txt↩
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.
☔ The latest upstream changes (presumably #155253) made this pull request unmergeable. Please resolve the merge conflicts.
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