-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Add a new unstable flag -Ztreat-pub-as-pub-crate
#149509
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
|
rustbot has assigned @jdonszelmann. Use |
-Ztreat-pub-as-pub-crate
-Ztreat-pub-as-pub-crate-Ztreat-pub-as-pub-crate
|
What are the plans for this flag? Being made the default? As just a flag, it's essentially useless, because no one will know about it. So I'd be opposed to just adding it without any plan for making it useful for everyone. |
5a9bdfc to
5885285
Compare
6541f80 to
8ac52ba
Compare
|
Maybe this could be a separate lint, I haven't thought too clearly yet |
|
Yea I do agree with nora here, maybe open a (specific) zulip thread to make a proper plan for this? |
|
I guess I'd prefer this as a lint (attribute at the crate root) myself |
|
@rustbot author |
|
Reminder, once the PR becomes ready for a review, use |
|
I guess that the use-case that I'm envisioning is to have an opt-in way to treat |
|
Why would the end goal be for this to be opt-in? I and others want to see #74970 become a default. I wouldn't opt into this, because that would make my codebase less idiomatic, diverging from how everyone else who hasn't opted in uses The reason this is useful as a default is because it doesn't semantically make sense to distinguish between The only reason I can see that someone might not want to opt into this is that one might use |
This PR adds a new unstable flag
-Ztreat-pub-as-pub-crateas @Kobzol suggested.When compiling binary crates with this flag, the seed worklist will only contain the entry fn and won't contain other reachable items. Then we can do the dead code analysis for
pubitems just like they arepub(crate).Related zulip thread #general > pub/pub(crate) within a binary is a footgun.