diff --git a/src/etc/generate-deriving-span-tests.py b/src/etc/generate-deriving-span-tests.py index 94b3fb6b93aa4..1e5d5ccf339c3 100755 --- a/src/etc/generate-deriving-span-tests.py +++ b/src/etc/generate-deriving-span-tests.py @@ -37,7 +37,6 @@ // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' -#![feature(struct_variant)] extern crate rand; {error_deriving} diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs index 86dd967026b84..9d975c7aebca3 100644 --- a/src/librustc/lint/builtin.rs +++ b/src/librustc/lint/builtin.rs @@ -1399,6 +1399,9 @@ pub struct MissingDoc { /// Stack of IDs of struct definitions. struct_def_stack: Vec, + /// True if inside variant definition + in_variant: bool, + /// Stack of whether #[doc(hidden)] is set /// at each level which has lint attributes. doc_hidden_stack: Vec, @@ -1408,6 +1411,7 @@ impl MissingDoc { pub fn new() -> MissingDoc { MissingDoc { struct_def_stack: vec!(), + in_variant: false, doc_hidden_stack: vec!(false), } } @@ -1522,7 +1526,7 @@ impl LintPass for MissingDoc { fn check_struct_field(&mut self, cx: &Context, sf: &ast::StructField) { 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() .expect("empty struct_def_stack"); self.check_missing_docs_attrs(cx, Some(cur_struct_def), @@ -1536,6 +1540,13 @@ impl LintPass for MissingDoc { 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(), 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; } } diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs index 7f8b779dac1a4..917f05365ec0e 100644 --- a/src/librustc/lint/context.rs +++ b/src/librustc/lint/context.rs @@ -665,6 +665,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for Context<'a, 'tcx> { self.with_lint_attrs(v.node.attrs.as_slice(), |cx| { run_lints!(cx, check_variant, v, g); visit::walk_variant(cx, v, g); + run_lints!(cx, check_variant_post, v, g); }) } diff --git a/src/librustc/lint/mod.rs b/src/librustc/lint/mod.rs index 0202aa185585c..3ea4c9c720c8f 100644 --- a/src/librustc/lint/mod.rs +++ b/src/librustc/lint/mod.rs @@ -149,6 +149,7 @@ pub trait LintPass { _: &ast::StructDef, _: ast::Ident, _: &ast::Generics, _: ast::NodeId) { } fn check_struct_field(&mut self, _: &Context, _: &ast::StructField) { } 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) { } fn check_lifetime_ref(&mut self, _: &Context, _: &ast::Lifetime) { } fn check_lifetime_decl(&mut self, _: &Context, _: &ast::LifetimeDef) { } diff --git a/src/librustc/middle/privacy.rs b/src/librustc/middle/privacy.rs index 1ecdf6b5d158b..72f3e28999235 100644 --- a/src/librustc/middle/privacy.rs +++ b/src/librustc/middle/privacy.rs @@ -1239,6 +1239,7 @@ struct VisiblePrivateTypesVisitor<'a, 'tcx: 'a> { tcx: &'a ty::ctxt<'tcx>, exported_items: &'a ExportedItems, public_items: &'a PublicItems, + in_variant: bool, } 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) { if self.exported_items.contains(&v.node.id) { + self.in_variant = true; visit::walk_variant(self, v, g); + self.in_variant = false; } } fn visit_struct_field(&mut self, s: &ast::StructField) { match s.node.kind { - ast::NamedField(_, ast::Public) => { + ast::NamedField(_, vis) if vis == ast::Public || self.in_variant => { visit::walk_struct_field(self, s); } _ => {} @@ -1598,7 +1601,8 @@ pub fn check_crate(tcx: &ty::ctxt, let mut visitor = VisiblePrivateTypesVisitor { tcx: tcx, exported_items: &exported_items, - public_items: &public_items + public_items: &public_items, + in_variant: false, }; visit::walk_crate(&mut visitor, krate); } diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs index 62d1e13d41f06..d49c8e3a288ac 100644 --- a/src/librustc/middle/resolve.rs +++ b/src/librustc/middle/resolve.rs @@ -102,10 +102,10 @@ pub enum LastPrivate { // and whether the import is in fact used for each. // If the Option fields are None, it means there is no definition // in that namespace. - LastImport{pub value_priv: Option, - pub value_used: ImportUse, - pub type_priv: Option, - pub type_used: ImportUse}, + LastImport{value_priv: Option, + value_used: ImportUse, + type_priv: Option, + type_used: ImportUse}, } #[deriving(Show)] diff --git a/src/librustc/middle/trans/adt.rs b/src/librustc/middle/trans/adt.rs index 0d3a84eb8bcf3..19209a3b8e64e 100644 --- a/src/librustc/middle/trans/adt.rs +++ b/src/librustc/middle/trans/adt.rs @@ -101,9 +101,9 @@ pub enum Repr { * otherwise it indicates the other case. */ RawNullablePointer { - pub nndiscr: Disr, - pub nnty: ty::t, - pub nullfields: Vec + nndiscr: Disr, + nnty: ty::t, + nullfields: Vec }, /** * Two cases distinguished by a nullable pointer: the case with discriminant @@ -117,10 +117,10 @@ pub enum Repr { * identity function. */ StructWrappedNullablePointer { - pub nonnull: Struct, - pub nndiscr: Disr, - pub ptrfield: PointerField, - pub nullfields: Vec, + nonnull: Struct, + nndiscr: Disr, + ptrfield: PointerField, + nullfields: Vec, } } diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 38e0c4fe040bd..9f17aafe22fd1 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -1085,9 +1085,9 @@ impl Clean for ty::ImplOrTraitItem { pub enum Type { /// structs/enums/traits (anything that'd be an ast::TyPath) ResolvedPath { - pub path: Path, - pub typarams: Option>, - pub did: ast::DefId, + path: Path, + typarams: Option>, + did: ast::DefId, }, // I have no idea how to usefully use this. TyParamBinder(ast::NodeId), @@ -1110,9 +1110,9 @@ pub enum Type { Unique(Box), RawPointer(Mutability, Box), BorrowedRef { - pub lifetime: Option, - pub mutability: Mutability, - pub type_: Box, + lifetime: Option, + mutability: Mutability, + type_: Box, }, // region, raw, other boxes, mutable } diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 7c5de627d0807..cd19a09fd6be9 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -1292,8 +1292,8 @@ pub type Variant = Spanned; #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)] pub enum PathListItem_ { - PathListIdent { pub name: Ident, pub id: NodeId }, - PathListMod { pub id: NodeId } + PathListIdent { name: Ident, id: NodeId }, + PathListMod { id: NodeId } } impl PathListItem_ { diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index c38fea9b3d58a..019d2315c1a19 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -37,7 +37,7 @@ use std::slice; static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[ ("globs", Active), ("macro_rules", Active), - ("struct_variant", Active), + ("struct_variant", Accepted), ("asm", Active), ("managed_boxes", Removed), ("non_ascii_idents", Active), @@ -184,19 +184,6 @@ impl<'a, 'v> Visitor<'v> for Context<'a> { } } 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) => { if attr::contains_name(i.attrs.as_slice(), "link_args") { self.gate_feature("link_args", i.span, diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index db10dc1bc90ca..b7a31bb350a84 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -4648,7 +4648,7 @@ impl<'a> Parser<'a> { is_tuple_like = false; fields = Vec::new(); 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 { self.fatal(format!("unit-like struct definition should be \ @@ -4725,12 +4725,16 @@ impl<'a> Parser<'a> { } /// 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(); if self.eat_keyword(keywords::Pub) { - return self.parse_single_struct_field(Public, attrs); + 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(Inherited, attrs); @@ -5178,7 +5182,7 @@ impl<'a> Parser<'a> { fn parse_struct_def(&mut self) -> P { let mut fields: Vec = Vec::new(); while self.token != token::CloseDelim(token::Brace) { - fields.push(self.parse_struct_decl_field()); + fields.push(self.parse_struct_decl_field(false)); } self.bump(); diff --git a/src/test/compile-fail/deriving-primitive.rs b/src/test/compile-fail/deriving-primitive.rs index 7d8741c98e2e7..1af0193ca4789 100644 --- a/src/test/compile-fail/deriving-primitive.rs +++ b/src/test/compile-fail/deriving-primitive.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(struct_variant)] - use std::num::FromPrimitive; use std::int; diff --git a/src/test/compile-fail/deriving-span-Clone-enum-struct-variant.rs b/src/test/compile-fail/deriving-span-Clone-enum-struct-variant.rs index 58a9c72b8b166..1abafb84dd2db 100644 --- a/src/test/compile-fail/deriving-span-Clone-enum-struct-variant.rs +++ b/src/test/compile-fail/deriving-span-Clone-enum-struct-variant.rs @@ -10,7 +10,6 @@ // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' -#![feature(struct_variant)] extern crate rand; diff --git a/src/test/compile-fail/deriving-span-Clone-enum.rs b/src/test/compile-fail/deriving-span-Clone-enum.rs index cf8345dbe7b46..50badaeea00c6 100644 --- a/src/test/compile-fail/deriving-span-Clone-enum.rs +++ b/src/test/compile-fail/deriving-span-Clone-enum.rs @@ -10,7 +10,6 @@ // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' -#![feature(struct_variant)] extern crate rand; diff --git a/src/test/compile-fail/deriving-span-Clone-struct.rs b/src/test/compile-fail/deriving-span-Clone-struct.rs index cd53f5a1e8f3c..49530afec0543 100644 --- a/src/test/compile-fail/deriving-span-Clone-struct.rs +++ b/src/test/compile-fail/deriving-span-Clone-struct.rs @@ -10,7 +10,6 @@ // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' -#![feature(struct_variant)] extern crate rand; diff --git a/src/test/compile-fail/deriving-span-Clone-tuple-struct.rs b/src/test/compile-fail/deriving-span-Clone-tuple-struct.rs index 95798af49b2e0..27e281bb220b6 100644 --- a/src/test/compile-fail/deriving-span-Clone-tuple-struct.rs +++ b/src/test/compile-fail/deriving-span-Clone-tuple-struct.rs @@ -10,7 +10,6 @@ // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' -#![feature(struct_variant)] extern crate rand; diff --git a/src/test/compile-fail/deriving-span-Default-struct.rs b/src/test/compile-fail/deriving-span-Default-struct.rs index 1da88f2e2577e..a75d909c06d2b 100644 --- a/src/test/compile-fail/deriving-span-Default-struct.rs +++ b/src/test/compile-fail/deriving-span-Default-struct.rs @@ -10,7 +10,6 @@ // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' -#![feature(struct_variant)] extern crate rand; diff --git a/src/test/compile-fail/deriving-span-Default-tuple-struct.rs b/src/test/compile-fail/deriving-span-Default-tuple-struct.rs index cf0d9fb744337..8df6acd27044c 100644 --- a/src/test/compile-fail/deriving-span-Default-tuple-struct.rs +++ b/src/test/compile-fail/deriving-span-Default-tuple-struct.rs @@ -10,7 +10,6 @@ // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' -#![feature(struct_variant)] extern crate rand; diff --git a/src/test/compile-fail/deriving-span-Hash-enum-struct-variant.rs b/src/test/compile-fail/deriving-span-Hash-enum-struct-variant.rs index 49b4840ff8ea1..fb94799caba6d 100644 --- a/src/test/compile-fail/deriving-span-Hash-enum-struct-variant.rs +++ b/src/test/compile-fail/deriving-span-Hash-enum-struct-variant.rs @@ -10,7 +10,6 @@ // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' -#![feature(struct_variant)] extern crate rand; diff --git a/src/test/compile-fail/deriving-span-Hash-enum.rs b/src/test/compile-fail/deriving-span-Hash-enum.rs index 653dabfbc133f..d4100badcdb85 100644 --- a/src/test/compile-fail/deriving-span-Hash-enum.rs +++ b/src/test/compile-fail/deriving-span-Hash-enum.rs @@ -10,7 +10,6 @@ // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' -#![feature(struct_variant)] extern crate rand; diff --git a/src/test/compile-fail/deriving-span-Hash-struct.rs b/src/test/compile-fail/deriving-span-Hash-struct.rs index 46234f6e72408..8b0ec01283c86 100644 --- a/src/test/compile-fail/deriving-span-Hash-struct.rs +++ b/src/test/compile-fail/deriving-span-Hash-struct.rs @@ -10,7 +10,6 @@ // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' -#![feature(struct_variant)] extern crate rand; diff --git a/src/test/compile-fail/deriving-span-Hash-tuple-struct.rs b/src/test/compile-fail/deriving-span-Hash-tuple-struct.rs index 5dbf4a0376a12..8ed8350e55791 100644 --- a/src/test/compile-fail/deriving-span-Hash-tuple-struct.rs +++ b/src/test/compile-fail/deriving-span-Hash-tuple-struct.rs @@ -10,7 +10,6 @@ // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' -#![feature(struct_variant)] extern crate rand; diff --git a/src/test/compile-fail/deriving-span-PartialEq-enum-struct-variant.rs b/src/test/compile-fail/deriving-span-PartialEq-enum-struct-variant.rs index 566585aa06567..f9ce978a05762 100644 --- a/src/test/compile-fail/deriving-span-PartialEq-enum-struct-variant.rs +++ b/src/test/compile-fail/deriving-span-PartialEq-enum-struct-variant.rs @@ -10,7 +10,6 @@ // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' -#![feature(struct_variant)] extern crate rand; diff --git a/src/test/compile-fail/deriving-span-PartialEq-enum.rs b/src/test/compile-fail/deriving-span-PartialEq-enum.rs index 8a9771a050939..7756e9bfbb68e 100644 --- a/src/test/compile-fail/deriving-span-PartialEq-enum.rs +++ b/src/test/compile-fail/deriving-span-PartialEq-enum.rs @@ -10,7 +10,6 @@ // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' -#![feature(struct_variant)] extern crate rand; diff --git a/src/test/compile-fail/deriving-span-PartialEq-struct.rs b/src/test/compile-fail/deriving-span-PartialEq-struct.rs index de39e9bacd529..43685a5b0ef52 100644 --- a/src/test/compile-fail/deriving-span-PartialEq-struct.rs +++ b/src/test/compile-fail/deriving-span-PartialEq-struct.rs @@ -10,7 +10,6 @@ // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' -#![feature(struct_variant)] extern crate rand; diff --git a/src/test/compile-fail/deriving-span-PartialEq-tuple-struct.rs b/src/test/compile-fail/deriving-span-PartialEq-tuple-struct.rs index 101461e39b718..b84b8b4a658c3 100644 --- a/src/test/compile-fail/deriving-span-PartialEq-tuple-struct.rs +++ b/src/test/compile-fail/deriving-span-PartialEq-tuple-struct.rs @@ -10,7 +10,6 @@ // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' -#![feature(struct_variant)] extern crate rand; diff --git a/src/test/compile-fail/deriving-span-PartialOrd-enum-struct-variant.rs b/src/test/compile-fail/deriving-span-PartialOrd-enum-struct-variant.rs index dd6c11d2b3993..810f0f350f3a3 100644 --- a/src/test/compile-fail/deriving-span-PartialOrd-enum-struct-variant.rs +++ b/src/test/compile-fail/deriving-span-PartialOrd-enum-struct-variant.rs @@ -10,7 +10,6 @@ // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' -#![feature(struct_variant)] extern crate rand; #[deriving(PartialEq)] diff --git a/src/test/compile-fail/deriving-span-PartialOrd-enum.rs b/src/test/compile-fail/deriving-span-PartialOrd-enum.rs index 1b3d73a6f8bee..7ae2bbf8eb5c7 100644 --- a/src/test/compile-fail/deriving-span-PartialOrd-enum.rs +++ b/src/test/compile-fail/deriving-span-PartialOrd-enum.rs @@ -10,7 +10,6 @@ // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' -#![feature(struct_variant)] extern crate rand; #[deriving(PartialEq)] diff --git a/src/test/compile-fail/deriving-span-PartialOrd-struct.rs b/src/test/compile-fail/deriving-span-PartialOrd-struct.rs index 2ef3b4dfe8a2f..c5b008da884a8 100644 --- a/src/test/compile-fail/deriving-span-PartialOrd-struct.rs +++ b/src/test/compile-fail/deriving-span-PartialOrd-struct.rs @@ -10,7 +10,6 @@ // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' -#![feature(struct_variant)] extern crate rand; #[deriving(PartialEq)] diff --git a/src/test/compile-fail/deriving-span-PartialOrd-tuple-struct.rs b/src/test/compile-fail/deriving-span-PartialOrd-tuple-struct.rs index 303896737dc28..f282943bba337 100644 --- a/src/test/compile-fail/deriving-span-PartialOrd-tuple-struct.rs +++ b/src/test/compile-fail/deriving-span-PartialOrd-tuple-struct.rs @@ -10,7 +10,6 @@ // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' -#![feature(struct_variant)] extern crate rand; #[deriving(PartialEq)] diff --git a/src/test/compile-fail/deriving-span-Rand-enum-struct-variant.rs b/src/test/compile-fail/deriving-span-Rand-enum-struct-variant.rs index 79c38dcb4ccac..c44abc2313a08 100644 --- a/src/test/compile-fail/deriving-span-Rand-enum-struct-variant.rs +++ b/src/test/compile-fail/deriving-span-Rand-enum-struct-variant.rs @@ -10,7 +10,6 @@ // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' -#![feature(struct_variant)] extern crate rand; diff --git a/src/test/compile-fail/deriving-span-Rand-enum.rs b/src/test/compile-fail/deriving-span-Rand-enum.rs index 1e153a772c7e1..fc03b99983d99 100644 --- a/src/test/compile-fail/deriving-span-Rand-enum.rs +++ b/src/test/compile-fail/deriving-span-Rand-enum.rs @@ -10,7 +10,6 @@ // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' -#![feature(struct_variant)] extern crate rand; diff --git a/src/test/compile-fail/deriving-span-Rand-struct.rs b/src/test/compile-fail/deriving-span-Rand-struct.rs index 2c223918773d8..36e1e52139397 100644 --- a/src/test/compile-fail/deriving-span-Rand-struct.rs +++ b/src/test/compile-fail/deriving-span-Rand-struct.rs @@ -10,7 +10,6 @@ // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' -#![feature(struct_variant)] extern crate rand; diff --git a/src/test/compile-fail/deriving-span-Rand-tuple-struct.rs b/src/test/compile-fail/deriving-span-Rand-tuple-struct.rs index 5d5a1372c13a2..ffa26061833fa 100644 --- a/src/test/compile-fail/deriving-span-Rand-tuple-struct.rs +++ b/src/test/compile-fail/deriving-span-Rand-tuple-struct.rs @@ -10,7 +10,6 @@ // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' -#![feature(struct_variant)] extern crate rand; diff --git a/src/test/compile-fail/deriving-span-Show-enum-struct-variant.rs b/src/test/compile-fail/deriving-span-Show-enum-struct-variant.rs index 93f53dc73f76b..fa1cfc3de5ba3 100644 --- a/src/test/compile-fail/deriving-span-Show-enum-struct-variant.rs +++ b/src/test/compile-fail/deriving-span-Show-enum-struct-variant.rs @@ -10,7 +10,6 @@ // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' -#![feature(struct_variant)] extern crate rand; diff --git a/src/test/compile-fail/deriving-span-Show-enum.rs b/src/test/compile-fail/deriving-span-Show-enum.rs index e61a62c2f6da3..9b1dccf7df5a3 100644 --- a/src/test/compile-fail/deriving-span-Show-enum.rs +++ b/src/test/compile-fail/deriving-span-Show-enum.rs @@ -10,7 +10,6 @@ // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' -#![feature(struct_variant)] extern crate rand; diff --git a/src/test/compile-fail/deriving-span-Show-struct.rs b/src/test/compile-fail/deriving-span-Show-struct.rs index 3a48b3334b7ab..8acb6875d53a8 100644 --- a/src/test/compile-fail/deriving-span-Show-struct.rs +++ b/src/test/compile-fail/deriving-span-Show-struct.rs @@ -10,7 +10,6 @@ // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' -#![feature(struct_variant)] extern crate rand; diff --git a/src/test/compile-fail/deriving-span-Show-tuple-struct.rs b/src/test/compile-fail/deriving-span-Show-tuple-struct.rs index 54806f322b383..bcbced125ef14 100644 --- a/src/test/compile-fail/deriving-span-Show-tuple-struct.rs +++ b/src/test/compile-fail/deriving-span-Show-tuple-struct.rs @@ -10,7 +10,6 @@ // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' -#![feature(struct_variant)] extern crate rand; diff --git a/src/test/compile-fail/deriving-span-TotalEq-enum-struct-variant.rs b/src/test/compile-fail/deriving-span-TotalEq-enum-struct-variant.rs index 964e7d8c811dd..25add55ae4bfc 100644 --- a/src/test/compile-fail/deriving-span-TotalEq-enum-struct-variant.rs +++ b/src/test/compile-fail/deriving-span-TotalEq-enum-struct-variant.rs @@ -10,7 +10,6 @@ // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' -#![feature(struct_variant)] extern crate rand; #[deriving(PartialEq)] diff --git a/src/test/compile-fail/deriving-span-TotalEq-enum.rs b/src/test/compile-fail/deriving-span-TotalEq-enum.rs index 96e87ca200694..e58121f2cb081 100644 --- a/src/test/compile-fail/deriving-span-TotalEq-enum.rs +++ b/src/test/compile-fail/deriving-span-TotalEq-enum.rs @@ -10,7 +10,6 @@ // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' -#![feature(struct_variant)] extern crate rand; #[deriving(PartialEq)] diff --git a/src/test/compile-fail/deriving-span-TotalEq-struct.rs b/src/test/compile-fail/deriving-span-TotalEq-struct.rs index 784c766c05724..0637c6e305cfe 100644 --- a/src/test/compile-fail/deriving-span-TotalEq-struct.rs +++ b/src/test/compile-fail/deriving-span-TotalEq-struct.rs @@ -10,7 +10,6 @@ // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' -#![feature(struct_variant)] extern crate rand; #[deriving(PartialEq)] diff --git a/src/test/compile-fail/deriving-span-TotalEq-tuple-struct.rs b/src/test/compile-fail/deriving-span-TotalEq-tuple-struct.rs index 3dcff5f80ce3d..3a2cbb11f53fb 100644 --- a/src/test/compile-fail/deriving-span-TotalEq-tuple-struct.rs +++ b/src/test/compile-fail/deriving-span-TotalEq-tuple-struct.rs @@ -10,7 +10,6 @@ // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' -#![feature(struct_variant)] extern crate rand; #[deriving(PartialEq)] diff --git a/src/test/compile-fail/deriving-span-TotalOrd-enum-struct-variant.rs b/src/test/compile-fail/deriving-span-TotalOrd-enum-struct-variant.rs index c16e64829dd06..3b4f4e1080d40 100644 --- a/src/test/compile-fail/deriving-span-TotalOrd-enum-struct-variant.rs +++ b/src/test/compile-fail/deriving-span-TotalOrd-enum-struct-variant.rs @@ -10,7 +10,6 @@ // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' -#![feature(struct_variant)] extern crate rand; #[deriving(Eq,PartialOrd,PartialEq)] diff --git a/src/test/compile-fail/deriving-span-TotalOrd-enum.rs b/src/test/compile-fail/deriving-span-TotalOrd-enum.rs index 4b3f0ce52c7bf..02a55fdfbb24c 100644 --- a/src/test/compile-fail/deriving-span-TotalOrd-enum.rs +++ b/src/test/compile-fail/deriving-span-TotalOrd-enum.rs @@ -10,7 +10,6 @@ // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' -#![feature(struct_variant)] extern crate rand; #[deriving(Eq,PartialOrd,PartialEq)] diff --git a/src/test/compile-fail/deriving-span-TotalOrd-struct.rs b/src/test/compile-fail/deriving-span-TotalOrd-struct.rs index 56d6274237826..7cf3ad57f4701 100644 --- a/src/test/compile-fail/deriving-span-TotalOrd-struct.rs +++ b/src/test/compile-fail/deriving-span-TotalOrd-struct.rs @@ -10,7 +10,6 @@ // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' -#![feature(struct_variant)] extern crate rand; #[deriving(Eq,PartialOrd,PartialEq)] diff --git a/src/test/compile-fail/deriving-span-TotalOrd-tuple-struct.rs b/src/test/compile-fail/deriving-span-TotalOrd-tuple-struct.rs index 2330fdd8b893a..7b8d1d3ecd04a 100644 --- a/src/test/compile-fail/deriving-span-TotalOrd-tuple-struct.rs +++ b/src/test/compile-fail/deriving-span-TotalOrd-tuple-struct.rs @@ -10,7 +10,6 @@ // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' -#![feature(struct_variant)] extern crate rand; #[deriving(Eq,PartialOrd,PartialEq)] diff --git a/src/test/compile-fail/deriving-span-Zero-struct.rs b/src/test/compile-fail/deriving-span-Zero-struct.rs index fb7759c6032e8..302fecd518b86 100644 --- a/src/test/compile-fail/deriving-span-Zero-struct.rs +++ b/src/test/compile-fail/deriving-span-Zero-struct.rs @@ -10,7 +10,6 @@ // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' -#![feature(struct_variant)] extern crate rand; diff --git a/src/test/compile-fail/deriving-span-Zero-tuple-struct.rs b/src/test/compile-fail/deriving-span-Zero-tuple-struct.rs index 193e4b5c6b2d5..05b81ce325113 100644 --- a/src/test/compile-fail/deriving-span-Zero-tuple-struct.rs +++ b/src/test/compile-fail/deriving-span-Zero-tuple-struct.rs @@ -10,7 +10,6 @@ // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' -#![feature(struct_variant)] extern crate rand; diff --git a/src/test/compile-fail/dup-struct-enum-struct-variant.rs b/src/test/compile-fail/dup-struct-enum-struct-variant.rs index 47b576b2b85e5..7ea114605ce78 100644 --- a/src/test/compile-fail/dup-struct-enum-struct-variant.rs +++ b/src/test/compile-fail/dup-struct-enum-struct-variant.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(struct_variant)] - enum Foo { C { a: int, b: int } } struct C { a: int, b: int } //~ ERROR error: duplicate definition of type or module `C` diff --git a/src/test/compile-fail/gated-non-ascii-idents.rs b/src/test/compile-fail/gated-non-ascii-idents.rs index 0634ba183a870..4cbb61d9853b0 100644 --- a/src/test/compile-fail/gated-non-ascii-idents.rs +++ b/src/test/compile-fail/gated-non-ascii-idents.rs @@ -8,9 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![feature(struct_variant)] - extern crate bäz; //~ ERROR non-ascii idents use föö::bar; //~ ERROR non-ascii idents diff --git a/src/test/compile-fail/issue-13624.rs b/src/test/compile-fail/issue-13624.rs index 0c103515981cd..5b9ff06e9c9a3 100644 --- a/src/test/compile-fail/issue-13624.rs +++ b/src/test/compile-fail/issue-13624.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(struct_variant)] - mod a { pub enum Enum { EnumStructVariant { x: u8, y: u8, z: u8 } diff --git a/src/test/compile-fail/issue-18252.rs b/src/test/compile-fail/issue-18252.rs index c884f02892f16..930e96f170e36 100644 --- a/src/test/compile-fail/issue-18252.rs +++ b/src/test/compile-fail/issue-18252.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(struct_variant)] - enum Foo { Variant { x: uint } } diff --git a/src/test/compile-fail/lint-dead-code-4.rs b/src/test/compile-fail/lint-dead-code-4.rs index a698bf61f5894..7c3242a6a25cc 100644 --- a/src/test/compile-fail/lint-dead-code-4.rs +++ b/src/test/compile-fail/lint-dead-code-4.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(struct_variant)] #![allow(unused_variables)] #![allow(non_camel_case_types)] #![deny(dead_code)] diff --git a/src/test/compile-fail/lint-dead-code-5.rs b/src/test/compile-fail/lint-dead-code-5.rs index 1f0d91dcb3cd9..1a3bd82a98108 100644 --- a/src/test/compile-fail/lint-dead-code-5.rs +++ b/src/test/compile-fail/lint-dead-code-5.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(struct_variant)] #![allow(unused_variables)] #![deny(dead_code)] diff --git a/src/test/compile-fail/lint-missing-doc.rs b/src/test/compile-fail/lint-missing-doc.rs index f0b6abe28d37a..365081aee1ab5 100644 --- a/src/test/compile-fail/lint-missing-doc.rs +++ b/src/test/compile-fail/lint-missing-doc.rs @@ -10,7 +10,6 @@ // When denying at the crate level, be sure to not get random warnings from the // injected intrinsics by the compiler. -#![feature(struct_variant)] #![feature(globs)] #![deny(missing_docs)] #![allow(dead_code)] @@ -106,8 +105,7 @@ enum Baz { pub enum PubBaz { //~ ERROR: missing documentation PubBazA { //~ ERROR: missing documentation - pub a: int, //~ ERROR: missing documentation - b: int + a: int, //~ ERROR: missing documentation }, } @@ -116,15 +114,13 @@ pub enum PubBaz2 { /// dox PubBaz2A { /// dox - pub a: int, - b: int + a: int, }, } #[allow(missing_docs)] pub enum PubBaz3 { PubBaz3A { - pub a: int, b: int }, } diff --git a/src/test/compile-fail/lint-raw-ptr-deriving.rs b/src/test/compile-fail/lint-raw-ptr-deriving.rs index da43324d494a5..72632b56706c4 100644 --- a/src/test/compile-fail/lint-raw-ptr-deriving.rs +++ b/src/test/compile-fail/lint-raw-ptr-deriving.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(struct_variant)] #![allow(dead_code)] #![deny(raw_pointer_deriving)] diff --git a/src/test/compile-fail/lint-visible-private-types.rs b/src/test/compile-fail/lint-visible-private-types.rs index 55ffdcd7f9fb3..373bcb1f85913 100644 --- a/src/test/compile-fail/lint-visible-private-types.rs +++ b/src/test/compile-fail/lint-visible-private-types.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(struct_variant)] #![deny(visible_private_types)] #![allow(dead_code)] #![crate_type="lib"] @@ -57,8 +56,7 @@ struct Bar { pub enum Baz { Baz1(Private), //~ ERROR private type in exported type signature Baz2 { - pub x: Private, //~ ERROR private type in exported type signature - y: Private + y: Private //~ ERROR private type in exported type signature }, } diff --git a/src/test/compile-fail/namespaced-enum-glob-import-no-impls-xcrate.rs b/src/test/compile-fail/namespaced-enum-glob-import-no-impls-xcrate.rs index 09916a11f72e7..120f092d732f9 100644 --- a/src/test/compile-fail/namespaced-enum-glob-import-no-impls-xcrate.rs +++ b/src/test/compile-fail/namespaced-enum-glob-import-no-impls-xcrate.rs @@ -9,7 +9,7 @@ // except according to those terms. // aux-build:namespaced_enums.rs -#![feature(struct_variant, globs)] +#![feature(globs)] extern crate namespaced_enums; diff --git a/src/test/compile-fail/namespaced-enum-glob-import-no-impls.rs b/src/test/compile-fail/namespaced-enum-glob-import-no-impls.rs index 1554d410070d6..a8f4e6ba0903b 100644 --- a/src/test/compile-fail/namespaced-enum-glob-import-no-impls.rs +++ b/src/test/compile-fail/namespaced-enum-glob-import-no-impls.rs @@ -7,7 +7,7 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(struct_variant, globs)] +#![feature(globs)] mod m2 { pub enum Foo { diff --git a/src/test/compile-fail/non-exhaustive-pattern-witness.rs b/src/test/compile-fail/non-exhaustive-pattern-witness.rs index b7ff3a18fcf7a..7f1204ceee897 100644 --- a/src/test/compile-fail/non-exhaustive-pattern-witness.rs +++ b/src/test/compile-fail/non-exhaustive-pattern-witness.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(advanced_slice_patterns, struct_variant)] +#![feature(advanced_slice_patterns)] struct Foo { first: bool, diff --git a/src/test/compile-fail/struct-like-enum-nonexhaustive.rs b/src/test/compile-fail/struct-like-enum-nonexhaustive.rs index 8d1e5b462792f..91709e2ea7da0 100644 --- a/src/test/compile-fail/struct-like-enum-nonexhaustive.rs +++ b/src/test/compile-fail/struct-like-enum-nonexhaustive.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(struct_variant)] - enum A { B { x: Option }, C diff --git a/src/test/compile-fail/gated-struct-enums.rs b/src/test/compile-fail/struct-variant-no-pub.rs similarity index 73% rename from src/test/compile-fail/gated-struct-enums.rs rename to src/test/compile-fail/struct-variant-no-pub.rs index f1bd9362bb775..15ed69083e0bf 100644 --- a/src/test/compile-fail/gated-struct-enums.rs +++ b/src/test/compile-fail/struct-variant-no-pub.rs @@ -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 // http://rust-lang.org/COPYRIGHT. // @@ -8,8 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -enum A { B { foo: int } } -//~^ ERROR: enum struct variants are experimental +enum Foo { + Bar { + pub a: int //~ ERROR: `pub` is not allowed here + } +} fn main() {} - diff --git a/src/test/compile-fail/struct-variant-privacy-xc.rs b/src/test/compile-fail/struct-variant-privacy-xc.rs index 2d289c7f6cddb..c58273361ad0b 100644 --- a/src/test/compile-fail/struct-variant-privacy-xc.rs +++ b/src/test/compile-fail/struct-variant-privacy-xc.rs @@ -9,8 +9,6 @@ // except according to those terms. // aux-build:struct_variant_privacy.rs -#![feature(struct_variant)] - extern crate struct_variant_privacy; fn f(b: struct_variant_privacy::Bar) { //~ ERROR enum `Bar` is private diff --git a/src/test/compile-fail/struct-variant-privacy.rs b/src/test/compile-fail/struct-variant-privacy.rs index 53b8fdf71b72c..bf404c276482b 100644 --- a/src/test/compile-fail/struct-variant-privacy.rs +++ b/src/test/compile-fail/struct-variant-privacy.rs @@ -7,8 +7,6 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(struct_variant)] - mod foo { enum Bar { Baz { a: int } diff --git a/src/test/compile-fail/unsized5.rs b/src/test/compile-fail/unsized5.rs index 41196b60c8eba..2f1eb35a42623 100644 --- a/src/test/compile-fail/unsized5.rs +++ b/src/test/compile-fail/unsized5.rs @@ -7,7 +7,6 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(struct_variant)] // Test `Sized?` types not allowed in fields (except the last one).