auto merge of #18994 : sfackler/rust/struct-variants-pt2, r=jakub-

Struct variant field visibility is now inherited. Remove `pub` keywords
from declarations.

Closes #18641

[breaking-change]

r? @alexcrichton
This commit is contained in:
bors 2014-11-16 18:27:10 +00:00
commit aad75471fd
65 changed files with 60 additions and 114 deletions

View file

@ -37,7 +37,6 @@ TEMPLATE = """// Copyright {year} The Rust Project Developers. See the COPYRIGHT
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
#![feature(struct_variant)]
extern crate rand; extern crate rand;
{error_deriving} {error_deriving}

View file

@ -1402,6 +1402,9 @@ pub struct MissingDoc {
/// Stack of IDs of struct definitions. /// Stack of IDs of struct definitions.
struct_def_stack: Vec<ast::NodeId>, struct_def_stack: Vec<ast::NodeId>,
/// True if inside variant definition
in_variant: bool,
/// Stack of whether #[doc(hidden)] is set /// Stack of whether #[doc(hidden)] is set
/// at each level which has lint attributes. /// at each level which has lint attributes.
doc_hidden_stack: Vec<bool>, doc_hidden_stack: Vec<bool>,
@ -1411,6 +1414,7 @@ impl MissingDoc {
pub fn new() -> MissingDoc { pub fn new() -> MissingDoc {
MissingDoc { MissingDoc {
struct_def_stack: vec!(), struct_def_stack: vec!(),
in_variant: false,
doc_hidden_stack: vec!(false), doc_hidden_stack: vec!(false),
} }
} }
@ -1525,7 +1529,7 @@ impl LintPass for MissingDoc {
fn check_struct_field(&mut self, cx: &Context, sf: &ast::StructField) { fn check_struct_field(&mut self, cx: &Context, sf: &ast::StructField) {
match sf.node.kind { match sf.node.kind {
ast::NamedField(_, vis) if vis == ast::Public => { ast::NamedField(_, vis) if vis == ast::Public || self.in_variant => {
let cur_struct_def = *self.struct_def_stack.last() let cur_struct_def = *self.struct_def_stack.last()
.expect("empty struct_def_stack"); .expect("empty struct_def_stack");
self.check_missing_docs_attrs(cx, Some(cur_struct_def), self.check_missing_docs_attrs(cx, Some(cur_struct_def),
@ -1539,6 +1543,13 @@ impl LintPass for MissingDoc {
fn check_variant(&mut self, cx: &Context, v: &ast::Variant, _: &ast::Generics) { fn check_variant(&mut self, cx: &Context, v: &ast::Variant, _: &ast::Generics) {
self.check_missing_docs_attrs(cx, Some(v.node.id), v.node.attrs.as_slice(), self.check_missing_docs_attrs(cx, Some(v.node.id), v.node.attrs.as_slice(),
v.span, "a variant"); v.span, "a variant");
assert!(!self.in_variant);
self.in_variant = true;
}
fn check_variant_post(&mut self, _: &Context, _: &ast::Variant, _: &ast::Generics) {
assert!(self.in_variant);
self.in_variant = false;
} }
} }

View file

@ -665,6 +665,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for Context<'a, 'tcx> {
self.with_lint_attrs(v.node.attrs.as_slice(), |cx| { self.with_lint_attrs(v.node.attrs.as_slice(), |cx| {
run_lints!(cx, check_variant, v, g); run_lints!(cx, check_variant, v, g);
visit::walk_variant(cx, v, g); visit::walk_variant(cx, v, g);
run_lints!(cx, check_variant_post, v, g);
}) })
} }

View file

@ -149,6 +149,7 @@ pub trait LintPass {
_: &ast::StructDef, _: ast::Ident, _: &ast::Generics, _: ast::NodeId) { } _: &ast::StructDef, _: ast::Ident, _: &ast::Generics, _: ast::NodeId) { }
fn check_struct_field(&mut self, _: &Context, _: &ast::StructField) { } fn check_struct_field(&mut self, _: &Context, _: &ast::StructField) { }
fn check_variant(&mut self, _: &Context, _: &ast::Variant, _: &ast::Generics) { } fn check_variant(&mut self, _: &Context, _: &ast::Variant, _: &ast::Generics) { }
fn check_variant_post(&mut self, _: &Context, _: &ast::Variant, _: &ast::Generics) { }
fn check_opt_lifetime_ref(&mut self, _: &Context, _: Span, _: &Option<ast::Lifetime>) { } fn check_opt_lifetime_ref(&mut self, _: &Context, _: Span, _: &Option<ast::Lifetime>) { }
fn check_lifetime_ref(&mut self, _: &Context, _: &ast::Lifetime) { } fn check_lifetime_ref(&mut self, _: &Context, _: &ast::Lifetime) { }
fn check_lifetime_decl(&mut self, _: &Context, _: &ast::LifetimeDef) { } fn check_lifetime_decl(&mut self, _: &Context, _: &ast::LifetimeDef) { }

View file

@ -1239,6 +1239,7 @@ struct VisiblePrivateTypesVisitor<'a, 'tcx: 'a> {
tcx: &'a ty::ctxt<'tcx>, tcx: &'a ty::ctxt<'tcx>,
exported_items: &'a ExportedItems, exported_items: &'a ExportedItems,
public_items: &'a PublicItems, public_items: &'a PublicItems,
in_variant: bool,
} }
struct CheckTypeForPrivatenessVisitor<'a, 'b: 'a, 'tcx: 'b> { struct CheckTypeForPrivatenessVisitor<'a, 'b: 'a, 'tcx: 'b> {
@ -1514,13 +1515,15 @@ impl<'a, 'tcx, 'v> Visitor<'v> for VisiblePrivateTypesVisitor<'a, 'tcx> {
fn visit_variant(&mut self, v: &ast::Variant, g: &ast::Generics) { fn visit_variant(&mut self, v: &ast::Variant, g: &ast::Generics) {
if self.exported_items.contains(&v.node.id) { if self.exported_items.contains(&v.node.id) {
self.in_variant = true;
visit::walk_variant(self, v, g); visit::walk_variant(self, v, g);
self.in_variant = false;
} }
} }
fn visit_struct_field(&mut self, s: &ast::StructField) { fn visit_struct_field(&mut self, s: &ast::StructField) {
match s.node.kind { match s.node.kind {
ast::NamedField(_, ast::Public) => { ast::NamedField(_, vis) if vis == ast::Public || self.in_variant => {
visit::walk_struct_field(self, s); visit::walk_struct_field(self, s);
} }
_ => {} _ => {}
@ -1598,7 +1601,8 @@ pub fn check_crate(tcx: &ty::ctxt,
let mut visitor = VisiblePrivateTypesVisitor { let mut visitor = VisiblePrivateTypesVisitor {
tcx: tcx, tcx: tcx,
exported_items: &exported_items, exported_items: &exported_items,
public_items: &public_items public_items: &public_items,
in_variant: false,
}; };
visit::walk_crate(&mut visitor, krate); visit::walk_crate(&mut visitor, krate);
} }

View file

@ -102,10 +102,10 @@ pub enum LastPrivate {
// and whether the import is in fact used for each. // and whether the import is in fact used for each.
// If the Option<PrivateDep> fields are None, it means there is no definition // If the Option<PrivateDep> fields are None, it means there is no definition
// in that namespace. // in that namespace.
LastImport{pub value_priv: Option<PrivateDep>, LastImport{value_priv: Option<PrivateDep>,
pub value_used: ImportUse, value_used: ImportUse,
pub type_priv: Option<PrivateDep>, type_priv: Option<PrivateDep>,
pub type_used: ImportUse}, type_used: ImportUse},
} }
#[deriving(Show)] #[deriving(Show)]

View file

@ -101,9 +101,9 @@ pub enum Repr {
* otherwise it indicates the other case. * otherwise it indicates the other case.
*/ */
RawNullablePointer { RawNullablePointer {
pub nndiscr: Disr, nndiscr: Disr,
pub nnty: ty::t, nnty: ty::t,
pub nullfields: Vec<ty::t> nullfields: Vec<ty::t>
}, },
/** /**
* Two cases distinguished by a nullable pointer: the case with discriminant * Two cases distinguished by a nullable pointer: the case with discriminant
@ -117,10 +117,10 @@ pub enum Repr {
* identity function. * identity function.
*/ */
StructWrappedNullablePointer { StructWrappedNullablePointer {
pub nonnull: Struct, nonnull: Struct,
pub nndiscr: Disr, nndiscr: Disr,
pub ptrfield: PointerField, ptrfield: PointerField,
pub nullfields: Vec<ty::t>, nullfields: Vec<ty::t>,
} }
} }

View file

@ -1080,9 +1080,9 @@ impl Clean<Item> for ty::ImplOrTraitItem {
pub enum Type { pub enum Type {
/// structs/enums/traits (anything that'd be an ast::TyPath) /// structs/enums/traits (anything that'd be an ast::TyPath)
ResolvedPath { ResolvedPath {
pub path: Path, path: Path,
pub typarams: Option<Vec<TyParamBound>>, typarams: Option<Vec<TyParamBound>>,
pub did: ast::DefId, did: ast::DefId,
}, },
// I have no idea how to usefully use this. // I have no idea how to usefully use this.
TyParamBinder(ast::NodeId), TyParamBinder(ast::NodeId),
@ -1105,9 +1105,9 @@ pub enum Type {
Unique(Box<Type>), Unique(Box<Type>),
RawPointer(Mutability, Box<Type>), RawPointer(Mutability, Box<Type>),
BorrowedRef { BorrowedRef {
pub lifetime: Option<Lifetime>, lifetime: Option<Lifetime>,
pub mutability: Mutability, mutability: Mutability,
pub type_: Box<Type>, type_: Box<Type>,
}, },
// region, raw, other boxes, mutable // region, raw, other boxes, mutable
} }

View file

@ -1293,8 +1293,8 @@ pub type Variant = Spanned<Variant_>;
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
pub enum PathListItem_ { pub enum PathListItem_ {
PathListIdent { pub name: Ident, pub id: NodeId }, PathListIdent { name: Ident, id: NodeId },
PathListMod { pub id: NodeId } PathListMod { id: NodeId }
} }
impl PathListItem_ { impl PathListItem_ {

View file

@ -37,7 +37,7 @@ use std::slice;
static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[
("globs", Active), ("globs", Active),
("macro_rules", Active), ("macro_rules", Active),
("struct_variant", Active), ("struct_variant", Accepted),
("asm", Active), ("asm", Active),
("managed_boxes", Removed), ("managed_boxes", Removed),
("non_ascii_idents", Active), ("non_ascii_idents", Active),
@ -184,19 +184,6 @@ impl<'a, 'v> Visitor<'v> for Context<'a> {
} }
} }
match i.node { match i.node {
ast::ItemEnum(ref def, _) => {
for variant in def.variants.iter() {
match variant.node.kind {
ast::StructVariantKind(..) => {
self.gate_feature("struct_variant", variant.span,
"enum struct variants are \
experimental and possibly buggy");
}
_ => {}
}
}
}
ast::ItemForeignMod(ref foreign_module) => { ast::ItemForeignMod(ref foreign_module) => {
if attr::contains_name(i.attrs.as_slice(), "link_args") { if attr::contains_name(i.attrs.as_slice(), "link_args") {
self.gate_feature("link_args", i.span, self.gate_feature("link_args", i.span,

View file

@ -4612,7 +4612,7 @@ impl<'a> Parser<'a> {
is_tuple_like = false; is_tuple_like = false;
fields = Vec::new(); fields = Vec::new();
while self.token != token::CloseDelim(token::Brace) { while self.token != token::CloseDelim(token::Brace) {
fields.push(self.parse_struct_decl_field()); fields.push(self.parse_struct_decl_field(true));
} }
if fields.len() == 0 { if fields.len() == 0 {
self.fatal(format!("unit-like struct definition should be \ self.fatal(format!("unit-like struct definition should be \
@ -4689,11 +4689,15 @@ impl<'a> Parser<'a> {
} }
/// Parse an element of a struct definition /// Parse an element of a struct definition
fn parse_struct_decl_field(&mut self) -> StructField { fn parse_struct_decl_field(&mut self, allow_pub: bool) -> StructField {
let attrs = self.parse_outer_attributes(); let attrs = self.parse_outer_attributes();
if self.eat_keyword(keywords::Pub) { if self.eat_keyword(keywords::Pub) {
if !allow_pub {
let span = self.last_span;
self.span_err(span, "`pub` is not allowed here");
}
return self.parse_single_struct_field(Public, attrs); return self.parse_single_struct_field(Public, attrs);
} }
@ -5142,7 +5146,7 @@ impl<'a> Parser<'a> {
fn parse_struct_def(&mut self) -> P<StructDef> { fn parse_struct_def(&mut self) -> P<StructDef> {
let mut fields: Vec<StructField> = Vec::new(); let mut fields: Vec<StructField> = Vec::new();
while self.token != token::CloseDelim(token::Brace) { while self.token != token::CloseDelim(token::Brace) {
fields.push(self.parse_struct_decl_field()); fields.push(self.parse_struct_decl_field(false));
} }
self.bump(); self.bump();

View file

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#![feature(struct_variant)]
use std::num::FromPrimitive; use std::num::FromPrimitive;
use std::int; use std::int;

View file

@ -10,7 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
#![feature(struct_variant)]
extern crate rand; extern crate rand;

View file

@ -10,7 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
#![feature(struct_variant)]
extern crate rand; extern crate rand;

View file

@ -10,7 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
#![feature(struct_variant)]
extern crate rand; extern crate rand;

View file

@ -10,7 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
#![feature(struct_variant)]
extern crate rand; extern crate rand;

View file

@ -10,7 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
#![feature(struct_variant)]
extern crate rand; extern crate rand;

View file

@ -10,7 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
#![feature(struct_variant)]
extern crate rand; extern crate rand;

View file

@ -10,7 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
#![feature(struct_variant)]
extern crate rand; extern crate rand;

View file

@ -10,7 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
#![feature(struct_variant)]
extern crate rand; extern crate rand;

View file

@ -10,7 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
#![feature(struct_variant)]
extern crate rand; extern crate rand;

View file

@ -10,7 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
#![feature(struct_variant)]
extern crate rand; extern crate rand;

View file

@ -10,7 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
#![feature(struct_variant)]
extern crate rand; extern crate rand;

View file

@ -10,7 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
#![feature(struct_variant)]
extern crate rand; extern crate rand;

View file

@ -10,7 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
#![feature(struct_variant)]
extern crate rand; extern crate rand;

View file

@ -10,7 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
#![feature(struct_variant)]
extern crate rand; extern crate rand;

View file

@ -10,7 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
#![feature(struct_variant)]
extern crate rand; extern crate rand;
#[deriving(PartialEq)] #[deriving(PartialEq)]

View file

@ -10,7 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
#![feature(struct_variant)]
extern crate rand; extern crate rand;
#[deriving(PartialEq)] #[deriving(PartialEq)]

View file

@ -10,7 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
#![feature(struct_variant)]
extern crate rand; extern crate rand;
#[deriving(PartialEq)] #[deriving(PartialEq)]

View file

@ -10,7 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
#![feature(struct_variant)]
extern crate rand; extern crate rand;
#[deriving(PartialEq)] #[deriving(PartialEq)]

View file

@ -10,7 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
#![feature(struct_variant)]
extern crate rand; extern crate rand;

View file

@ -10,7 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
#![feature(struct_variant)]
extern crate rand; extern crate rand;

View file

@ -10,7 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
#![feature(struct_variant)]
extern crate rand; extern crate rand;

View file

@ -10,7 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
#![feature(struct_variant)]
extern crate rand; extern crate rand;

View file

@ -10,7 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
#![feature(struct_variant)]
extern crate rand; extern crate rand;

View file

@ -10,7 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
#![feature(struct_variant)]
extern crate rand; extern crate rand;

View file

@ -10,7 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
#![feature(struct_variant)]
extern crate rand; extern crate rand;

View file

@ -10,7 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
#![feature(struct_variant)]
extern crate rand; extern crate rand;

View file

@ -10,7 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
#![feature(struct_variant)]
extern crate rand; extern crate rand;
#[deriving(PartialEq)] #[deriving(PartialEq)]

View file

@ -10,7 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
#![feature(struct_variant)]
extern crate rand; extern crate rand;
#[deriving(PartialEq)] #[deriving(PartialEq)]

View file

@ -10,7 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
#![feature(struct_variant)]
extern crate rand; extern crate rand;
#[deriving(PartialEq)] #[deriving(PartialEq)]

View file

@ -10,7 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
#![feature(struct_variant)]
extern crate rand; extern crate rand;
#[deriving(PartialEq)] #[deriving(PartialEq)]

View file

@ -10,7 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
#![feature(struct_variant)]
extern crate rand; extern crate rand;
#[deriving(Eq,PartialOrd,PartialEq)] #[deriving(Eq,PartialOrd,PartialEq)]

View file

@ -10,7 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
#![feature(struct_variant)]
extern crate rand; extern crate rand;
#[deriving(Eq,PartialOrd,PartialEq)] #[deriving(Eq,PartialOrd,PartialEq)]

View file

@ -10,7 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
#![feature(struct_variant)]
extern crate rand; extern crate rand;
#[deriving(Eq,PartialOrd,PartialEq)] #[deriving(Eq,PartialOrd,PartialEq)]

View file

@ -10,7 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
#![feature(struct_variant)]
extern crate rand; extern crate rand;
#[deriving(Eq,PartialOrd,PartialEq)] #[deriving(Eq,PartialOrd,PartialEq)]

View file

@ -10,7 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
#![feature(struct_variant)]
extern crate rand; extern crate rand;

View file

@ -10,7 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
#![feature(struct_variant)]
extern crate rand; extern crate rand;

View file

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#![feature(struct_variant)]
enum Foo { C { a: int, b: int } } enum Foo { C { a: int, b: int } }
struct C { a: int, b: int } //~ ERROR error: duplicate definition of type or module `C` struct C { a: int, b: int } //~ ERROR error: duplicate definition of type or module `C`

View file

@ -8,9 +8,6 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#![feature(struct_variant)]
extern crate bäz; //~ ERROR non-ascii idents extern crate bäz; //~ ERROR non-ascii idents
use föö::bar; //~ ERROR non-ascii idents use föö::bar; //~ ERROR non-ascii idents

View file

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#![feature(struct_variant)]
mod a { mod a {
pub enum Enum { pub enum Enum {
EnumStructVariant { x: u8, y: u8, z: u8 } EnumStructVariant { x: u8, y: u8, z: u8 }

View file

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#![feature(struct_variant)]
enum Foo { enum Foo {
Variant { x: uint } Variant { x: uint }
} }

View file

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#![feature(struct_variant)]
#![allow(unused_variables)] #![allow(unused_variables)]
#![allow(non_camel_case_types)] #![allow(non_camel_case_types)]
#![deny(dead_code)] #![deny(dead_code)]

View file

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#![feature(struct_variant)]
#![allow(unused_variables)] #![allow(unused_variables)]
#![deny(dead_code)] #![deny(dead_code)]

View file

@ -10,7 +10,6 @@
// When denying at the crate level, be sure to not get random warnings from the // When denying at the crate level, be sure to not get random warnings from the
// injected intrinsics by the compiler. // injected intrinsics by the compiler.
#![feature(struct_variant)]
#![feature(globs)] #![feature(globs)]
#![deny(missing_docs)] #![deny(missing_docs)]
#![allow(dead_code)] #![allow(dead_code)]
@ -106,8 +105,7 @@ enum Baz {
pub enum PubBaz { //~ ERROR: missing documentation pub enum PubBaz { //~ ERROR: missing documentation
PubBazA { //~ ERROR: missing documentation PubBazA { //~ ERROR: missing documentation
pub a: int, //~ ERROR: missing documentation a: int, //~ ERROR: missing documentation
b: int
}, },
} }
@ -116,15 +114,13 @@ pub enum PubBaz2 {
/// dox /// dox
PubBaz2A { PubBaz2A {
/// dox /// dox
pub a: int, a: int,
b: int
}, },
} }
#[allow(missing_docs)] #[allow(missing_docs)]
pub enum PubBaz3 { pub enum PubBaz3 {
PubBaz3A { PubBaz3A {
pub a: int,
b: int b: int
}, },
} }

View file

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#![feature(struct_variant)]
#![allow(dead_code)] #![allow(dead_code)]
#![deny(raw_pointer_deriving)] #![deny(raw_pointer_deriving)]

View file

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#![feature(struct_variant)]
#![deny(visible_private_types)] #![deny(visible_private_types)]
#![allow(dead_code)] #![allow(dead_code)]
#![crate_type="lib"] #![crate_type="lib"]
@ -57,8 +56,7 @@ struct Bar {
pub enum Baz { pub enum Baz {
Baz1(Private<int>), //~ ERROR private type in exported type signature Baz1(Private<int>), //~ ERROR private type in exported type signature
Baz2 { Baz2 {
pub x: Private<int>, //~ ERROR private type in exported type signature y: Private<int> //~ ERROR private type in exported type signature
y: Private<int>
}, },
} }

View file

@ -9,7 +9,7 @@
// except according to those terms. // except according to those terms.
// aux-build:namespaced_enums.rs // aux-build:namespaced_enums.rs
#![feature(struct_variant, globs)] #![feature(globs)]
extern crate namespaced_enums; extern crate namespaced_enums;

View file

@ -7,7 +7,7 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#![feature(struct_variant, globs)] #![feature(globs)]
mod m2 { mod m2 {
pub enum Foo { pub enum Foo {

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#![feature(advanced_slice_patterns, struct_variant)] #![feature(advanced_slice_patterns)]
struct Foo { struct Foo {
first: bool, first: bool,

View file

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#![feature(struct_variant)]
enum A { enum A {
B { x: Option<int> }, B { x: Option<int> },
C C

View file

@ -1,4 +1,4 @@
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. // http://rust-lang.org/COPYRIGHT.
// //
@ -8,8 +8,10 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
enum A { B { foo: int } } enum Foo {
//~^ ERROR: enum struct variants are experimental Bar {
pub a: int //~ ERROR: `pub` is not allowed here
}
}
fn main() {} fn main() {}

View file

@ -9,8 +9,6 @@
// except according to those terms. // except according to those terms.
// aux-build:struct_variant_privacy.rs // aux-build:struct_variant_privacy.rs
#![feature(struct_variant)]
extern crate struct_variant_privacy; extern crate struct_variant_privacy;
fn f(b: struct_variant_privacy::Bar) { //~ ERROR enum `Bar` is private fn f(b: struct_variant_privacy::Bar) { //~ ERROR enum `Bar` is private

View file

@ -7,8 +7,6 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#![feature(struct_variant)]
mod foo { mod foo {
enum Bar { enum Bar {
Baz { a: int } Baz { a: int }

View file

@ -7,7 +7,6 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#![feature(struct_variant)]
// Test `Sized?` types not allowed in fields (except the last one). // Test `Sized?` types not allowed in fields (except the last one).