-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
impl trait in type aliases does not trigger "private type in public interface" errors #63169
Comments
@rustbot modify labels to A-impl-trait, C-bug, F-impl_trait_type_aliases, T-lang |
This is intentional, A motivating example: pub fn f() -> impl Fn() { // OK
|| {} // It's hard to come up with something more private than a nameless fn-local closure.
} RFC: https://github.com/rust-lang/rfcs/blob/master/text/2145-type-privacy.md |
The problem is that with RFC 2515 the As an extended example this playground takes the above API and puts it into a local module ( |
(btw |
I'm not sure that's so much of a problem; notably you can still use What's nice about the current semantics is that |
I'm going to go ahead and close this as per the analysis above |
The current implementation of
existential_type
does not trigger any "private type in public interface" errors, for the following code (playground):I would expect it to give an error like
(although, because normal type aliases are transparent to the visibility checking, I'm not certain exactly what the error message should say; it just seems bad to introduce another way to accidentally forget to make part of your API publicly nameable)
cc #63063
The text was updated successfully, but these errors were encountered: