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
Comment thread compiler/rustc_middle/src/middle/privacy.rs
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

This comment has been minimized.

@petrochenkov
Copy link
Copy Markdown
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 21, 2026
@rust-bors

This comment has been minimized.

@petrochenkov
Copy link
Copy Markdown
Contributor Author

Reassigning given https://rust-lang.zulipchat.com/#narrow/channel/356853-t-docs-rs/topic/metrics.20intitiative/near/585435779.

r? @mu001999
Perhaps you could review this?
(This can potentially be split into two parts if necessary.)

@rustbot rustbot assigned mu001999 and unassigned yaahc Apr 29, 2026
Comment thread compiler/rustc_middle/src/middle/privacy.rs
Comment thread compiler/rustc_resolve/src/imports.rs
@mu001999
Copy link
Copy Markdown
Member

r=me after rebase

@mu001999 mu001999 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 Apr 29, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 29, 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 r=mu001999

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 29, 2026

📌 Commit d28ea81 has been approved by mu001999

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 29, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Apr 29, 2026
resolve: Extend `ambiguous_import_visibilities` deprecation lint to glob-vs-glob ambiguities

Continuation of rust-lang#149596, implementation of this comment rust-lang#149596 (comment) in particular.
FCP for the lint in general - rust-lang#149596 (comment).
rust-lang#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 rust-lang#153961.
r? @yaahc maybe
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Apr 29, 2026
resolve: Extend `ambiguous_import_visibilities` deprecation lint to glob-vs-glob ambiguities

Continuation of rust-lang#149596, implementation of this comment rust-lang#149596 (comment) in particular.
FCP for the lint in general - rust-lang#149596 (comment).
rust-lang#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 rust-lang#153961.
r? @yaahc maybe
rust-bors Bot pushed a commit that referenced this pull request Apr 29, 2026
…uwer

Rollup of 22 pull requests

Successful merges:

 - #154149 (resolve: Extend `ambiguous_import_visibilities` deprecation lint to glob-vs-glob ambiguities)
 - #155189 (simd_reduce_min/max: remove float support)
 - #155453 (apply Cortex-A53 errata 843419 mitigation to the AArch64 Linux targets)
 - #155562 (Add a missing `GenericTypeVisitable`, and avoid having interner traits for `FnSigKind` and `Abi`)
 - #155608 (rustc_middle: Implement the `partial_cmp` operation for `DefId`s)
 - #155721 (When archive format is wrong produce an error instead of ICE)
 - #155794 (privacy: share effective visibility initialization)
 - #155832 (c-variadic: more precise compatibility check in const-eval)
 - #155856 (std_detect: support detecting more features on aarch64 Windows)
 - #155861 (Suggest `[const] Trait` bounds in more places)
 - #155899 (`dlltool`: Set the working directory to workaround `--temp-prefix` bug)
 - #155916 (Update with new LLVM 22 target for `wasm32-wali-linux-musl` target)
 - #155935 (remap OUT_DIR paths to fix build script path leakage in crate metadata. )
 - #155950 (use the new `//@ needs-asm-mnemonic: ret` more)
 - #155958 (ci(free-disk-space): remove more tools and fix warnings)
 - #155966 (miri subtree update)
 - #155711 (bump curl-sys and openssl-sys to support OpenSSL 4.0.x)
 - #155831 (Add `AcceptContext::expect_key_value`)
 - #155877 (Avoid misleading return-type note for foreign `Fn` callees)
 - #155949 (Update `opt_ast_lowering_delayed_lints` query to allow "stealing" lints, allowing to use `FnOnce` instead of `Fn`)
 - #155951 (Make `FlatMapInPlaceVec` an unsafe trait.)
 - #155967 (Fix `doc_cfg` feature for extern items)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Apr 29, 2026
resolve: Extend `ambiguous_import_visibilities` deprecation lint to glob-vs-glob ambiguities

Continuation of rust-lang#149596, implementation of this comment rust-lang#149596 (comment) in particular.
FCP for the lint in general - rust-lang#149596 (comment).
rust-lang#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 rust-lang#153961.
r? @yaahc maybe
rust-bors Bot pushed a commit that referenced this pull request Apr 29, 2026
…uwer

Rollup of 21 pull requests

Successful merges:

 - #155966 (miri subtree update)
 - #154149 (resolve: Extend `ambiguous_import_visibilities` deprecation lint to glob-vs-glob ambiguities)
 - #155189 (simd_reduce_min/max: remove float support)
 - #155562 (Add a missing `GenericTypeVisitable`, and avoid having interner traits for `FnSigKind` and `Abi`)
 - #155608 (rustc_middle: Implement the `partial_cmp` operation for `DefId`s)
 - #155721 (When archive format is wrong produce an error instead of ICE)
 - #155794 (privacy: share effective visibility initialization)
 - #155832 (c-variadic: more precise compatibility check in const-eval)
 - #155856 (std_detect: support detecting more features on aarch64 Windows)
 - #155861 (Suggest `[const] Trait` bounds in more places)
 - #155899 (`dlltool`: Set the working directory to workaround `--temp-prefix` bug)
 - #155916 (Update with new LLVM 22 target for `wasm32-wali-linux-musl` target)
 - #155935 (remap OUT_DIR paths to fix build script path leakage in crate metadata. )
 - #155950 (use the new `//@ needs-asm-mnemonic: ret` more)
 - #155958 (ci(free-disk-space): remove more tools and fix warnings)
 - #155711 (bump curl-sys and openssl-sys to support OpenSSL 4.0.x)
 - #155831 (Add `AcceptContext::expect_key_value`)
 - #155877 (Avoid misleading return-type note for foreign `Fn` callees)
 - #155949 (Update `opt_ast_lowering_delayed_lints` query to allow "stealing" lints, allowing to use `FnOnce` instead of `Fn`)
 - #155951 (Make `FlatMapInPlaceVec` an unsafe trait.)
 - #155967 (Fix `doc_cfg` feature for extern items)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

6 participants