-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
resolve: Report more visibility-related early resolution ambiguities for imports #149596
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
@bors try |
This comment has been minimized.
This comment has been minimized.
resolve: Report more early resolution ambiguities for imports
|
|
|
@craterbot run mode=check-only p=1 crates=https://crater-reports.s3.amazonaws.com/pr-149145/retry-regressed-list.txt |
|
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
|
🚧 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
|
🎉 Experiment
Footnotes
|
9c25090 to
1ea10c2
Compare
This comment has been minimized.
This comment has been minimized.
|
@bors try |
This comment has been minimized.
This comment has been minimized.
resolve: Report more early resolution ambiguities for imports
|
ping @joshtriplett @nikomatsakis @scottmcm |
|
Checking a box on this. Separately, I'm looking forward to the future edition changes proposed in #148610 to simplify |
|
🔔 This is now entering its final comment period, as per the review above. 🔔 |
|
@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 crateHere, here the intent of the 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 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. |
There was a problem hiding this 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.
Probably, in the |
|
lgtm, will r+ once the fcp completes and conflicts are resolved |
|
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.
4713099 to
e7245c2
Compare
|
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 r=yaahc |
|
📋 This PR cannot be approved because it currently has the following label: |
|
@bors r=yaahc |
The new ambiguities are reported when the import's visibility is ambiguous and may depend on the resolution/expansion order.
Detailed description: #149596 (comment).