Skip to content

fix: let glob imports override other globs' visibility #17715

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

Merged
merged 1 commit into from
Jul 29, 2024

Conversation

Throne3d
Copy link
Contributor

Follow up to #14930

Fixes #11858
Fixes #14902
Fixes #17704

I haven't reworked the code here at all - I don't feel confident in the codebase to do so - just rebased it onto the current main branch and fixed conflicts.

I'm not entirely sure I understand the structure of the check function in crates/hir-def/src/nameres tests. I think the change to the test expectation from #14930 is correct, marking the crate::reexport::inner imports with i, and I understand it to mean there's a specific token in the import that we can match it to (in this case, Trait, function and makro of pub use crate::defs::{Trait, function, makro}; respectively), but I had some trouble understanding the meaning of the different parts of PerNs to be sure.
Does this make sense?

I tested building and using RA locally with cargo xtask install and after this change the documentation for arrow_array::ArrowPrimitiveType seems to be picked up correctly!

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 27, 2024
Comment on lines +1129 to +1130
if let Some((def, def_vis, _)) = defs.types {
if let Some((prev_def, prev_vis, _)) = prev_defs.types {
Copy link
Contributor Author

@Throne3d Throne3d Jul 27, 2024

Choose a reason for hiding this comment

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

I believe the third parameter here is the location/token the import occurred at, if the type is named directly (rather than a glob or such) - it seems it wasn't present at the time the code was written, but I don't think there's a condition necessary on it here, so hopefully it's correct to leave it ignored here.

If you can think of any test cases to add to validate if there are other necessary conditions here, I'd appreciate any suggestions!

@Veykril
Copy link
Member

Veykril commented Jul 29, 2024

@bors r+

@bors
Copy link
Contributor

bors commented Jul 29, 2024

📌 Commit fdb367a has been approved by Veykril

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Jul 29, 2024

⌛ Testing commit fdb367a with merge 0cbcbb0...

@bors
Copy link
Contributor

bors commented Jul 29, 2024

☀️ Test successful - checks-actions
Approved by: Veykril
Pushing 0cbcbb0 to master...

@bors bors merged commit 0cbcbb0 into rust-lang:master Jul 29, 2024
11 checks passed
@Throne3d Throne3d deleted the fix/glob-may-override-vis-2 branch August 3, 2024 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
5 participants