librustc: Require that types mentioned anywhere in public signatures be
public, including in trait bounds and typedefs.

There are three main patterns that this breaks. First is code that uses
private trait bounds in public APIs:

    pub mod a {
        trait Trait { ... }
        pub fn f<T:Trait>() { ... }
    }

Change that code to export the trait. For example:

    pub mod a {
        pub trait Trait { ... }     // note `pub`
        pub fn f<T:Trait>() { ... }
    }

Second, this change breaks code that was relying on
`#[allow(visible_private_types)]`. That lint is now a hard error, and
cannot be overridden. For example:

    mod helper {
        pub struct Foo { ... }
    }
    pub mod public {
        use helper::Foo;
        pub fn f() -> Foo;
    }

Because there is no way for code that uses `public::f` to name `Foo`,
this is no longer allowed. Change affected code to look like this:

    pub mod helper {    // note `pub`
        pub struct Foo { ... }
    }
    pub mod public {
        use helper::Foo;
        pub fn f() -> Foo;
    }

Third, this change breaks code that was relying on being able to
reference private typedefs in public APIs. For example:

    pub mod b {
        type Foo = int;
        pub fn f(_: Foo) { ... }
    }

Change this code to:

    pub mod b {
        pub type Foo = int; // note `pub`
        pub fn f(_: Foo) { ... }
    }

For now, the old behavior can be obtained with
`#[feature(visible_private_types)]`. However, the preciase semantics of
this feature gate may be unstable.

This implements RFC #48.

Closes #16463.

[breaking-change]
auto merge of #16467 : pcwalton/rust/visible-private-types, r=alexcrichton

public, including in trait bounds and typedefs.

There are three main patterns that this breaks. First is code that uses
private trait bounds in public APIs:

    pub mod a {
        trait Trait { ... }
        pub fn f<T:Trait>() { ... }
    }

Change that code to export the trait. For example:

    pub mod a {
        pub trait Trait { ... }     // note `pub`
        pub fn f<T:Trait>() { ... }
    }

Second, this change breaks code that was relying on
`#[allow(visible_private_types)]`. That lint is now a hard error, and
cannot be overridden. For example:

    mod helper {
        pub struct Foo { ... }
    }
    pub mod public {
        use helper::Foo;
        pub fn f() -> Foo;
    }

Because there is no way for code that uses `public::f` to name `Foo`,
this is no longer allowed. Change affected code to look like this:

    pub mod helper {    // note `pub`
        pub struct Foo { ... }
    }
    pub mod public {
        use helper::Foo;
        pub fn f() -> Foo;
    }

Third, this change breaks code that was relying on being able to
reference private typedefs in public APIs. For example:

    pub mod b {
        type Foo = int;
        pub fn f(_: Foo) { ... }
    }

Change this code to:

    pub mod b {
        pub type Foo = int; // note `pub`
        pub fn f(_: Foo) { ... }
    }

This implements RFC #48.

Closes #16463.

[breaking-change]

r? @alexcrichton