Skip to content

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

Closed
@jmegaffin

Description

@jmegaffin
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions