Auto merge of #46248 - zackmdavis:one_time_private_enum_variant_reexport_error, r=estebank
one-time diagnostics for private enum variants glob reëxport  r? @estebank
This commit is contained in:
commit
ea16814761
5 changed files with 148 additions and 24 deletions
|
|
@ -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() {}
|
||||
|
|
@ -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 }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue