-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
private_in_public lint triggered for pub associated type computed using non-pub trait #45713
Comments
This is a limitation of implementation, not some language privacy rule. From RFC 2145:
That's exactly the case here, the type turns out to not be normalized enough before privacy checking. |
ping @lcnr I strongly suspect that we have some "fully normalize" type operation now that would work in signatures and would help us to eliminate all intermediate (associated) type aliases from types during privacy checking. (I.e. going from If you could point to the right tools, then we could eliminate this piece of technical debt from privacy checking. |
#113671 is starting to address this issue. |
This is affecting zerocopy: google/zerocopy#1292 |
If you're dealing with |
I've put up a PR: #126076 |
This permits associated types to reference private types and traits, so long as the normalized type does not itself violate type privacy. Fixes rust-lang#45713
This permits associated types to reference private types and traits, so long as the normalized type does not itself violate type privacy. Fixes rust-lang#45713
This permits associated types to reference private types and traits, so long as the normalized type does not itself violate type privacy. Fixes rust-lang#45713
privacy: normalize associated types before visiting This permits associated types to reference private types and traits, so long as the normalized type does not itself violate type privacy. Fixes rust-lang#45713 <!-- If this PR is related to an unstable feature or an otherwise tracked effort, please link to the relevant tracking issue here. If you don't know of a related tracking issue or there are none, feel free to ignore this. This PR will get automatically assigned to a reviewer. In case you would like a specific user to review your work, you can assign it to them by using r? <reviewer name> -->
privacy: normalize associated types before visiting This permits associated types to reference private types and traits, so long as the normalized type does not itself violate type privacy. Fixes rust-lang#45713 <!-- If this PR is related to an unstable feature or an otherwise tracked effort, please link to the relevant tracking issue here. If you don't know of a related tracking issue or there are none, feel free to ignore this. This PR will get automatically assigned to a reviewer. In case you would like a specific user to review your work, you can assign it to them by using r? <reviewer name> -->
This permits associated types to reference private types and traits, so long as the normalized type does not itself violate type privacy. Fixes rust-lang#45713
This permits associated types to reference private types and traits, so long as the normalized type does not itself violate type privacy. Fixes rust-lang#45713
I was surprised to get a private_in_public deprecation warning for using a private trait to compute an associated type that's itself pub.
De-macro'd, shortened example of what I was doing:
Repro: https://play.rust-lang.org/?gist=1f84c630e07ddd54d2bf208aa85ed8bb&version=nightly
I don't understand how that type is part of the public interface, since I can't get to it using TryFrom.
(Do close if this is known and covered by things like rust-lang/rfcs#1671 (comment), but I couldn't find any issues talking about this part at least.)
The text was updated successfully, but these errors were encountered: