Rust: Rust complains about "private type in public interface" even though the type and interface are both aliases.

Created on 16 Jun 2016  ·  1Comment  ·  Source: rust-lang/rust

use core::nonzero::NonZero;
use std::os::raw::c_void;

type Foo = NonZero<*const c_void>;

// warning: private type in public interface
pub type Bar = Foo;
// warning: private type in public interface
pub type Baz = Foo;

I also tried pub useing NonZero and c_void but that didn't help, so it's not the types themselves that are the problem. It seems bizarre that Rust would complain about this behaviour when, for example, error messages are unaware of aliases. Even if they were, it would be trivial to resolve private aliases to the public types they are defined as, so I can't see the utility of disallowing this.

My rustc --version --verbose:

rustc 1.11.0-nightly (6b4511755 2016-06-14)
binary: rustc
commit-hash: 6b4511755cfe63a46f2db8c72145e07f94911c08
commit-date: 2016-06-14
host: x86_64-unknown-linux-gnu
release: 1.11.0-nightly

Most helpful comment

There's an issue about this (https://github.com/rust-lang/rust/issues/30503) and a PR fixing this (https://github.com/rust-lang/rust/pull/34193).
This could be implemented more than half a year ago, it's just decision making is sometimes super slow for secondary non-prioritized features.

>All comments

There's an issue about this (https://github.com/rust-lang/rust/issues/30503) and a PR fixing this (https://github.com/rust-lang/rust/pull/34193).
This could be implemented more than half a year ago, it's just decision making is sometimes super slow for secondary non-prioritized features.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dtolnay picture dtolnay  ·  3Comments

SharplEr picture SharplEr  ·  3Comments

dnsl48 picture dnsl48  ·  3Comments

pedrohjordao picture pedrohjordao  ·  3Comments

modsec picture modsec  ·  3Comments