-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Stabilize pub(restricted) #40556
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
Stabilize pub(restricted) #40556
Conversation
|
(rust_highfive has picked a reviewer for you, use r? to override) |
|
Shouldn't we first just stabilize |
|
@retep998 That seems reasonable to me. |
862e42b to
376739f
Compare
|
@retep998 I'll have a new commit up in a minute with that change. |
src/librustc_privacy/lib.rs
Outdated
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.
private_in_public can't be turned into an error in the near future unfortunately.
self.tcx.sess.features.borrow().pub_restricted can be well approximated with is_pub_restricted(vis) && is_pub_restricted(self.required_visibility) where is_pub_restricted = not pub && not private.
The idea is to always report an error and not warning when pub(something) is involved.
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.
What do you mean by not private? Visibility is either Public, Restricted(DefId), or Invisible (reserved for private external items).
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.
You can use hir::Visibility for this (as opposed to ty::Visibility).
For vis HIR visibility is immediately available (item.vis) , for self.required_visibility you can pass it from PrivateItemsInPublicInterfacesVisitor::visit_item to here somehow.
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.
Even for hir::Visibility, I still only see Public, Crate, Restricted {...}, and Inherited, no Private. Am I missing something obvious?
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.
Inherited is private (i.e. no any explicit pub)
376739f to
7447348
Compare
|
Beta nominating since I think @aturon was interested in landing this in 1.17. |
7447348 to
28626ca
Compare
|
I'm not inclined to backport a stabilization -- or at least not this one. |
|
@bors r+ |
|
📌 Commit 28626ca has been approved by |
|
Note: doc pr is here: rust-lang/reference#12 |
|
Right now this PR turns all private-in-public errors for @bors r- |
|
Hmm. I see. OK, that probably makes sense. |
|
I disagree with this stabilization. This is a poor implementation of |
|
Removing beta-nominated. Seems like there is no need to backport a stabilization, no great urgency. |
|
Okay, I remove my disagreement, actually (sorry). I read more of the reasoning behind the need for |
|
@cramertj |
|
@petrochenkov I was just finishing up piping Just to make sure I understood you: the process is to add a new visitor which runs in |
Exactly. |
|
r? @petrochenkov -- since you have something specific in mind =) |
|
@bors r+ |
|
📌 Commit 60c1c96 has been approved by |
…r=petrochenkov Stabilize pub(restricted) Fix rust-lang#32409
support pub(restricted) in thread_local! (round 2) Resurrected #40984 now that the issue blocking it was fixed. Original description: `pub(restricted)` was stabilized in #40556 so let's go! Here is a [playground](https://play.rust-lang.org/?gist=f55f32f164a6ed18c219fec8f8293b98&version=nightly&backtrace=1). I changed the interface of `__thread_local_inner!`, which is supposedly unstable but this is not checked for macros (#34097 cc @petrochenkov @jseyfried), so this may be an issue.
Fix #32409