about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/auxiliary/lint_stability.rs13
-rw-r--r--src/test/compile-fail/lint-stability.rs32
-rw-r--r--src/test/compile-fail/missing-stability.rs33
3 files changed, 37 insertions, 41 deletions
diff --git a/src/test/auxiliary/lint_stability.rs b/src/test/auxiliary/lint_stability.rs
index 3679557d06b..7ac3925fb24 100644
--- a/src/test/auxiliary/lint_stability.rs
+++ b/src/test/auxiliary/lint_stability.rs
@@ -11,6 +11,7 @@
 #![crate_type = "lib"]
 #![feature(staged_api)]
 #![staged_api]
+#![stable(feature = "lint_stability", since = "1.0.0")]
 
 #[stable(feature = "test_feature", since = "1.0.0")]
 #[deprecated(since = "1.0.0")]
@@ -31,8 +32,6 @@ pub fn unstable() {}
 #[unstable(feature = "test_feature", reason = "text")]
 pub fn unstable_text() {}
 
-pub fn unmarked() {}
-
 #[stable(feature = "rust1", since = "1.0.0")]
 pub fn stable() {}
 #[stable(feature = "rust1", since = "1.0.0", reason = "text")]
@@ -61,8 +60,6 @@ impl MethodTester {
     #[unstable(feature = "test_feature", reason = "text")]
     pub fn method_unstable_text(&self) {}
 
-    pub fn method_unmarked(&self) {}
-
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn method_stable(&self) {}
     #[stable(feature = "rust1", since = "1.0.0", reason = "text")]
@@ -79,6 +76,7 @@ impl MethodTester {
     pub fn method_frozen_text(&self) {}
 }
 
+#[stable(feature = "test_feature", since = "1.0.0")]
 pub trait Trait {
     #[stable(feature = "test_feature", since = "1.0.0")]
     #[deprecated(since = "1.0.0")]
@@ -99,8 +97,6 @@ pub trait Trait {
     #[unstable(feature = "test_feature", reason = "text")]
     fn trait_unstable_text(&self) {}
 
-    fn trait_unmarked(&self) {}
-
     #[stable(feature = "rust1", since = "1.0.0")]
     fn trait_stable(&self) {}
     #[stable(feature = "rust1", since = "1.0.0", reason = "text")]
@@ -130,7 +126,6 @@ pub struct DeprecatedStruct { pub i: int }
 pub struct DeprecatedUnstableStruct { pub i: int }
 #[unstable(feature = "test_feature")]
 pub struct UnstableStruct { pub i: int }
-pub struct UnmarkedStruct { pub i: int }
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct StableStruct { pub i: int }
 
@@ -142,10 +137,10 @@ pub struct DeprecatedUnitStruct;
 pub struct DeprecatedUnstableUnitStruct;
 #[unstable(feature = "test_feature")]
 pub struct UnstableUnitStruct;
-pub struct UnmarkedUnitStruct;
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct StableUnitStruct;
 
+#[stable(feature = "test_feature", since = "1.0.0")]
 pub enum Enum {
     #[stable(feature = "test_feature", since = "1.0.0")]
     #[deprecated(since = "1.0.0")]
@@ -156,7 +151,6 @@ pub enum Enum {
     #[unstable(feature = "test_feature")]
     UnstableVariant,
 
-    UnmarkedVariant,
     #[stable(feature = "rust1", since = "1.0.0")]
     StableVariant,
 }
@@ -169,7 +163,6 @@ pub struct DeprecatedTupleStruct(pub int);
 pub struct DeprecatedUnstableTupleStruct(pub int);
 #[unstable(feature = "test_feature")]
 pub struct UnstableTupleStruct(pub int);
-pub struct UnmarkedTupleStruct(pub int);
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct StableTupleStruct(pub int);
 
diff --git a/src/test/compile-fail/lint-stability.rs b/src/test/compile-fail/lint-stability.rs
index 5b093a8556c..4cf75bf15de 100644
--- a/src/test/compile-fail/lint-stability.rs
+++ b/src/test/compile-fail/lint-stability.rs
@@ -20,7 +20,7 @@
 #![staged_api]
 
 #[macro_use]
-extern crate lint_stability; //~ ERROR: use of unmarked library feature
+extern crate lint_stability;
 
 mod cross_crate {
     extern crate stability_cfg1;
@@ -61,10 +61,6 @@ mod cross_crate {
         foo.method_unstable_text(); //~ WARNING use of unstable library feature 'test_feature': text
         foo.trait_unstable_text(); //~ WARNING use of unstable library feature 'test_feature': text
 
-        unmarked(); //~ ERROR use of unmarked library feature
-        foo.method_unmarked(); //~ ERROR use of unmarked library feature
-        foo.trait_unmarked(); //~ ERROR use of unmarked library feature
-
         stable();
         foo.method_stable();
         foo.trait_stable();
@@ -77,28 +73,24 @@ mod cross_crate {
         let _ = DeprecatedUnstableStruct { i: 0 }; //~ ERROR use of deprecated item
         //~^ WARNING use of unstable library feature
         let _ = UnstableStruct { i: 0 }; //~ WARNING use of unstable library feature
-        let _ = UnmarkedStruct { i: 0 }; //~ ERROR use of unmarked library feature
         let _ = StableStruct { i: 0 };
 
         let _ = DeprecatedUnitStruct; //~ ERROR use of deprecated item
         let _ = DeprecatedUnstableUnitStruct; //~ ERROR use of deprecated item
         //~^ WARNING use of unstable library feature
         let _ = UnstableUnitStruct; //~ WARNING use of unstable library feature
-        let _ = UnmarkedUnitStruct; //~ ERROR use of unmarked library feature
         let _ = StableUnitStruct;
 
         let _ = Enum::DeprecatedVariant; //~ ERROR use of deprecated item
         let _ = Enum::DeprecatedUnstableVariant; //~ ERROR use of deprecated item
         //~^ WARNING use of unstable library feature
         let _ = Enum::UnstableVariant; //~ WARNING use of unstable library feature
-        let _ = Enum::UnmarkedVariant; //~ ERROR use of unmarked library feature
         let _ = Enum::StableVariant;
 
         let _ = DeprecatedTupleStruct (1); //~ ERROR use of deprecated item
         let _ = DeprecatedUnstableTupleStruct (1); //~ ERROR use of deprecated item
         //~^ WARNING use of unstable library feature
         let _ = UnstableTupleStruct (1); //~ WARNING use of unstable library feature
-        let _ = UnmarkedTupleStruct (1); //~ ERROR use of unmarked library feature
         let _ = StableTupleStruct (1);
 
         // At the moment, the lint checker only checks stability in
@@ -123,7 +115,6 @@ mod cross_crate {
         //~^ WARNING use of unstable library feature
         foo.trait_unstable(); //~ WARNING use of unstable library feature
         foo.trait_unstable_text(); //~ WARNING use of unstable library feature 'test_feature': text
-        foo.trait_unmarked(); //~ ERROR use of unmarked library feature
         foo.trait_stable();
     }
 
@@ -136,7 +127,6 @@ mod cross_crate {
         //~^ WARNING use of unstable library feature
         foo.trait_unstable(); //~ WARNING use of unstable library feature
         foo.trait_unstable_text(); //~ WARNING use of unstable library feature 'test_feature': text
-        foo.trait_unmarked(); //~ ERROR use of unmarked library feature
         foo.trait_stable();
     }
 
@@ -183,8 +173,6 @@ mod this_crate {
     #[unstable(feature = "test_feature", reason = "text")]
     pub fn unstable_text() {}
 
-    pub fn unmarked() {}
-
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn stable() {}
     #[stable(feature = "rust1", since = "1.0.0", reason = "text")]
@@ -206,8 +194,6 @@ mod this_crate {
         #[unstable(feature = "test_feature", reason = "text")]
         pub fn method_unstable_text(&self) {}
 
-        pub fn method_unmarked(&self) {}
-
         #[stable(feature = "rust1", since = "1.0.0")]
         pub fn method_stable(&self) {}
         #[stable(feature = "rust1", since = "1.0.0", reason = "text")]
@@ -227,8 +213,6 @@ mod this_crate {
         #[unstable(feature = "test_feature", reason = "text")]
         fn trait_unstable_text(&self) {}
 
-        fn trait_unmarked(&self) {}
-
         #[stable(feature = "rust1", since = "1.0.0")]
         fn trait_stable(&self) {}
         #[stable(feature = "rust1", since = "1.0.0", reason = "text")]
@@ -242,7 +226,6 @@ mod this_crate {
     pub struct DeprecatedStruct { i: isize }
     #[unstable(feature = "test_feature")]
     pub struct UnstableStruct { i: isize }
-    pub struct UnmarkedStruct { i: isize }
     #[stable(feature = "rust1", since = "1.0.0")]
     pub struct StableStruct { i: isize }
 
@@ -251,7 +234,6 @@ mod this_crate {
     pub struct DeprecatedUnitStruct;
     #[unstable(feature = "test_feature")]
     pub struct UnstableUnitStruct;
-    pub struct UnmarkedUnitStruct;
     #[stable(feature = "rust1", since = "1.0.0")]
     pub struct StableUnitStruct;
 
@@ -262,7 +244,6 @@ mod this_crate {
         #[unstable(feature = "test_feature")]
         UnstableVariant,
 
-        UnmarkedVariant,
         #[stable(feature = "rust1", since = "1.0.0")]
         StableVariant,
     }
@@ -272,7 +253,6 @@ mod this_crate {
     pub struct DeprecatedTupleStruct(isize);
     #[unstable(feature = "test_feature")]
     pub struct UnstableTupleStruct(isize);
-    pub struct UnmarkedTupleStruct(isize);
     #[stable(feature = "rust1", since = "1.0.0")]
     pub struct StableTupleStruct(isize);
 
@@ -299,10 +279,6 @@ mod this_crate {
         foo.method_unstable_text();
         foo.trait_unstable_text();
 
-        unmarked();
-        foo.method_unmarked();
-        foo.trait_unmarked();
-
         stable();
         foo.method_stable();
         foo.trait_stable();
@@ -313,22 +289,18 @@ mod this_crate {
 
         let _ = DeprecatedStruct { i: 0 }; //~ ERROR use of deprecated item
         let _ = UnstableStruct { i: 0 };
-        let _ = UnmarkedStruct { i: 0 };
         let _ = StableStruct { i: 0 };
 
         let _ = DeprecatedUnitStruct; //~ ERROR use of deprecated item
         let _ = UnstableUnitStruct;
-        let _ = UnmarkedUnitStruct;
         let _ = StableUnitStruct;
 
         let _ = Enum::DeprecatedVariant; //~ ERROR use of deprecated item
         let _ = Enum::UnstableVariant;
-        let _ = Enum::UnmarkedVariant;
         let _ = Enum::StableVariant;
 
         let _ = DeprecatedTupleStruct (1); //~ ERROR use of deprecated item
         let _ = UnstableTupleStruct (1);
-        let _ = UnmarkedTupleStruct (1);
         let _ = StableTupleStruct (1);
     }
 
@@ -337,7 +309,6 @@ mod this_crate {
         foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
         foo.trait_unstable();
         foo.trait_unstable_text();
-        foo.trait_unmarked();
         foo.trait_stable();
     }
 
@@ -346,7 +317,6 @@ mod this_crate {
         foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
         foo.trait_unstable();
         foo.trait_unstable_text();
-        foo.trait_unmarked();
         foo.trait_stable();
     }
 
diff --git a/src/test/compile-fail/missing-stability.rs b/src/test/compile-fail/missing-stability.rs
new file mode 100644
index 00000000000..14dd983161b
--- /dev/null
+++ b/src/test/compile-fail/missing-stability.rs
@@ -0,0 +1,33 @@
+// Copyright 2015 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.
+
+// Checks that exported items without stability attributes cause an error
+
+#![crate_type="lib"]
+#![feature(staged_api)]
+#![staged_api]
+
+pub fn unmarked() {
+    //~^ ERROR This node does not have a stability attribute
+    ()
+}
+
+#[unstable(feature = "foo")]
+pub mod foo {
+    // #[unstable] is inherited
+    pub fn unmarked() {}
+}
+
+#[stable(feature = "bar", since="1.0.0")]
+pub mod bar {
+    // #[stable] is not inherited
+    pub fn unmarked() {}
+    //~^ ERROR This node does not have a stability attribute
+}
\ No newline at end of file