You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
"Private" impl functions can leak out of a module when defined on a public type #33479
"Private" impl functions can leak out of a module when defined on a public type. This can allow private types to appear as part of a modules' public interface.
In this example, the type Private leaks out of the_module via the impl Public<Private> impl block. It looks like all functions in that block should be inferred to be private?
Yep, incarnation of #30476 (although the example is sufficiently different from those given in #30476), one more example of type inference being too smart.
Private-in-public checker assumes that the type Public<Private> is private and therefore its impls are private, because you can't name it or construct its values outside of its module without using Private.
However, type inference is able to infer private type parameters in some cases and it's not something generally fixable with private-in-public checker alone.
Activity
deadalusai commentedon May 7, 2016
This issue seems similar.
petrochenkov commentedon May 7, 2016
Yep, incarnation of #30476 (although the example is sufficiently different from those given in #30476), one more example of type inference being too smart.
Private-in-public checker assumes that the type
Public<Private>is private and therefore its impls are private, because you can't name it or construct its values outside of its module without usingPrivate.However, type inference is able to infer private type parameters in some cases and it's not something generally fixable with private-in-public checker alone.
Auto merge of #42125 - petrochenkov:privty, r=<try>
Auto merge of #42125 - petrochenkov:privty, r=nikomatsakis