Skip to content

Conversation

@petrochenkov
Copy link
Contributor

@petrochenkov petrochenkov commented Dec 3, 2025

The new ambiguities are reported when the import's visibility is ambiguous and may depend on the resolution/expansion order.

Detailed description: #149596 (comment).

@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 Dec 3, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 3, 2025

r? @lcnr

rustbot has assigned @lcnr.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@petrochenkov
Copy link
Contributor Author

@bors try

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Dec 3, 2025
resolve: Report more early resolution ambiguities for imports
@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 Dec 3, 2025
@petrochenkov
Copy link
Contributor Author

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

@rust-bors
Copy link
Contributor

rust-bors bot commented Dec 3, 2025

☀️ Try build successful (CI)
Build commit: ce3348c (ce3348c21531b911ca5aadbbbe7ad63a1bc4c382, parent: 8202d110516c6bd87cee375e9a9b774db499015c)

@petrochenkov
Copy link
Contributor Author

@craterbot
Copy link
Collaborator

👌 Experiment pr-149596 created and queued.
🤖 Automatically detected try build ce3348c
🔍 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
Collaborator

🚧 Experiment pr-149596 is now running

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

@craterbot
Copy link
Collaborator

🎉 Experiment pr-149596 is completed!
📊 359 regressed and 0 fixed (3583 total)
📊 218 spurious results on the retry-regessed-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-149596/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 Dec 4, 2025
@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 Dec 4, 2025
@rustbot

This comment has been minimized.

@petrochenkov
Copy link
Contributor Author

@bors try

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Dec 4, 2025
resolve: Report more early resolution ambiguities for imports
@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 Dec 4, 2025
@rust-bors
Copy link
Contributor

rust-bors bot commented Dec 4, 2025

☀️ Try build successful (CI)
Build commit: e617cc9 (e617cc9342f64b2efdd8eeb91834ef450a15825f, parent: 29e035e1728488dce5a03daa527ab1091d1cda47)

@rustbot rustbot assigned yaahc and unassigned lcnr Jan 19, 2026
@petrochenkov
Copy link
Contributor Author

ping @joshtriplett @nikomatsakis @scottmcm
This is now the only thing blocking parallel import resolution (#145108).

@joshtriplett
Copy link
Member

Checking a box on this.

Separately, I'm looking forward to the future edition changes proposed in #148610 to simplify pub use of macros, and hopefully eventually allow pub macro_rules! ....

@rust-rfcbot rust-rfcbot added final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. and removed proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. labels Jan 21, 2026
@rust-rfcbot
Copy link
Collaborator

🔔 This is now entering its final comment period, as per the review above. 🔔

@traviscross traviscross removed I-lang-nominated Nominated for discussion during a lang team meeting. P-lang-drag-1 Lang team prioritization drag level 1. https://rust-lang.zulipchat.com/#narrow/channel/410516-t-lang labels Jan 21, 2026
@nikomatsakis
Copy link
Contributor

nikomatsakis commented Jan 21, 2026

@rfcbot reviewed

I was reluctant to check my box here but I've become convinced that the current behavior is nice in its own way and that changing it in the way I proposed might cause private APIs to become "accidentally" exposed. The example that @tmandry showed me, which I believe came from @Nadrieril, is:

mod internal {
  mod inner {
    pub struct Foo;
  }
  pub(crate) use inner::Foo;
  pub struct Bar;
}
pub use internal::*; // `Foo` would now be part of the public API of the crate

Here, here the intent of the inner module is not to think about visibility at all, and to have the visibility defined in the pub-use re-exports from the internal module.

Put another way: what I consider most important is "locality of reasoning" about visibility. I want to be able to look at a particular declaration and understand who might be relying on it. And I can see that the model I proposed in fact violates that locality of reasoning in an example like this. Not for the inner module but for the internal module, where the pub(crate) use inner::Foo in fact exposes something publicly but only due to "action at a distance" from a pub-use in the root crate. This is exactly the kind of thing we wanted to avoid by requiring you to put pub on items that may be exported publicly from your crate by other pub use statements.

So, I'm convinced. Thanks all for the discussion. I think it'd be useful to try and capture these notes somewhere for the next time I am confused.

@traviscross traviscross removed the S-waiting-on-t-lang Status: Awaiting decision from T-lang label Jan 21, 2026
Copy link
Member

@yaahc yaahc left a comment

Choose a reason for hiding this comment

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

Is it possible to invoke this error without involving macros at all? I'm guessing it isn't and that it depends on macro_use to even be able to legally import the same item twice into the same scope with different visibility without running afoul of the "multiple decls for the same ident" error or just straight up shadowing if one import is a glob. If it is possible however I'd like to see an associated test case added.

View changes since this review

@petrochenkov
Copy link
Contributor Author

Is it possible to invoke this error without involving macros at all?

Probably, in the GlobVsOuter case?
Also I'll extend the lint to GlobVsGlob cases in a later PR (#149596 (comment)).

@yaahc
Copy link
Member

yaahc commented Jan 26, 2026

lgtm, will r+ once the fcp completes and conflicts are resolved

@petrochenkov petrochenkov added the S-waiting-on-fcp Status: PR is in FCP and is awaiting for FCP to complete. label Jan 28, 2026
@rust-rfcbot rust-rfcbot added finished-final-comment-period The final comment period is finished for this PR / Issue. to-announce Announce this issue on triage meeting and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Jan 31, 2026
@rust-rfcbot
Copy link
Collaborator

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

The new ambiguities are reported when the import's visibility is ambiguous and may depend on the resolution/expansion order.
@rustbot
Copy link
Collaborator

rustbot commented Jan 31, 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
Contributor Author

petrochenkov commented Jan 31, 2026

@bors r=yaahc

@rust-bors
Copy link
Contributor

rust-bors bot commented Jan 31, 2026

📋 This PR cannot be approved because it currently has the following label: S-waiting-on-fcp.

@petrochenkov petrochenkov removed the S-waiting-on-fcp Status: PR is in FCP and is awaiting for FCP to complete. label Jan 31, 2026
@petrochenkov
Copy link
Contributor Author

@bors r=yaahc

@rust-bors
Copy link
Contributor

rust-bors bot commented Jan 31, 2026

📌 Commit e7245c2 has been approved by yaahc

It is now in the queue for this repository.

@rust-bors rust-bors bot added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jan 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-resolve Area: Name/path resolution done by `rustc_resolve` specifically disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. I-lang-radar Items that are on lang's radar and will need eventual work or consideration. 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. T-lang Relevant to the language team to-announce Announce this issue on triage meeting

Projects

None yet

Development

Successfully merging this pull request may close these issues.