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
Existential type complains about private type in public interface if concrete type is not pub #53546
warning: private type `foo::S` in public interface (error E0446)
--> src/lib.rs:4:5
|
4 | pub existential type Foo: ::std::fmt::Debug;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: #[warn(private_in_public)] on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
Returning impl ::std::fmt::Debug does not have this restriction.
warning: private type `[closure@src/lib.rs:5:5: 5:10]` in public interface (error E0446)
--> src/lib.rs:3:1
|
3 | pub existential type X: FnOnce();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: #[warn(private_in_public)] on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
Finished dev [unoptimized + debuginfo] target(s) in 0.36s
And as far as I can tell, there isn't a way to work around this?
For some weird reason, I'm getting a hard error instead of a warning for this when it's happening in a much larger crate of mine on nightly-2019-01-09. I'm not using deny(private_in_public). Not sure whether that's related:
error[E0446]: private type `[closure@noria/src/table.rs:295:31: 295:44]` in public interface
--> noria/src/table.rs:219:5
|
219 | existential type Future: Future<Item = Tagged<()>, Error = TableError>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
...
295 | .fold((), |_, _| Ok(()))
| ------------- `[closure@noria/src/table.rs:295:31: 295:44]` declared as private
Activity
jonhoo commentedon Jan 10, 2019
This also happens with closures:
gives
And as far as I can tell, there isn't a way to work around this?
jonhoo commentedon Jan 10, 2019
This should probably be tagged
T-compiler,A-impl-trait, andA-lint.petrochenkov commentedon Jan 10, 2019
I'll look what happens.
The underlying type should not be revealed during privacy checking of
impl Traittypes.jonhoo commentedon Jan 10, 2019
For some weird reason, I'm getting a hard error instead of a warning for this when it's happening in a much larger crate of mine on
nightly-2019-01-09. I'm not usingdeny(private_in_public). Not sure whether that's related:jonhoo commentedon Jan 11, 2019
Ouch, when this is an error, it's really hard to work around. @petrochenkov any luck trying to figure out the cause of this?
Initial mitigations for rust-lang/rust#53546
petrochenkov commentedon Jan 12, 2019
Fixed in #57556
zroug commentedon Jan 15, 2019
I still get the warning for this example:
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=944fd033d23b9698f766485ec9e452c8
petrochenkov commentedon Jan 15, 2019
Reopening to investigate #53546 (comment)
petrochenkov commentedon Jan 15, 2019
#53546 (comment) is fixed in #57649
Rollup merge of rust-lang#57649 - petrochenkov:privexist, r=arielb1
Rollup merge of rust-lang#57649 - petrochenkov:privexist, r=arielb1