Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upStabilize pub(restricted) #40556
Conversation
rust-highfive
assigned
nikomatsakis
Mar 15, 2017
This comment has been minimized.
This comment has been minimized.
|
(rust_highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
|
Shouldn't we first just stabilize |
This comment has been minimized.
This comment has been minimized.
|
@retep998 That seems reasonable to me. |
cramertj
force-pushed the
cramertj:stabilize-pub-restricted
branch
from
862e42b
to
376739f
Mar 15, 2017
This comment has been minimized.
This comment has been minimized.
|
@retep998 I'll have a new commit up in a minute with that change. |
cramertj
changed the title
Stabilize pub(restricted) and convert private in public to a hard error
Stabilize pub(restricted)
Mar 15, 2017
petrochenkov
reviewed
Mar 15, 2017
| format!("private type `{}` in public \ | ||
| interface (error E0446)", ty)); | ||
| } | ||
| let mut err = struct_span_err!(self.tcx.sess, self.span, E0446, |
This comment has been minimized.
This comment has been minimized.
petrochenkov
Mar 15, 2017
Contributor
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.
This comment has been minimized.
This comment has been minimized.
cramertj
Mar 15, 2017
Author
Member
What do you mean by not private? Visibility is either Public, Restricted(DefId), or Invisible (reserved for private external items).
This comment has been minimized.
This comment has been minimized.
petrochenkov
Mar 15, 2017
•
Contributor
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.
This comment has been minimized.
This comment has been minimized.
cramertj
Mar 15, 2017
Author
Member
Even for hir::Visibility, I still only see Public, Crate, Restricted {...}, and Inherited, no Private. Am I missing something obvious?
This comment has been minimized.
This comment has been minimized.
cramertj
force-pushed the
cramertj:stabilize-pub-restricted
branch
from
376739f
to
7447348
Mar 15, 2017
sfackler
added
the
beta-nominated
label
Mar 16, 2017
This comment has been minimized.
This comment has been minimized.
|
Beta nominating since I think @aturon was interested in landing this in 1.17. |
cramertj
force-pushed the
cramertj:stabilize-pub-restricted
branch
from
7447348
to
28626ca
Mar 16, 2017
This comment has been minimized.
This comment has been minimized.
|
I'm not inclined to backport a stabilization -- or at least not this one. |
This comment has been minimized.
This comment has been minimized.
|
@bors r+ |
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
Note: doc pr is here: rust-lang-nursery/reference#12 |
This comment has been minimized.
This comment has been minimized.
|
Right now this PR turns all private-in-public errors for @bors r- |
This comment has been minimized.
This comment has been minimized.
|
Hmm. I see. OK, that probably makes sense. |
This comment has been minimized.
This comment has been minimized.
|
I disagree with this stabilization. This is a poor implementation of |
nikomatsakis
removed
the
beta-nominated
label
Mar 16, 2017
This comment has been minimized.
This comment has been minimized.
|
Removing beta-nominated. Seems like there is no need to backport a stabilization, no great urgency. |
This comment has been minimized.
This comment has been minimized.
|
Okay, I remove my disagreement, actually (sorry). I read more of the reasoning behind the need for |
This comment has been minimized.
This comment has been minimized.
|
@cramertj |
This comment has been minimized.
This comment has been minimized.
|
@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 |
This comment has been minimized.
This comment has been minimized.
Exactly. |
This comment has been minimized.
This comment has been minimized.
|
r? @petrochenkov -- since you have something specific in mind =) |
rust-highfive
unassigned
nikomatsakis
Mar 20, 2017
rust-highfive
assigned
petrochenkov
Mar 20, 2017
This comment has been minimized.
This comment has been minimized.
|
@bors r+ |
This comment has been minimized.
This comment has been minimized.
|
|
cramertj commentedMar 15, 2017
Fix #32409