Skip to content
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

fix: Allow public re-export of extern crate import #18413

Merged
merged 1 commit into from
Oct 28, 2024

Conversation

ShoyuVanilla
Copy link
Member

MCVE:

//- /main.rs crate:main deps:test_crate
use test_crate::foo; // not resolving this!

use foo::Foo;

//- /lib.rs crate:test_crate deps:test_crate2
extern crate test_crate2;

pub use test_crate2 as foo;

//- /lib2.rs crate:test_crate2
pub struct Foo;

It seems that I should exempt min visibility for extern crate, as it seems to be exceptional in rustc 🤔

Originally posted by @ShoyuVanilla in #18390 (comment)

Should fix the regression made by #18390
Thank you @lnicola for pointing out this regression 👍

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 25, 2024
pub struct Exported;
struct NotExported1;
struct NotExported2;
struct NotExported3;
Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, these three items should be public visibility 😅
I'll fix this tomorrow

@ShoyuVanilla
Copy link
Member Author

ShoyuVanilla commented Oct 26, 2024

Oh, I found another bug - preexisting before #18390 - related to extern crate that should be dealt with this together.
I'll handle it as well with this

I reviewed this when I was quite tired and there's no such bug 😅
But I found this issue from rustc rust-lang/rust#127909 and addressed this in the comment

@ShoyuVanilla ShoyuVanilla marked this pull request as draft October 26, 2024 04:13
@ShoyuVanilla ShoyuVanilla force-pushed the extern-crate-reexport branch from 6c84aa8 to c8d3cd9 Compare October 27, 2024 12:46
@ShoyuVanilla ShoyuVanilla marked this pull request as ready for review October 27, 2024 12:48
let Some(ImportType::Import(id)) = def_import_type else {
return false;
};
let source = id.import.child_source(self.db);
Copy link
Member

@Veykril Veykril Oct 27, 2024

Choose a reason for hiding this comment

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

We can't use that here, this draws a dependency edge between the defmap query and the AST causing any AST change to invalidate the def map. We need to derive the relevant info from the item tree somehow

Copy link
Member Author

Choose a reason for hiding this comment

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

Okay, I'll try different approach

@ShoyuVanilla ShoyuVanilla force-pushed the extern-crate-reexport branch from c8d3cd9 to eb2a50e Compare October 27, 2024 14:45
@Veykril Veykril added this pull request to the merge queue Oct 28, 2024
Merged via the queue into rust-lang:master with commit 09547e9 Oct 28, 2024
9 checks passed
@ShoyuVanilla ShoyuVanilla deleted the extern-crate-reexport branch October 28, 2024 14:06
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
Development

Successfully merging this pull request may close these issues.

3 participants