]> git.lizzy.rs Git - rust.git/commitdiff
Un-feature gate struct variants
authorSteven Fackler <sfackler@gmail.com>
Sun, 16 Nov 2014 01:57:54 +0000 (17:57 -0800)
committerSteven Fackler <sfackler@gmail.com>
Sun, 16 Nov 2014 02:15:27 +0000 (18:15 -0800)
Struct variant field visibility is now inherited. Remove `pub` keywords
from declarations.

Closes #18641

[breaking-change]

66 files changed:
src/etc/generate-deriving-span-tests.py
src/librustc/lint/builtin.rs
src/librustc/lint/context.rs
src/librustc/lint/mod.rs
src/librustc/middle/privacy.rs
src/librustc/middle/resolve.rs
src/librustc/middle/trans/adt.rs
src/librustdoc/clean/mod.rs
src/libsyntax/ast.rs
src/libsyntax/feature_gate.rs
src/libsyntax/parse/parser.rs
src/test/compile-fail/deriving-primitive.rs
src/test/compile-fail/deriving-span-Clone-enum-struct-variant.rs
src/test/compile-fail/deriving-span-Clone-enum.rs
src/test/compile-fail/deriving-span-Clone-struct.rs
src/test/compile-fail/deriving-span-Clone-tuple-struct.rs
src/test/compile-fail/deriving-span-Default-struct.rs
src/test/compile-fail/deriving-span-Default-tuple-struct.rs
src/test/compile-fail/deriving-span-Hash-enum-struct-variant.rs
src/test/compile-fail/deriving-span-Hash-enum.rs
src/test/compile-fail/deriving-span-Hash-struct.rs
src/test/compile-fail/deriving-span-Hash-tuple-struct.rs
src/test/compile-fail/deriving-span-PartialEq-enum-struct-variant.rs
src/test/compile-fail/deriving-span-PartialEq-enum.rs
src/test/compile-fail/deriving-span-PartialEq-struct.rs
src/test/compile-fail/deriving-span-PartialEq-tuple-struct.rs
src/test/compile-fail/deriving-span-PartialOrd-enum-struct-variant.rs
src/test/compile-fail/deriving-span-PartialOrd-enum.rs
src/test/compile-fail/deriving-span-PartialOrd-struct.rs
src/test/compile-fail/deriving-span-PartialOrd-tuple-struct.rs
src/test/compile-fail/deriving-span-Rand-enum-struct-variant.rs
src/test/compile-fail/deriving-span-Rand-enum.rs
src/test/compile-fail/deriving-span-Rand-struct.rs
src/test/compile-fail/deriving-span-Rand-tuple-struct.rs
src/test/compile-fail/deriving-span-Show-enum-struct-variant.rs
src/test/compile-fail/deriving-span-Show-enum.rs
src/test/compile-fail/deriving-span-Show-struct.rs
src/test/compile-fail/deriving-span-Show-tuple-struct.rs
src/test/compile-fail/deriving-span-TotalEq-enum-struct-variant.rs
src/test/compile-fail/deriving-span-TotalEq-enum.rs
src/test/compile-fail/deriving-span-TotalEq-struct.rs
src/test/compile-fail/deriving-span-TotalEq-tuple-struct.rs
src/test/compile-fail/deriving-span-TotalOrd-enum-struct-variant.rs
src/test/compile-fail/deriving-span-TotalOrd-enum.rs
src/test/compile-fail/deriving-span-TotalOrd-struct.rs
src/test/compile-fail/deriving-span-TotalOrd-tuple-struct.rs
src/test/compile-fail/deriving-span-Zero-struct.rs
src/test/compile-fail/deriving-span-Zero-tuple-struct.rs
src/test/compile-fail/dup-struct-enum-struct-variant.rs
src/test/compile-fail/gated-non-ascii-idents.rs
src/test/compile-fail/gated-struct-enums.rs [deleted file]
src/test/compile-fail/issue-13624.rs
src/test/compile-fail/issue-18252.rs
src/test/compile-fail/lint-dead-code-4.rs
src/test/compile-fail/lint-dead-code-5.rs
src/test/compile-fail/lint-missing-doc.rs
src/test/compile-fail/lint-raw-ptr-deriving.rs
src/test/compile-fail/lint-visible-private-types.rs
src/test/compile-fail/namespaced-enum-glob-import-no-impls-xcrate.rs
src/test/compile-fail/namespaced-enum-glob-import-no-impls.rs
src/test/compile-fail/non-exhaustive-pattern-witness.rs
src/test/compile-fail/struct-like-enum-nonexhaustive.rs
src/test/compile-fail/struct-variant-no-pub.rs [new file with mode: 0644]
src/test/compile-fail/struct-variant-privacy-xc.rs
src/test/compile-fail/struct-variant-privacy.rs
src/test/compile-fail/unsized5.rs

index 94b3fb6b93aa47ad74881799e5986f5611cfbd7d..1e5d5ccf339c38f35408d8cc332e55db28457928 100755 (executable)
@@ -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'
 
-#![feature(struct_variant)]
 extern crate rand;
 
 {error_deriving}
index 86dd967026b846604711107812320574483de9b3..9d975c7aebca3995db065a2cce5b41572ab0460a 100644 (file)
@@ -1399,6 +1399,9 @@ pub struct MissingDoc {
     /// Stack of IDs of struct definitions.
     struct_def_stack: Vec<ast::NodeId>,
 
+    /// 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<bool>,
@@ -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 @@ fn check_ty_method(&mut self, cx: &Context, tm: &ast::TypeMethod) {
 
     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 @@ fn check_struct_field(&mut self, cx: &Context, sf: &ast::StructField) {
     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;
     }
 }
 
index 7f8b779dac1a428cad92b779a4b5f0f93425f7fd..917f05365ec0e078a28d3f1103b6e3ac546cc923 100644 (file)
@@ -665,6 +665,7 @@ fn visit_variant(&mut self, v: &ast::Variant, g: &ast::Generics) {
         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);
         })
     }
 
index 0202aa185585c407e920837d4008781c637a8667..3ea4c9c720c8f110b6f165eac58327bc2b89ca69 100644 (file)
@@ -149,6 +149,7 @@ fn check_struct_def_post(&mut self, _: &Context,
         _: &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<ast::Lifetime>) { }
     fn check_lifetime_ref(&mut self, _: &Context, _: &ast::Lifetime) { }
     fn check_lifetime_decl(&mut self, _: &Context, _: &ast::LifetimeDef) { }
index 1ecdf6b5d158b46dd4b4a4f445d9ba0dea7a1257..72f3e28999235726b58a75098aab123e059f6496 100644 (file)
@@ -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 @@ fn visit_ty(&mut self, t: &ast::Ty) {
 
     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);
     }
index 62d1e13d41f0665071e370fe0490b0291b4b907b..d49c8e3a288acb2499be805b60990459708929ba 100644 (file)
@@ -102,10 +102,10 @@ pub enum LastPrivate {
     // and whether the import is in fact used for each.
     // If the Option<PrivateDep> fields are None, it means there is no definition
     // in that namespace.
-    LastImport{pub value_priv: Option<PrivateDep>,
-               pub value_used: ImportUse,
-               pub type_priv: Option<PrivateDep>,
-               pub type_used: ImportUse},
+    LastImport{value_priv: Option<PrivateDep>,
+               value_used: ImportUse,
+               type_priv: Option<PrivateDep>,
+               type_used: ImportUse},
 }
 
 #[deriving(Show)]
index 0d3a84eb8bcf341219242a2697a7267f17923059..19209a3b8e64e91194a39e62ef0a9b382854725c 100644 (file)
@@ -101,9 +101,9 @@ pub enum Repr {
      * otherwise it indicates the other case.
      */
     RawNullablePointer {
-        pub nndiscr: Disr,
-        pub nnty: ty::t,
-        pub nullfields: Vec<ty::t>
+        nndiscr: Disr,
+        nnty: ty::t,
+        nullfields: Vec<ty::t>
     },
     /**
      * 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<ty::t>,
+        nonnull: Struct,
+        nndiscr: Disr,
+        ptrfield: PointerField,
+        nullfields: Vec<ty::t>,
     }
 }
 
index 38e0c4fe040bdd042422e2fe72c162892217f59f..9f17aafe22fd19133babb6eb34e802c5c5cbee76 100644 (file)
@@ -1085,9 +1085,9 @@ fn clean(&self, cx: &DocContext) -> Item {
 pub enum Type {
     /// structs/enums/traits (anything that'd be an ast::TyPath)
     ResolvedPath {
-        pub path: Path,
-        pub typarams: Option<Vec<TyParamBound>>,
-        pub did: ast::DefId,
+        path: Path,
+        typarams: Option<Vec<TyParamBound>>,
+        did: ast::DefId,
     },
     // I have no idea how to usefully use this.
     TyParamBinder(ast::NodeId),
@@ -1110,9 +1110,9 @@ pub enum Type {
     Unique(Box<Type>),
     RawPointer(Mutability, Box<Type>),
     BorrowedRef {
-        pub lifetime: Option<Lifetime>,
-        pub mutability: Mutability,
-        pub type_: Box<Type>,
+        lifetime: Option<Lifetime>,
+        mutability: Mutability,
+        type_: Box<Type>,
     },
     // region, raw, other boxes, mutable
 }
index 7c5de627d0807ec139c306f8b986539268243556..cd19a09fd6be9f56ecf223fc2227c8709890bbe5 100644 (file)
@@ -1292,8 +1292,8 @@ pub struct Variant_ {
 
 #[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_ {
index c38fea9b3d58a2b9576ea5e8fcd249ed1b182eb8..019d2315c1a196b78f8dc1056d034cc75b8513df 100644 (file)
@@ -37,7 +37,7 @@
 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 @@ fn visit_item(&mut self, i: &ast::Item) {
             }
         }
         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,
index db10dc1bc90ca18501817e64ad59059344ee0444..b7a31bb350a84d690f20ec73e8360448434c7da9 100644 (file)
@@ -4648,7 +4648,7 @@ fn parse_item_struct(&mut self) -> ItemInfo {
             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 @@ pub fn parse_single_struct_field(&mut self,
     }
 
     /// 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 @@ fn parse_item_type(&mut self) -> ItemInfo {
     fn parse_struct_def(&mut self) -> P<StructDef> {
         let mut fields: Vec<StructField> = 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();
 
index 7d8741c98e2e73474d7f207bd87fcd6d523ea232..1af0193ca4789e43e640b737373372545995d924 100644 (file)
@@ -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;
 
index 58a9c72b8b166cdd186cddfb9e32e96b1e4c5b61..1abafb84dd2db298773e76e06d9f0df62e91d65a 100644 (file)
@@ -10,7 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-#![feature(struct_variant)]
 extern crate rand;
 
 
index cf8345dbe7b46d9579f95e2e5980516c6f6472ff..50badaeea00c6bd071390d4f50a31070acaef61f 100644 (file)
@@ -10,7 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-#![feature(struct_variant)]
 extern crate rand;
 
 
index cd53f5a1e8f3cec125c60326512983b4da9b0093..49530afec054391c353fab747179dd3adfbad1d3 100644 (file)
@@ -10,7 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-#![feature(struct_variant)]
 extern crate rand;
 
 
index 95798af49b2e07e64495e838845eec762a581aab..27e281bb220b619cfe6ea5a30ac491c406011f8b 100644 (file)
@@ -10,7 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-#![feature(struct_variant)]
 extern crate rand;
 
 
index 1da88f2e2577eadae5c035f1accf85cdc18b1486..a75d909c06d2bbc9a27d93658d578b4e1cc96b97 100644 (file)
@@ -10,7 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-#![feature(struct_variant)]
 extern crate rand;
 
 
index cf0d9fb744337b43543455297c68384a0e5a9ed3..8df6acd27044c7647ad8317f5dd89178080ce90d 100644 (file)
@@ -10,7 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-#![feature(struct_variant)]
 extern crate rand;
 
 
index 49b4840ff8ea1c4c8711db94d7a5d72073b5d650..fb94799caba6df0f4ea1b517895fa73a1fd2f7c6 100644 (file)
@@ -10,7 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-#![feature(struct_variant)]
 extern crate rand;
 
 
index 653dabfbc133fa901ac9ee66f5151b92f7a4670e..d4100badcdb856b3f0e033351e1c0bb349966baa 100644 (file)
@@ -10,7 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-#![feature(struct_variant)]
 extern crate rand;
 
 
index 46234f6e724081e48d2125c2ca8fc6fb9f999357..8b0ec01283c864418bc7b8dce201e06ef86afa57 100644 (file)
@@ -10,7 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-#![feature(struct_variant)]
 extern crate rand;
 
 
index 5dbf4a0376a1277def1d6e653a4f5ac523e6301b..8ed8350e557910278ebb2465ddbad5f5dcf8743b 100644 (file)
@@ -10,7 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-#![feature(struct_variant)]
 extern crate rand;
 
 
index 566585aa0656753634a8d26166de06abc1b549ad..f9ce978a05762c66e5b1b7d138ef6bb306c9a6c0 100644 (file)
@@ -10,7 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-#![feature(struct_variant)]
 extern crate rand;
 
 
index 8a9771a05093914c8accac31e43392f402beabe0..7756e9bfbb68ef9541c02e1a472fa36c35fb32ec 100644 (file)
@@ -10,7 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-#![feature(struct_variant)]
 extern crate rand;
 
 
index de39e9bacd529b49c097cdb85badce3cbed09517..43685a5b0ef52fd3231f153cf257ef725e56ef9a 100644 (file)
@@ -10,7 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-#![feature(struct_variant)]
 extern crate rand;
 
 
index 101461e39b718fd0d0488db9227b76ec52dd8595..b84b8b4a658c3858903a1efd6f12bbfd275f7e9f 100644 (file)
@@ -10,7 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-#![feature(struct_variant)]
 extern crate rand;
 
 
index dd6c11d2b39932b2846af2c42fc0ec2902160105..810f0f350f3a37f548f16acdf5684ef22c8c8309 100644 (file)
@@ -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)]
index 1b3d73a6f8bee9381534fe2ca11bd57e926a9a78..7ae2bbf8eb5c74331871b6a949085a007c629bb1 100644 (file)
@@ -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)]
index 2ef3b4dfe8a2f1218bc8e2ad19665713f8a4fbbf..c5b008da884a802cf77ba5e987d6612f300309f6 100644 (file)
@@ -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)]
index 303896737dc28183ec4123cfafc036c2d5164db1..f282943bba33730fe301b94c22755fdc44f851df 100644 (file)
@@ -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)]
index 79c38dcb4ccac457eb5ed80ea75c29293aca8bb7..c44abc2313a081243c61e8b2de7f5a1b5f5bc503 100644 (file)
@@ -10,7 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-#![feature(struct_variant)]
 extern crate rand;
 
 
index 1e153a772c7e14c9da552dde2576ba1e8d8dbb44..fc03b99983d99aa2197027308fec076280edb1ec 100644 (file)
@@ -10,7 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-#![feature(struct_variant)]
 extern crate rand;
 
 
index 2c223918773d8f65711aea29719153aad9fe71bd..36e1e52139397a58e141c93d2c0b0ffd0599d6ca 100644 (file)
@@ -10,7 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-#![feature(struct_variant)]
 extern crate rand;
 
 
index 5d5a1372c13a22188a3e3cdbcff079fc88bef09a..ffa26061833fad86abddcc10f84b0ccfd7994d12 100644 (file)
@@ -10,7 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-#![feature(struct_variant)]
 extern crate rand;
 
 
index 93f53dc73f76b4a880dc472a5876975882072418..fa1cfc3de5ba314784ef0f4dd06c51b0da860cf7 100644 (file)
@@ -10,7 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-#![feature(struct_variant)]
 extern crate rand;
 
 
index e61a62c2f6da390cfbda4cee23dbdf3ea40c3892..9b1dccf7df5a3f57cf2452205a0c956cb7a103d7 100644 (file)
@@ -10,7 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-#![feature(struct_variant)]
 extern crate rand;
 
 
index 3a48b3334b7ab723b0dd67f4d44d0dcc6ee48785..8acb6875d53a8e00034b052a22c984c18697d1dd 100644 (file)
@@ -10,7 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-#![feature(struct_variant)]
 extern crate rand;
 
 
index 54806f322b38387000a341b7684c532be2c5d746..bcbced125ef14a7b442cfc5549d637d5f1ff10d2 100644 (file)
@@ -10,7 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-#![feature(struct_variant)]
 extern crate rand;
 
 
index 964e7d8c811dd3a536609350c019a5828b3ce5b7..25add55ae4bfc233d2caef78568b859fa333f27d 100644 (file)
@@ -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)]
index 96e87ca20069420689721a6b877f10f754a0974b..e58121f2cb0813af1cdf72dd132859f82a4f7d8d 100644 (file)
@@ -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)]
index 784c766c05724216197854b086cd3f7762ea6377..0637c6e305cfe524add8c969b2c04af2700acc1a 100644 (file)
@@ -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)]
index 3dcff5f80ce3daf0a120c4410284d7ea711b7961..3a2cbb11f53fba0e527cdcd197654e5235875107 100644 (file)
@@ -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)]
index c16e64829dd0603443918e97d0f82c2a4cb57f69..3b4f4e1080d40446b6d42ec89c5d60091567b9ce 100644 (file)
@@ -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)]
index 4b3f0ce52c7bf1585627fc1b6eb01de923c9e50c..02a55fdfbb24c20f6fcc70e4cf820e4c276ca73e 100644 (file)
@@ -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)]
index 56d627423782627bc33bcc11912ebbdc45969e7f..7cf3ad57f470123f4cd543e90b6c7f30afdaeb7c 100644 (file)
@@ -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)]
index 2330fdd8b893a05414e8cc75f486635041afe6f1..7b8d1d3ecd04a058ec13980aeb65fae1a49ac8a3 100644 (file)
@@ -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)]
index fb7759c6032e86687dfd11bfd145e05ca81c25d6..302fecd518b8692df600887fba519e532bbd7d38 100644 (file)
@@ -10,7 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-#![feature(struct_variant)]
 extern crate rand;
 
 
index 193e4b5c6b2d51a665d9ac18a3a80c35909d2daf..05b81ce325113ab4b74148e4be3c1735fd34fe88 100644 (file)
@@ -10,7 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-#![feature(struct_variant)]
 extern crate rand;
 
 
index 47b576b2b85e5e0077df880546e2b7a6d2ce7a0e..7ea114605ce78f13739156765cf47edc729d08cc 100644 (file)
@@ -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`
 
index 0634ba183a8702d4836a70dd7982ba057ec644c9..4cbb61d9853b04bbdaf923ded2ce7a4bcea826d8 100644 (file)
@@ -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/gated-struct-enums.rs b/src/test/compile-fail/gated-struct-enums.rs
deleted file mode 100644 (file)
index f1bd936..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2013 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.
-
-enum A { B { foo: int } }
-//~^ ERROR: enum struct variants are experimental
-
-fn main() {}
-
index 0c103515981cdfbb66c22e35f7376800e6aa8d20..5b9ff06e9c9a39229c41e369da9aa9e2d8653a01 100644 (file)
@@ -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 }
index c884f02892f167b61991d7c7f8f6d4c4da296f60..930e96f170e36176aba4257695f046e2e3212ebc 100644 (file)
@@ -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 }
 }
index a698bf61f5894bc416d617a901c6904a9739639a..7c3242a6a25ccfd9b69098a3639fc277541a1f14 100644 (file)
@@ -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)]
index 1f0d91dcb3cd93665731c6bfbba7ca410cd84af2..1a3bd82a9810801f02922f8999034b7bbdebe18b 100644 (file)
@@ -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)]
 
index f0b6abe28d37af117d09c423fa4412527ec17a68..365081aee1ab548e17e48a326f907327325e153f 100644 (file)
@@ -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
     },
 }
index da43324d494a53db9858b0e65d5a2584d60e8e69..72632b56706c41a27b02c1bb4877fd8850cce6ba 100644 (file)
@@ -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)]
 
index 55ffdcd7f9fb314a51b242411976726a07c5fd67..373bcb1f85913305e100adf6d2749b1e6adcb8c1 100644 (file)
@@ -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<int>), //~ ERROR private type in exported type signature
     Baz2 {
-        pub x: Private<int>, //~ ERROR private type in exported type signature
-        y: Private<int>
+        y: Private<int> //~ ERROR private type in exported type signature
     },
 }
 
index 09916a11f72e77440d4254e7fb9a65a4ba5ce7bf..120f092d732f92199f1ee61320a077218d4db8ea 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // aux-build:namespaced_enums.rs
-#![feature(struct_variant, globs)]
+#![feature(globs)]
 
 extern crate namespaced_enums;
 
index 1554d410070d697c424fc126d091d5908d8a8efd..a8f4e6ba0903b6ac9e599b4fd02f43eb0442d5cd 100644 (file)
@@ -7,7 +7,7 @@
 // <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(struct_variant, globs)]
+#![feature(globs)]
 
 mod m2 {
     pub enum Foo {
index b7ff3a18fcf7a3a19cf30b01a0328c9fc1655cc7..7f1204ceee897f3393b804a5d9c91e4308ba68dc 100644 (file)
@@ -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,
index 8d1e5b462792f55e400f53117b8072ea4508e4cb..91709e2ea7da086950134346f115b3f4d30a0f8e 100644 (file)
@@ -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<int> },
     C
diff --git a/src/test/compile-fail/struct-variant-no-pub.rs b/src/test/compile-fail/struct-variant-no-pub.rs
new file mode 100644 (file)
index 0000000..15ed690
--- /dev/null
@@ -0,0 +1,17 @@
+// 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.
+//
+// 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.
+
+enum Foo {
+    Bar {
+        pub a: int //~ ERROR: `pub` is not allowed here
+    }
+}
+
+fn main() {}
index 2d289c7f6cddb3a03a6d3afde657dc9d4328a476..c58273361ad0bebc691fd34903f9f9e9ad61f056 100644 (file)
@@ -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
index 53b8fdf71b72c69331046879ead28dcd8428e0a9..bf404c276482b86704393007abfdde54d2afa5d5 100644 (file)
@@ -7,8 +7,6 @@
 // <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(struct_variant)]
-
 mod foo {
     enum Bar {
         Baz { a: int }
index 41196b60c8eba261273d0517708fc01401324a44..2f1eb35a426235a64c8fe0991731ef8be248b4ee 100644 (file)
@@ -7,7 +7,6 @@
 // <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(struct_variant)]
 
 // Test `Sized?` types not allowed in fields (except the last one).