Auto merge of #46248 - zackmdavis:one_time_private_enum_variant_reexport_error, r=estebank

one-time diagnostics for private enum variants glob reëxport

![private_enum_reexport](https://user-images.githubusercontent.com/1076988/33224719-4e5805f0-d121-11e7-8bc0-a708a277a5db.png)

r? @estebank
This commit is contained in:
bors 2017-12-10 23:32:09 +00:00
commit ea16814761
5 changed files with 148 additions and 24 deletions

View file

@ -0,0 +1,51 @@
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(crate_visibility_modifier)]
mod rank {
pub use self::Professor::*;
//~^ ERROR enum is private and its variants cannot be reexported
pub use self::Lieutenant::{JuniorGrade, Full};
//~^ ERROR variant `JuniorGrade` is private and cannot be reexported
//~| ERROR variant `Full` is private and cannot be reexported
pub use self::PettyOfficer::*;
//~^ ERROR enum is private and its variants cannot be reexported
pub use self::Crewman::*;
//~^ ERROR enum is private and its variants cannot be reexported
enum Professor {
Adjunct,
Assistant,
Associate,
Full
}
enum Lieutenant {
JuniorGrade,
Full,
}
pub(in rank) enum PettyOfficer {
SecondClass,
FirstClass,
Chief,
MasterChief
}
crate enum Crewman {
Recruit,
Apprentice,
Full
}
}
fn main() {}

View file

@ -9,19 +9,19 @@
// except according to those terms.
mod m1 {
pub use ::E::V; //~ ERROR variant `V` is private, and cannot be reexported
pub use ::E::V; //~ ERROR variant `V` is private and cannot be reexported
}
mod m2 {
pub use ::E::{V}; //~ ERROR variant `V` is private, and cannot be reexported
pub use ::E::{V}; //~ ERROR variant `V` is private and cannot be reexported
}
mod m3 {
pub use ::E::V::{self}; //~ ERROR variant `V` is private, and cannot be reexported
pub use ::E::V::{self}; //~ ERROR variant `V` is private and cannot be reexported
}
mod m4 {
pub use ::E::*; //~ ERROR variant `V` is private, and cannot be reexported
pub use ::E::*; //~ ERROR enum is private and its variants cannot be reexported
}
enum E { V }