summaryrefslogtreecommitdiffstats
path: root/src/test/ui/stability-attribute
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /src/test/ui/stability-attribute
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--src/test/ui/stability-attribute/accidental-stable-in-unstable.rs10
-rw-r--r--src/test/ui/stability-attribute/accidental-stable-in-unstable.stderr11
-rw-r--r--src/test/ui/stability-attribute/allow-unstable-reexport.rs30
-rw-r--r--src/test/ui/stability-attribute/allow-unstable-reexport.stderr27
-rw-r--r--src/test/ui/stability-attribute/allowed-through-unstable.rs9
-rw-r--r--src/test/ui/stability-attribute/allowed-through-unstable.stderr12
-rw-r--r--src/test/ui/stability-attribute/auxiliary/allowed-through-unstable-core.rs14
-rw-r--r--src/test/ui/stability-attribute/auxiliary/lint-stability-reexport.rs9
-rw-r--r--src/test/ui/stability-attribute/auxiliary/lint-stability.rs188
-rw-r--r--src/test/ui/stability-attribute/auxiliary/stability-attribute-implies.rs8
-rw-r--r--src/test/ui/stability-attribute/auxiliary/stability_attribute_issue.rs9
-rw-r--r--src/test/ui/stability-attribute/auxiliary/stable-in-unstable-core.rs8
-rw-r--r--src/test/ui/stability-attribute/auxiliary/stable-in-unstable-std.rs11
-rw-r--r--src/test/ui/stability-attribute/auxiliary/unstable_generic_param.rs229
-rw-r--r--src/test/ui/stability-attribute/generics-default-stability-trait.rs33
-rw-r--r--src/test/ui/stability-attribute/generics-default-stability-trait.stderr27
-rw-r--r--src/test/ui/stability-attribute/generics-default-stability-where.rs11
-rw-r--r--src/test/ui/stability-attribute/generics-default-stability-where.stderr11
-rw-r--r--src/test/ui/stability-attribute/generics-default-stability.rs251
-rw-r--r--src/test/ui/stability-attribute/generics-default-stability.stderr469
-rw-r--r--src/test/ui/stability-attribute/issue-28075.rs13
-rw-r--r--src/test/ui/stability-attribute/issue-28075.stderr11
-rw-r--r--src/test/ui/stability-attribute/issue-28388-3.rs11
-rw-r--r--src/test/ui/stability-attribute/issue-28388-3.stderr11
-rw-r--r--src/test/ui/stability-attribute/issue-99286-stable-intrinsics.rs17
-rw-r--r--src/test/ui/stability-attribute/missing-const-stability.rs32
-rw-r--r--src/test/ui/stability-attribute/missing-const-stability.stderr23
-rw-r--r--src/test/ui/stability-attribute/missing-stability-attr-at-top-level.rs4
-rw-r--r--src/test/ui/stability-attribute/missing-stability-attr-at-top-level.stderr11
-rw-r--r--src/test/ui/stability-attribute/stability-attribute-implies-missing.rs10
-rw-r--r--src/test/ui/stability-attribute/stability-attribute-implies-missing.stderr8
-rw-r--r--src/test/ui/stability-attribute/stability-attribute-implies-no-feature.rs13
-rw-r--r--src/test/ui/stability-attribute/stability-attribute-implies-no-feature.stderr21
-rw-r--r--src/test/ui/stability-attribute/stability-attribute-implies-using-stable.rs15
-rw-r--r--src/test/ui/stability-attribute/stability-attribute-implies-using-stable.stderr22
-rw-r--r--src/test/ui/stability-attribute/stability-attribute-implies-using-unstable.rs17
-rw-r--r--src/test/ui/stability-attribute/stability-attribute-implies-using-unstable.stderr22
-rw-r--r--src/test/ui/stability-attribute/stability-attribute-issue-43027.rs15
-rw-r--r--src/test/ui/stability-attribute/stability-attribute-issue.rs12
-rw-r--r--src/test/ui/stability-attribute/stability-attribute-issue.stderr21
-rw-r--r--src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.rs5
-rw-r--r--src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.stderr15
-rw-r--r--src/test/ui/stability-attribute/stability-attribute-non-staged.rs3
-rw-r--r--src/test/ui/stability-attribute/stability-attribute-non-staged.stderr15
-rw-r--r--src/test/ui/stability-attribute/stability-attribute-sanity-2.rs17
-rw-r--r--src/test/ui/stability-attribute/stability-attribute-sanity-2.stderr24
-rw-r--r--src/test/ui/stability-attribute/stability-attribute-sanity-3.rs12
-rw-r--r--src/test/ui/stability-attribute/stability-attribute-sanity-3.stderr10
-rw-r--r--src/test/ui/stability-attribute/stability-attribute-sanity-4.rs29
-rw-r--r--src/test/ui/stability-attribute/stability-attribute-sanity-4.stderr39
-rw-r--r--src/test/ui/stability-attribute/stability-attribute-sanity.rs76
-rw-r--r--src/test/ui/stability-attribute/stability-attribute-sanity.stderr136
-rw-r--r--src/test/ui/stability-attribute/stability-attribute-trait-impl.rs29
-rw-r--r--src/test/ui/stability-attribute/stability-attribute-trait-impl.stderr23
-rw-r--r--src/test/ui/stability-attribute/stability-in-private-module.rs4
-rw-r--r--src/test/ui/stability-attribute/stability-in-private-module.stderr15
-rw-r--r--src/test/ui/stability-attribute/stable-in-unstable.rs46
-rw-r--r--src/test/ui/stability-attribute/stable-in-unstable.stderr39
-rw-r--r--src/test/ui/stability-attribute/suggest-vec-allocator-api.rs9
-rw-r--r--src/test/ui/stability-attribute/suggest-vec-allocator-api.stderr49
60 files changed, 2281 insertions, 0 deletions
diff --git a/src/test/ui/stability-attribute/accidental-stable-in-unstable.rs b/src/test/ui/stability-attribute/accidental-stable-in-unstable.rs
new file mode 100644
index 000000000..f8bbe90cf
--- /dev/null
+++ b/src/test/ui/stability-attribute/accidental-stable-in-unstable.rs
@@ -0,0 +1,10 @@
+#![crate_type = "lib"]
+extern crate core;
+
+// Known accidental stabilizations with no known users, slated for un-stabilization
+// fully stable @ core::char::UNICODE_VERSION
+use core::unicode::UNICODE_VERSION; //~ ERROR use of unstable library feature 'unicode_internals'
+
+// Known accidental stabilizations with known users
+// fully stable @ core::mem::transmute
+use core::intrinsics::transmute; // depended upon by rand_core
diff --git a/src/test/ui/stability-attribute/accidental-stable-in-unstable.stderr b/src/test/ui/stability-attribute/accidental-stable-in-unstable.stderr
new file mode 100644
index 000000000..ff733822c
--- /dev/null
+++ b/src/test/ui/stability-attribute/accidental-stable-in-unstable.stderr
@@ -0,0 +1,11 @@
+error[E0658]: use of unstable library feature 'unicode_internals'
+ --> $DIR/accidental-stable-in-unstable.rs:6:5
+ |
+LL | use core::unicode::UNICODE_VERSION;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add `#![feature(unicode_internals)]` to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/stability-attribute/allow-unstable-reexport.rs b/src/test/ui/stability-attribute/allow-unstable-reexport.rs
new file mode 100644
index 000000000..937913954
--- /dev/null
+++ b/src/test/ui/stability-attribute/allow-unstable-reexport.rs
@@ -0,0 +1,30 @@
+// Allow an unstable re-export without requiring a feature gate.
+// #94972
+
+// aux-build:lint-stability.rs
+// aux-build:lint-stability-reexport.rs
+#![feature(staged_api)]
+#![stable(feature = "lint_stability", since = "1.0.0")]
+
+extern crate lint_stability;
+extern crate lint_stability_reexport;
+
+#[unstable(feature = "unstable_test_feature", issue = "none")]
+pub use lint_stability::unstable;
+
+// We want to confirm that using a re-export through another crate behaves
+// the same way as using an item directly
+#[unstable(feature = "unstable_test_feature", issue = "none")]
+pub use lint_stability_reexport::unstable_text;
+
+// Ensure items which aren't marked as unstable can't re-export unstable items
+#[stable(feature = "lint_stability", since = "1.0.0")]
+pub use lint_stability::unstable as unstable2;
+//~^ ERROR use of unstable library feature 'unstable_test_feature'
+
+fn main() {
+ // Since we didn't enable the feature in this crate, we still can't
+ // use these items, even though they're in scope from the `use`s which are now allowed.
+ unstable(); //~ ERROR use of unstable library feature 'unstable_test_feature'
+ unstable_text(); //~ ERROR use of unstable library feature 'unstable_test_feature'
+}
diff --git a/src/test/ui/stability-attribute/allow-unstable-reexport.stderr b/src/test/ui/stability-attribute/allow-unstable-reexport.stderr
new file mode 100644
index 000000000..a11da9dc8
--- /dev/null
+++ b/src/test/ui/stability-attribute/allow-unstable-reexport.stderr
@@ -0,0 +1,27 @@
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/allow-unstable-reexport.rs:22:9
+ |
+LL | pub use lint_stability::unstable as unstable2;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/allow-unstable-reexport.rs:28:5
+ |
+LL | unstable();
+ | ^^^^^^^^
+ |
+ = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature': text
+ --> $DIR/allow-unstable-reexport.rs:29:5
+ |
+LL | unstable_text();
+ | ^^^^^^^^^^^^^
+ |
+ = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/stability-attribute/allowed-through-unstable.rs b/src/test/ui/stability-attribute/allowed-through-unstable.rs
new file mode 100644
index 000000000..ff0228e4d
--- /dev/null
+++ b/src/test/ui/stability-attribute/allowed-through-unstable.rs
@@ -0,0 +1,9 @@
+// Test for new `#[rustc_allowed_through_unstable_modules]` attribute
+//
+// aux-build:allowed-through-unstable-core.rs
+#![crate_type = "lib"]
+
+extern crate allowed_through_unstable_core;
+
+use allowed_through_unstable_core::unstable_module::OldStableTraitAllowedThoughUnstable;
+use allowed_through_unstable_core::unstable_module::NewStableTraitNotAllowedThroughUnstable; //~ ERROR use of unstable library feature 'unstable_test_feature'
diff --git a/src/test/ui/stability-attribute/allowed-through-unstable.stderr b/src/test/ui/stability-attribute/allowed-through-unstable.stderr
new file mode 100644
index 000000000..132c00b89
--- /dev/null
+++ b/src/test/ui/stability-attribute/allowed-through-unstable.stderr
@@ -0,0 +1,12 @@
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/allowed-through-unstable.rs:9:5
+ |
+LL | use allowed_through_unstable_core::unstable_module::NewStableTraitNotAllowedThroughUnstable;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #1 <https://github.com/rust-lang/rust/issues/1> for more information
+ = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/stability-attribute/auxiliary/allowed-through-unstable-core.rs b/src/test/ui/stability-attribute/auxiliary/allowed-through-unstable-core.rs
new file mode 100644
index 000000000..b597009a3
--- /dev/null
+++ b/src/test/ui/stability-attribute/auxiliary/allowed-through-unstable-core.rs
@@ -0,0 +1,14 @@
+#![crate_type = "lib"]
+#![feature(staged_api)]
+#![feature(rustc_attrs)]
+#![stable(feature = "stable_test_feature", since = "1.2.0")]
+
+#[unstable(feature = "unstable_test_feature", issue = "1")]
+pub mod unstable_module {
+ #[stable(feature = "stable_test_feature", since = "1.2.0")]
+ #[rustc_allowed_through_unstable_modules]
+ pub trait OldStableTraitAllowedThoughUnstable {}
+
+ #[stable(feature = "stable_test_feature", since = "1.2.0")]
+ pub trait NewStableTraitNotAllowedThroughUnstable {}
+}
diff --git a/src/test/ui/stability-attribute/auxiliary/lint-stability-reexport.rs b/src/test/ui/stability-attribute/auxiliary/lint-stability-reexport.rs
new file mode 100644
index 000000000..9884731d5
--- /dev/null
+++ b/src/test/ui/stability-attribute/auxiliary/lint-stability-reexport.rs
@@ -0,0 +1,9 @@
+#![crate_type = "lib"]
+#![feature(staged_api)]
+#![stable(feature = "lint_stability", since = "1.0.0")]
+
+extern crate lint_stability;
+
+// Re-exporting without enabling the feature "unstable_test_feature" in this crate
+#[unstable(feature = "unstable_test_feature", issue = "none")]
+pub use lint_stability::unstable_text;
diff --git a/src/test/ui/stability-attribute/auxiliary/lint-stability.rs b/src/test/ui/stability-attribute/auxiliary/lint-stability.rs
new file mode 100644
index 000000000..99c29dcdd
--- /dev/null
+++ b/src/test/ui/stability-attribute/auxiliary/lint-stability.rs
@@ -0,0 +1,188 @@
+#![crate_name="lint_stability"]
+#![crate_type = "lib"]
+#![feature(staged_api)]
+#![feature(associated_type_defaults)]
+#![stable(feature = "lint_stability", since = "1.0.0")]
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+#[deprecated(since = "1.0.0", note = "text")]
+pub fn deprecated() {}
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+#[deprecated(since = "1.0.0", note = "text")]
+pub fn deprecated_text() {}
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+#[deprecated(since = "99.99.99", note = "text")]
+pub fn deprecated_future() {}
+
+#[unstable(feature = "unstable_test_feature", issue = "none")]
+#[deprecated(since = "1.0.0", note = "text")]
+pub fn deprecated_unstable() {}
+#[unstable(feature = "unstable_test_feature", issue = "none")]
+#[deprecated(since = "1.0.0", note = "text")]
+pub fn deprecated_unstable_text() {}
+
+#[unstable(feature = "unstable_test_feature", issue = "none")]
+pub fn unstable() {}
+#[unstable(feature = "unstable_test_feature", reason = "text", issue = "none")]
+pub fn unstable_text() {}
+
+#[stable(feature = "rust1", since = "1.0.0")]
+pub fn stable() {}
+#[stable(feature = "rust1", since = "1.0.0")]
+pub fn stable_text() {}
+
+#[stable(feature = "rust1", since = "1.0.0")]
+pub struct MethodTester;
+
+impl MethodTester {
+ #[stable(feature = "stable_test_feature", since = "1.0.0")]
+ #[deprecated(since = "1.0.0", note = "text")]
+ pub fn method_deprecated(&self) {}
+ #[stable(feature = "stable_test_feature", since = "1.0.0")]
+ #[deprecated(since = "1.0.0", note = "text")]
+ pub fn method_deprecated_text(&self) {}
+
+ #[unstable(feature = "unstable_test_feature", issue = "none")]
+ #[deprecated(since = "1.0.0", note = "text")]
+ pub fn method_deprecated_unstable(&self) {}
+ #[unstable(feature = "unstable_test_feature", issue = "none")]
+ #[deprecated(since = "1.0.0", note = "text")]
+ pub fn method_deprecated_unstable_text(&self) {}
+
+ #[unstable(feature = "unstable_test_feature", issue = "none")]
+ pub fn method_unstable(&self) {}
+ #[unstable(feature = "unstable_test_feature", reason = "text", issue = "none")]
+ pub fn method_unstable_text(&self) {}
+
+ #[stable(feature = "rust1", since = "1.0.0")]
+ pub fn method_stable(&self) {}
+ #[stable(feature = "rust1", since = "1.0.0")]
+ pub fn method_stable_text(&self) {}
+}
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub trait Trait {
+ #[stable(feature = "stable_test_feature", since = "1.0.0")]
+ #[deprecated(since = "1.0.0", note = "text")]
+ fn trait_deprecated(&self) {}
+ #[stable(feature = "stable_test_feature", since = "1.0.0")]
+ #[deprecated(since = "1.0.0", note = "text")]
+ fn trait_deprecated_text(&self) {}
+
+ #[unstable(feature = "unstable_test_feature", issue = "none")]
+ #[deprecated(since = "1.0.0", note = "text")]
+ fn trait_deprecated_unstable(&self) {}
+ #[unstable(feature = "unstable_test_feature", issue = "none")]
+ #[deprecated(since = "1.0.0", note = "text")]
+ fn trait_deprecated_unstable_text(&self) {}
+
+ #[unstable(feature = "unstable_test_feature", issue = "none")]
+ fn trait_unstable(&self) {}
+ #[unstable(feature = "unstable_test_feature", reason = "text", issue = "none")]
+ fn trait_unstable_text(&self) {}
+
+ #[stable(feature = "rust1", since = "1.0.0")]
+ fn trait_stable(&self) {}
+ #[stable(feature = "rust1", since = "1.0.0")]
+ fn trait_stable_text(&self) {}
+}
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub trait TraitWithAssociatedTypes {
+ #[unstable(feature = "unstable_test_feature", issue = "none")]
+ type TypeUnstable = u8;
+ #[stable(feature = "stable_test_feature", since = "1.0.0")]
+ #[deprecated(since = "1.0.0", note = "text")]
+ type TypeDeprecated = u8;
+}
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+impl Trait for MethodTester {}
+
+#[unstable(feature = "unstable_test_feature", issue = "none")]
+pub trait UnstableTrait { fn dummy(&self) { } }
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+#[deprecated(since = "1.0.0", note = "text")]
+pub trait DeprecatedTrait {
+ #[stable(feature = "stable_test_feature", since = "1.0.0")] fn dummy(&self) { }
+}
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+#[deprecated(since = "1.0.0", note = "text")]
+pub struct DeprecatedStruct {
+ #[stable(feature = "stable_test_feature", since = "1.0.0")] pub i: isize
+}
+#[unstable(feature = "unstable_test_feature", issue = "none")]
+#[deprecated(since = "1.0.0", note = "text")]
+pub struct DeprecatedUnstableStruct {
+ #[stable(feature = "stable_test_feature", since = "1.0.0")] pub i: isize
+}
+#[unstable(feature = "unstable_test_feature", issue = "none")]
+pub struct UnstableStruct {
+ #[stable(feature = "stable_test_feature", since = "1.0.0")] pub i: isize
+}
+#[stable(feature = "rust1", since = "1.0.0")]
+pub struct StableStruct {
+ #[stable(feature = "stable_test_feature", since = "1.0.0")] pub i: isize
+}
+#[unstable(feature = "unstable_test_feature", issue = "none")]
+pub enum UnstableEnum {}
+#[stable(feature = "rust1", since = "1.0.0")]
+pub enum StableEnum {}
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+#[deprecated(since = "1.0.0", note = "text")]
+pub struct DeprecatedUnitStruct;
+#[unstable(feature = "unstable_test_feature", issue = "none")]
+#[deprecated(since = "1.0.0", note = "text")]
+pub struct DeprecatedUnstableUnitStruct;
+#[unstable(feature = "unstable_test_feature", issue = "none")]
+pub struct UnstableUnitStruct;
+#[stable(feature = "rust1", since = "1.0.0")]
+pub struct StableUnitStruct;
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub enum Enum {
+ #[stable(feature = "stable_test_feature", since = "1.0.0")]
+ #[deprecated(since = "1.0.0", note = "text")]
+ DeprecatedVariant,
+ #[unstable(feature = "unstable_test_feature", issue = "none")]
+ #[deprecated(since = "1.0.0", note = "text")]
+ DeprecatedUnstableVariant,
+ #[unstable(feature = "unstable_test_feature", issue = "none")]
+ UnstableVariant,
+
+ #[stable(feature = "rust1", since = "1.0.0")]
+ StableVariant,
+}
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+#[deprecated(since = "1.0.0", note = "text")]
+pub struct DeprecatedTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize);
+#[unstable(feature = "unstable_test_feature", issue = "none")]
+#[deprecated(since = "1.0.0", note = "text")]
+pub struct DeprecatedUnstableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize);
+#[unstable(feature = "unstable_test_feature", issue = "none")]
+pub struct UnstableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize);
+#[stable(feature = "rust1", since = "1.0.0")]
+pub struct StableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize);
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+#[macro_export]
+macro_rules! macro_test {
+ () => (deprecated());
+}
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+#[macro_export]
+macro_rules! macro_test_arg {
+ ($func:expr) => ($func);
+}
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+#[macro_export]
+macro_rules! macro_test_arg_nested {
+ ($func:ident) => (macro_test_arg!($func()));
+}
diff --git a/src/test/ui/stability-attribute/auxiliary/stability-attribute-implies.rs b/src/test/ui/stability-attribute/auxiliary/stability-attribute-implies.rs
new file mode 100644
index 000000000..468be1bc1
--- /dev/null
+++ b/src/test/ui/stability-attribute/auxiliary/stability-attribute-implies.rs
@@ -0,0 +1,8 @@
+#![feature(staged_api)]
+#![stable(feature = "stability_attribute_implies", since = "1.0.0")]
+
+#[stable(feature = "foo", since = "1.62.0")]
+pub fn foo() {}
+
+#[unstable(feature = "foobar", issue = "1", implied_by = "foo")]
+pub fn foobar() {}
diff --git a/src/test/ui/stability-attribute/auxiliary/stability_attribute_issue.rs b/src/test/ui/stability-attribute/auxiliary/stability_attribute_issue.rs
new file mode 100644
index 000000000..4e5333289
--- /dev/null
+++ b/src/test/ui/stability-attribute/auxiliary/stability_attribute_issue.rs
@@ -0,0 +1,9 @@
+#![feature(staged_api)]
+#![stable(feature = "stable_test_feature", since = "1.2.0")]
+
+
+#[unstable(feature = "unstable_test_feature", issue = "1")]
+pub fn unstable() {}
+
+#[unstable(feature = "unstable_test_feature", reason = "message", issue = "2")]
+pub fn unstable_msg() {}
diff --git a/src/test/ui/stability-attribute/auxiliary/stable-in-unstable-core.rs b/src/test/ui/stability-attribute/auxiliary/stable-in-unstable-core.rs
new file mode 100644
index 000000000..e45b00f99
--- /dev/null
+++ b/src/test/ui/stability-attribute/auxiliary/stable-in-unstable-core.rs
@@ -0,0 +1,8 @@
+#![feature(staged_api)]
+#![stable(feature = "stable_test_feature", since = "1.2.0")]
+
+#[unstable(feature = "unstable_test_feature", issue = "1")]
+pub mod new_unstable_module {
+ #[stable(feature = "stable_test_feature", since = "1.2.0")]
+ pub trait OldTrait {}
+}
diff --git a/src/test/ui/stability-attribute/auxiliary/stable-in-unstable-std.rs b/src/test/ui/stability-attribute/auxiliary/stable-in-unstable-std.rs
new file mode 100644
index 000000000..28ad8c28d
--- /dev/null
+++ b/src/test/ui/stability-attribute/auxiliary/stable-in-unstable-std.rs
@@ -0,0 +1,11 @@
+#![feature(staged_api)]
+#![feature(unstable_test_feature)]
+#![stable(feature = "stable_test_feature", since = "1.2.0")]
+
+extern crate stable_in_unstable_core;
+
+#[stable(feature = "stable_test_feature", since = "1.2.0")]
+pub mod old_stable_module {
+ #[stable(feature = "stable_test_feature", since = "1.2.0")]
+ pub use stable_in_unstable_core::new_unstable_module::OldTrait;
+}
diff --git a/src/test/ui/stability-attribute/auxiliary/unstable_generic_param.rs b/src/test/ui/stability-attribute/auxiliary/unstable_generic_param.rs
new file mode 100644
index 000000000..1d6a6bd4e
--- /dev/null
+++ b/src/test/ui/stability-attribute/auxiliary/unstable_generic_param.rs
@@ -0,0 +1,229 @@
+#![crate_type = "lib"]
+#![feature(staged_api)]
+#![stable(feature = "stable_test_feature", since = "1.0.0")]
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub trait Trait1<#[unstable(feature = "unstable_default", issue = "none")] T = ()> {
+ #[stable(feature = "stable_test_feature", since = "1.0.0")]
+ fn foo() -> T;
+}
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub trait Trait2<#[unstable(feature = "unstable_default", issue = "none")] T = usize> {
+ #[stable(feature = "stable_test_feature", since = "1.0.0")]
+ fn foo() -> T;
+}
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub trait Trait3<T = ()> {
+ #[stable(feature = "stable_test_feature", since = "1.0.0")]
+ fn foo() -> T;
+}
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub struct Struct1<#[unstable(feature = "unstable_default", issue = "none")] T = usize> {
+ #[stable(feature = "stable_test_feature", since = "1.0.0")]
+ pub field: T,
+}
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub struct Struct2<T = usize> {
+ #[stable(feature = "stable_test_feature", since = "1.0.0")]
+ pub field: T,
+}
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub struct Struct3<A = isize, #[unstable(feature = "unstable_default", issue = "none")] B = usize> {
+ #[stable(feature = "stable_test_feature", since = "1.0.0")]
+ pub field1: A,
+ #[stable(feature = "stable_test_feature", since = "1.0.0")]
+ pub field2: B,
+}
+
+#[deprecated(since = "1.1.0", note = "test")]
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub struct Struct4<A = usize> {
+ #[stable(feature = "stable_test_feature", since = "1.0.0")]
+ pub field: A,
+}
+
+#[deprecated(since = "1.1.0", note = "test")]
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub struct Struct5<#[unstable(feature = "unstable_default", issue = "none")] A = usize> {
+ #[stable(feature = "stable_test_feature", since = "1.0.0")]
+ pub field: A,
+}
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub struct Struct6<#[unstable(feature = "unstable_default6", issue = "none")] T = usize> {
+ #[stable(feature = "stable_test_feature", since = "1.0.0")]
+ pub field: T,
+}
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub const STRUCT1: Struct1 = Struct1 { field: 1 };
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub const STRUCT2: Struct2 = Struct2 { field: 1 };
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub const STRUCT3: Struct3 = Struct3 { field1: 1, field2: 2 };
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub const STRUCT4: Struct4 = Struct4 { field: 1 };
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub const STRUCT5: Struct5 = Struct5 { field: 1 };
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub enum Enum1<#[unstable(feature = "unstable_default", issue = "none")] T = usize> {
+ #[stable(feature = "stable_test_feature", since = "1.0.0")]
+ Some(#[stable(feature = "stable_test_feature", since = "1.0.0")] T),
+ #[stable(feature = "stable_test_feature", since = "1.0.0")]
+ None,
+}
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub enum Enum2<T = usize> {
+ #[stable(feature = "stable_test_feature", since = "1.0.0")]
+ Some(#[stable(feature = "stable_test_feature", since = "1.0.0")] T),
+ #[stable(feature = "stable_test_feature", since = "1.0.0")]
+ None,
+}
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub enum Enum3<T = isize, #[unstable(feature = "unstable_default", issue = "none")] E = usize> {
+ #[stable(feature = "stable_test_feature", since = "1.0.0")]
+ Ok(#[stable(feature = "stable_test_feature", since = "1.0.0")] T),
+ #[stable(feature = "stable_test_feature", since = "1.0.0")]
+ Err(#[stable(feature = "stable_test_feature", since = "1.0.0")] E),
+}
+
+#[deprecated(since = "1.1.0", note = "test")]
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub enum Enum4<T = usize> {
+ #[stable(feature = "stable_test_feature", since = "1.0.0")]
+ Some(#[stable(feature = "stable_test_feature", since = "1.0.0")] T),
+ #[stable(feature = "stable_test_feature", since = "1.0.0")]
+ None,
+}
+
+#[deprecated(since = "1.1.0", note = "test")]
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub enum Enum5<#[unstable(feature = "unstable_default", issue = "none")] T = usize> {
+ #[stable(feature = "stable_test_feature", since = "1.0.0")]
+ Some(#[stable(feature = "stable_test_feature", since = "1.0.0")] T),
+ #[stable(feature = "stable_test_feature", since = "1.0.0")]
+ None,
+}
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub enum Enum6<#[unstable(feature = "unstable_default6", issue = "none")] T = usize> {
+ #[stable(feature = "stable_test_feature", since = "1.0.0")]
+ Some(#[stable(feature = "stable_test_feature", since = "1.0.0")] T),
+ #[stable(feature = "stable_test_feature", since = "1.0.0")]
+ None,
+}
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub const ENUM1: Enum1 = Enum1::Some(1);
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub const ENUM2: Enum2 = Enum2::Some(1);
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub const ENUM3: Enum3 = Enum3::Ok(1);
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub const ENUM3B: Enum3 = Enum3::Err(1);
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub const ENUM4: Enum4 = Enum4::Some(1);
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub const ENUM5: Enum5 = Enum5::Some(1);
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub type Alias1<#[unstable(feature = "unstable_default", issue = "none")] T = usize> = Option<T>;
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub type Alias2<T = usize> = Option<T>;
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub type Alias3<T = isize, #[unstable(feature = "unstable_default", issue = "none")] E = usize> =
+ Result<T, E>;
+
+#[deprecated(since = "1.1.0", note = "test")]
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub type Alias4<T = usize> = Option<T>;
+
+#[deprecated(since = "1.1.0", note = "test")]
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub type Alias5<#[unstable(feature = "unstable_default", issue = "none")] T = usize> = Option<T>;
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub type Alias6<#[unstable(feature = "unstable_default6", issue = "none")] T = usize> = Option<T>;
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub const ALIAS1: Alias1 = Alias1::Some(1);
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub const ALIAS2: Alias2 = Alias2::Some(1);
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub const ALIAS3: Alias3 = Alias3::Ok(1);
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub const ALIAS3B: Alias3 = Alias3::Err(1);
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub const ALIAS4: Alias4 = Alias4::Some(1);
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub const ALIAS5: Alias5 = Alias5::Some(1);
+
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub trait Alloc {}
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub struct System {}
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+impl Alloc for System {}
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub struct Box1<T, #[unstable(feature = "box_alloc_param", issue = "none")] A: Alloc = System> {
+ ptr: *mut T,
+ alloc: A,
+}
+
+impl<T> Box1<T, System> {
+ #[stable(feature = "stable_test_feature", since = "1.0.0")]
+ pub fn new(mut t: T) -> Self {
+ unsafe { Self { ptr: &mut t, alloc: System {} } }
+ }
+}
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub struct Box2<T, A: Alloc = System> {
+ ptr: *mut T,
+ alloc: A,
+}
+
+impl<T> Box2<T, System> {
+ #[stable(feature = "stable_test_feature", since = "1.0.0")]
+ pub fn new(mut t: T) -> Self {
+ Self { ptr: &mut t, alloc: System {} }
+ }
+}
+
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub struct Box3<T> {
+ ptr: *mut T,
+}
+
+impl<T> Box3<T> {
+ #[stable(feature = "stable_test_feature", since = "1.0.0")]
+ pub fn new(mut t: T) -> Self {
+ Self { ptr: &mut t }
+ }
+}
diff --git a/src/test/ui/stability-attribute/generics-default-stability-trait.rs b/src/test/ui/stability-attribute/generics-default-stability-trait.rs
new file mode 100644
index 000000000..d436088e4
--- /dev/null
+++ b/src/test/ui/stability-attribute/generics-default-stability-trait.rs
@@ -0,0 +1,33 @@
+// aux-build:unstable_generic_param.rs
+#![feature(unstable_default6)]
+
+extern crate unstable_generic_param;
+
+use unstable_generic_param::*;
+
+struct R;
+
+impl Trait1 for S {
+ fn foo() -> () { () } // ok
+}
+
+struct S;
+
+impl Trait1<usize> for S { //~ ERROR use of unstable library feature 'unstable_default'
+ fn foo() -> usize { 0 }
+}
+
+impl Trait1<isize> for S { //~ ERROR use of unstable library feature 'unstable_default'
+ fn foo() -> isize { 0 }
+}
+
+impl Trait2<usize> for S { //~ ERROR use of unstable library feature 'unstable_default'
+ fn foo() -> usize { 0 }
+}
+
+impl Trait3<usize> for S {
+ fn foo() -> usize { 0 } // ok
+}
+
+fn main() {
+}
diff --git a/src/test/ui/stability-attribute/generics-default-stability-trait.stderr b/src/test/ui/stability-attribute/generics-default-stability-trait.stderr
new file mode 100644
index 000000000..03e61b78e
--- /dev/null
+++ b/src/test/ui/stability-attribute/generics-default-stability-trait.stderr
@@ -0,0 +1,27 @@
+error[E0658]: use of unstable library feature 'unstable_default'
+ --> $DIR/generics-default-stability-trait.rs:16:13
+ |
+LL | impl Trait1<usize> for S {
+ | ^^^^^
+ |
+ = help: add `#![feature(unstable_default)]` to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_default'
+ --> $DIR/generics-default-stability-trait.rs:20:13
+ |
+LL | impl Trait1<isize> for S {
+ | ^^^^^
+ |
+ = help: add `#![feature(unstable_default)]` to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_default'
+ --> $DIR/generics-default-stability-trait.rs:24:13
+ |
+LL | impl Trait2<usize> for S {
+ | ^^^^^
+ |
+ = help: add `#![feature(unstable_default)]` to the crate attributes to enable
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/stability-attribute/generics-default-stability-where.rs b/src/test/ui/stability-attribute/generics-default-stability-where.rs
new file mode 100644
index 000000000..4afbca262
--- /dev/null
+++ b/src/test/ui/stability-attribute/generics-default-stability-where.rs
@@ -0,0 +1,11 @@
+// aux-build:unstable_generic_param.rs
+
+extern crate unstable_generic_param;
+
+use unstable_generic_param::*;
+
+impl<T> Trait3<usize> for T where T: Trait2<usize> { //~ ERROR use of unstable library feature 'unstable_default'
+ fn foo() -> usize { T::foo() }
+}
+
+fn main() {}
diff --git a/src/test/ui/stability-attribute/generics-default-stability-where.stderr b/src/test/ui/stability-attribute/generics-default-stability-where.stderr
new file mode 100644
index 000000000..61253adc8
--- /dev/null
+++ b/src/test/ui/stability-attribute/generics-default-stability-where.stderr
@@ -0,0 +1,11 @@
+error[E0658]: use of unstable library feature 'unstable_default'
+ --> $DIR/generics-default-stability-where.rs:7:45
+ |
+LL | impl<T> Trait3<usize> for T where T: Trait2<usize> {
+ | ^^^^^
+ |
+ = help: add `#![feature(unstable_default)]` to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/stability-attribute/generics-default-stability.rs b/src/test/ui/stability-attribute/generics-default-stability.rs
new file mode 100644
index 000000000..300cc34d6
--- /dev/null
+++ b/src/test/ui/stability-attribute/generics-default-stability.rs
@@ -0,0 +1,251 @@
+// aux-build:unstable_generic_param.rs
+#![feature(unstable_default6)]
+
+extern crate unstable_generic_param;
+
+use unstable_generic_param::*;
+
+struct R;
+
+impl Trait1 for S {
+ fn foo() -> () { () } // ok
+}
+
+struct S;
+
+impl Trait3<usize> for S {
+ fn foo() -> usize { 0 } // ok
+}
+
+fn main() {
+ let _ = S;
+
+ let _: Struct1<isize> = Struct1 { field: 1 }; //~ ERROR use of unstable library feature 'unstable_default'
+
+ let _ = STRUCT1; // ok
+ let _: Struct1 = STRUCT1; // ok
+ let _: Struct1<usize> = STRUCT1; //~ ERROR use of unstable library feature 'unstable_default'
+ let _: Struct1<isize> = Struct1 { field: 0 }; //~ ERROR use of unstable library feature 'unstable_default'
+
+ // Instability is not enforced for generic type parameters used in public fields.
+ // Note how the unstable type default `usize` leaks,
+ // and can be used without the 'unstable_default' feature.
+ let _ = STRUCT1.field;
+ let _ = Struct1 { field: 1 };
+ let _ = Struct1 { field: () };
+ let _ = Struct1 { field: 1isize };
+ let _: Struct1 = Struct1 { field: 1 };
+ let _: usize = STRUCT1.field;
+ let _ = STRUCT1.field + 1;
+ let _ = STRUCT1.field + 1usize;
+
+ let _ = Struct2 { field: 1 }; // ok
+ let _: Struct2 = Struct2 { field: 1 }; // ok
+ let _: Struct2<usize> = Struct2 { field: 1 }; // ok
+
+ let _ = STRUCT2;
+ let _: Struct2 = STRUCT2; // ok
+ let _: Struct2<usize> = STRUCT2; // ok
+ let _: Struct2<isize> = Struct2 { field: 0 }; // ok
+ let _ = STRUCT2.field; // ok
+ let _: usize = STRUCT2.field; // ok
+ let _ = STRUCT2.field + 1; // ok
+ let _ = STRUCT2.field + 1usize; // ok
+
+ let _ = STRUCT3;
+ let _: Struct3 = STRUCT3; // ok
+ let _: Struct3<isize, usize> = STRUCT3; //~ ERROR use of unstable library feature 'unstable_default'
+ let _: Struct3<isize> = STRUCT3; // ok
+ let _: Struct3<isize, isize> = Struct3 { field1: 0, field2: 0 }; //~ ERROR use of unstable library feature 'unstable_default'
+ let _: Struct3<usize, usize> = Struct3 { field1: 0, field2: 0 }; //~ ERROR use of unstable library feature 'unstable_default'
+ let _ = STRUCT3.field1; // ok
+ let _: isize = STRUCT3.field1; // ok
+ let _ = STRUCT3.field1 + 1; // ok
+ // Note the aforementioned leak.
+ let _: usize = STRUCT3.field2; // ok
+ let _: Struct3<usize> = Struct3 { field1: 0, field2: 0 }; // ok
+ let _ = STRUCT3.field2 + 1; // ok
+ let _ = STRUCT3.field2 + 1usize; // ok
+
+ let _ = STRUCT4;
+ let _: Struct4<isize> = Struct4 { field: 1 };
+ //~^ use of deprecated struct `unstable_generic_param::Struct4`: test [deprecated]
+ //~^^ use of deprecated struct `unstable_generic_param::Struct4`: test [deprecated]
+ //~^^^ use of deprecated field `unstable_generic_param::Struct4::field`: test [deprecated]
+ let _ = STRUCT4;
+ let _: Struct4 = STRUCT4; //~ use of deprecated struct `unstable_generic_param::Struct4`: test [deprecated]
+ let _: Struct4<usize> = STRUCT4; //~ use of deprecated struct `unstable_generic_param::Struct4`: test [deprecated]
+ let _: Struct4<isize> = Struct4 { field: 0 };
+ //~^ use of deprecated struct `unstable_generic_param::Struct4`: test [deprecated]
+ //~^^ use of deprecated struct `unstable_generic_param::Struct4`: test [deprecated]
+ //~^^^ use of deprecated field `unstable_generic_param::Struct4::field`: test [deprecated]
+
+ let _ = STRUCT5;
+ let _: Struct5<isize> = Struct5 { field: 1 }; //~ ERROR use of unstable library feature 'unstable_default'
+ //~^ use of deprecated struct `unstable_generic_param::Struct5`: test [deprecated]
+ //~^^ use of deprecated struct `unstable_generic_param::Struct5`: test [deprecated]
+ //~^^^ use of deprecated field `unstable_generic_param::Struct5::field`: test [deprecated]
+ let _ = STRUCT5;
+ let _: Struct5 = STRUCT5; //~ use of deprecated struct `unstable_generic_param::Struct5`: test [deprecated]
+ let _: Struct5<usize> = STRUCT5; //~ ERROR use of unstable library feature 'unstable_default'
+ //~^ use of deprecated struct `unstable_generic_param::Struct5`: test [deprecated]
+ let _: Struct5<isize> = Struct5 { field: 0 }; //~ ERROR use of unstable library feature 'unstable_default'
+ //~^ use of deprecated struct `unstable_generic_param::Struct5`: test [deprecated]
+ //~^^ use of deprecated struct `unstable_generic_param::Struct5`: test [deprecated]
+ //~^^^ use of deprecated field `unstable_generic_param::Struct5::field`: test [deprecated]
+
+ let _: Struct6<isize> = Struct6 { field: 1 }; // ok
+ let _: Struct6<isize> = Struct6 { field: 0 }; // ok
+
+ let _: Alias1<isize> = Alias1::Some(1); //~ ERROR use of unstable library feature 'unstable_default'
+
+ let _ = ALIAS1; // ok
+ let _: Alias1 = ALIAS1; // ok
+ let _: Alias1<usize> = ALIAS1; //~ ERROR use of unstable library feature 'unstable_default'
+ let _: Alias1<isize> = Alias1::Some(0); //~ ERROR use of unstable library feature 'unstable_default'
+
+ // Instability is not enforced for generic type parameters used in public fields.
+ // Note how the unstable type default `usize` leaks,
+ // and can be used without the 'unstable_default' feature.
+ let _ = Alias1::Some(1);
+ let _ = Alias1::Some(());
+ let _ = Alias1::Some(1isize);
+ let _: Alias1 = Alias1::Some(1);
+ let _: usize = ALIAS1.unwrap();
+ let _ = ALIAS1.unwrap() + 1;
+ let _ = ALIAS1.unwrap() + 1usize;
+
+ let _ = Alias2::Some(1); // ok
+ let _: Alias2 = Alias2::Some(1); // ok
+ let _: Alias2<usize> = Alias2::Some(1); // ok
+
+ let _ = ALIAS2;
+ let _: Alias2 = ALIAS2; // ok
+ let _: Alias2<usize> = ALIAS2; // ok
+ let _: Alias2<isize> = Alias2::Some(0); // ok
+ let _ = ALIAS2.unwrap(); // ok
+ let _: usize = ALIAS2.unwrap(); // ok
+ let _ = ALIAS2.unwrap() + 1; // ok
+ let _ = ALIAS2.unwrap() + 1usize; // ok
+
+ let _ = ALIAS3;
+ let _: Alias3 = ALIAS3; // ok
+ let _: Alias3<isize, usize> = ALIAS3; //~ ERROR use of unstable library feature 'unstable_default'
+ let _: Alias3<isize> = ALIAS3; // ok
+ let _: Alias3<isize, isize> = Alias3::Ok(0); //~ ERROR use of unstable library feature 'unstable_default'
+ let _: Alias3<usize, usize> = Alias3::Ok(0); //~ ERROR use of unstable library feature 'unstable_default'
+ let _ = ALIAS3.unwrap(); // ok
+ let _: isize = ALIAS3.unwrap(); // ok
+ let _ = ALIAS3.unwrap() + 1; // ok
+ // Note the aforementioned leak.
+ let _: usize = ALIAS3B.unwrap_err(); // ok
+ let _: Alias3<usize> = Alias3::Err(0); // ok
+ let _ = ALIAS3B.unwrap_err() + 1; // ok
+ let _ = ALIAS3B.unwrap_err() + 1usize; // ok
+
+ let _ = ALIAS4;
+ let _: Alias4<isize> = Alias4::Some(1);
+ //~^ use of deprecated type alias `unstable_generic_param::Alias4`: test [deprecated]
+ //~^^ use of deprecated type alias `unstable_generic_param::Alias4`: test [deprecated]
+ let _ = ALIAS4;
+ let _: Alias4 = ALIAS4; //~ use of deprecated type alias `unstable_generic_param::Alias4`: test [deprecated]
+ let _: Alias4<usize> = ALIAS4; //~ use of deprecated type alias `unstable_generic_param::Alias4`: test [deprecated]
+ let _: Alias4<isize> = Alias4::Some(0);
+ //~^ use of deprecated type alias `unstable_generic_param::Alias4`: test [deprecated]
+ //~^^ use of deprecated type alias `unstable_generic_param::Alias4`: test [deprecated]
+
+ let _ = ALIAS5;
+ let _: Alias5<isize> = Alias5::Some(1); //~ ERROR use of unstable library feature 'unstable_default'
+ //~^ use of deprecated type alias `unstable_generic_param::Alias5`: test [deprecated]
+ //~^^ use of deprecated type alias `unstable_generic_param::Alias5`: test [deprecated]
+ let _ = ALIAS5;
+ let _: Alias5 = ALIAS5; //~ use of deprecated type alias `unstable_generic_param::Alias5`: test [deprecated]
+ let _: Alias5<usize> = ALIAS5; //~ ERROR use of unstable library feature 'unstable_default'
+ //~^ use of deprecated type alias `unstable_generic_param::Alias5`: test [deprecated]
+ let _: Alias5<isize> = Alias5::Some(0); //~ ERROR use of unstable library feature 'unstable_default'
+ //~^ use of deprecated type alias `unstable_generic_param::Alias5`: test [deprecated]
+ //~^^ use of deprecated type alias `unstable_generic_param::Alias5`: test [deprecated]
+
+ let _: Alias6<isize> = Alias6::Some(1); // ok
+ let _: Alias6<isize> = Alias6::Some(0); // ok
+
+ let _: Enum1<isize> = Enum1::Some(1); //~ ERROR use of unstable library feature 'unstable_default'
+
+ let _ = ENUM1; // ok
+ let _: Enum1 = ENUM1; // ok
+ let _: Enum1<usize> = ENUM1; //~ ERROR use of unstable library feature 'unstable_default'
+ let _: Enum1<isize> = Enum1::Some(0); //~ ERROR use of unstable library feature 'unstable_default'
+
+ // Instability is not enforced for generic type parameters used in public fields.
+ // Note how the unstable type default `usize` leaks,
+ // and can be used without the 'unstable_default' feature.
+ let _ = Enum1::Some(1);
+ let _ = Enum1::Some(());
+ let _ = Enum1::Some(1isize);
+ let _: Enum1 = Enum1::Some(1);
+ if let Enum1::Some(x) = ENUM1 {let _: usize = x;}
+ if let Enum1::Some(x) = ENUM1 {let _ = x + 1;}
+ if let Enum1::Some(x) = ENUM1 {let _ = x + 1usize;}
+
+ let _ = Enum2::Some(1); // ok
+ let _: Enum2 = Enum2::Some(1); // ok
+ let _: Enum2<usize> = Enum2::Some(1); // ok
+
+ let _ = ENUM2;
+ let _: Enum2 = ENUM2; // ok
+ let _: Enum2<usize> = ENUM2; // ok
+ let _: Enum2<isize> = Enum2::Some(0); // ok
+ if let Enum2::Some(x) = ENUM2 {let _ = x;} // ok
+ if let Enum2::Some(x) = ENUM2 {let _: usize = x;} // ok
+ if let Enum2::Some(x) = ENUM2 {let _ = x + 1;} // ok
+ if let Enum2::Some(x) = ENUM2 {let _ = x + 1usize;} // ok
+
+ let _ = ENUM3;
+ let _: Enum3 = ENUM3; // ok
+ let _: Enum3<isize, usize> = ENUM3; //~ ERROR use of unstable library feature 'unstable_default'
+ let _: Enum3<isize> = ENUM3; // ok
+ let _: Enum3<isize, isize> = Enum3::Ok(0); //~ ERROR use of unstable library feature 'unstable_default'
+ let _: Enum3<usize, usize> = Enum3::Ok(0); //~ ERROR use of unstable library feature 'unstable_default'
+ if let Enum3::Ok(x) = ENUM3 {let _ = x;} // ok
+ if let Enum3::Ok(x) = ENUM3 {let _: isize = x;} // ok
+ if let Enum3::Ok(x) = ENUM3 {let _ = x + 1;} // ok
+ // Note the aforementioned leak.
+ if let Enum3::Err(x) = ENUM3B {let _: usize = x;} // ok
+ let _: Enum3<usize> = Enum3::Err(0); // ok
+ if let Enum3::Err(x) = ENUM3B {let _ = x + 1;} // ok
+ if let Enum3::Err(x) = ENUM3B {let _ = x + 1usize;} // ok
+
+ let _ = ENUM4;
+ let _: Enum4<isize> = Enum4::Some(1);
+ //~^ use of deprecated tuple variant `unstable_generic_param::Enum4::Some`: test [deprecated]
+ //~^^ use of deprecated enum `unstable_generic_param::Enum4`: test [deprecated]
+ let _ = ENUM4;
+ let _: Enum4 = ENUM4; //~ use of deprecated enum `unstable_generic_param::Enum4`: test [deprecated]
+ let _: Enum4<usize> = ENUM4; //~ use of deprecated enum `unstable_generic_param::Enum4`: test [deprecated]
+ let _: Enum4<isize> = Enum4::Some(0);
+ //~^ use of deprecated tuple variant `unstable_generic_param::Enum4::Some`: test [deprecated]
+ //~^^ use of deprecated enum `unstable_generic_param::Enum4`: test [deprecated]
+
+ let _ = ENUM5;
+ let _: Enum5<isize> = Enum5::Some(1); //~ ERROR use of unstable library feature 'unstable_default'
+ //~^ use of deprecated tuple variant `unstable_generic_param::Enum5::Some`: test [deprecated]
+ //~^^ use of deprecated enum `unstable_generic_param::Enum5`: test [deprecated]
+ let _ = ENUM5;
+ let _: Enum5 = ENUM5; //~ use of deprecated enum `unstable_generic_param::Enum5`: test [deprecated]
+ let _: Enum5<usize> = ENUM5; //~ ERROR use of unstable library feature 'unstable_default'
+ //~^ use of deprecated enum `unstable_generic_param::Enum5`: test [deprecated]
+ let _: Enum5<isize> = Enum5::Some(0); //~ ERROR use of unstable library feature 'unstable_default'
+ //~^ use of deprecated tuple variant `unstable_generic_param::Enum5::Some`: test [deprecated]
+ //~^^ use of deprecated enum `unstable_generic_param::Enum5`: test [deprecated]
+
+ let _: Enum6<isize> = Enum6::Some(1); // ok
+ let _: Enum6<isize> = Enum6::Some(0); // ok
+
+ let _: Box1<isize, System> = Box1::new(1); //~ ERROR use of unstable library feature 'box_alloc_param'
+ let _: Box1<isize> = Box1::new(1); // ok
+
+ let _: Box2<isize, System> = Box2::new(1); // ok
+ let _: Box2<isize> = Box2::new(1); // ok
+
+ let _: Box3<isize> = Box3::new(1); // ok
+}
diff --git a/src/test/ui/stability-attribute/generics-default-stability.stderr b/src/test/ui/stability-attribute/generics-default-stability.stderr
new file mode 100644
index 000000000..e094a10c8
--- /dev/null
+++ b/src/test/ui/stability-attribute/generics-default-stability.stderr
@@ -0,0 +1,469 @@
+warning: use of deprecated struct `unstable_generic_param::Struct4`: test
+ --> $DIR/generics-default-stability.rs:71:29
+ |
+LL | let _: Struct4<isize> = Struct4 { field: 1 };
+ | ^^^^^^^
+ |
+ = note: `#[warn(deprecated)]` on by default
+
+warning: use of deprecated struct `unstable_generic_param::Struct4`: test
+ --> $DIR/generics-default-stability.rs:71:12
+ |
+LL | let _: Struct4<isize> = Struct4 { field: 1 };
+ | ^^^^^^^
+
+warning: use of deprecated struct `unstable_generic_param::Struct4`: test
+ --> $DIR/generics-default-stability.rs:76:12
+ |
+LL | let _: Struct4 = STRUCT4;
+ | ^^^^^^^
+
+warning: use of deprecated struct `unstable_generic_param::Struct4`: test
+ --> $DIR/generics-default-stability.rs:77:12
+ |
+LL | let _: Struct4<usize> = STRUCT4;
+ | ^^^^^^^
+
+warning: use of deprecated struct `unstable_generic_param::Struct4`: test
+ --> $DIR/generics-default-stability.rs:78:29
+ |
+LL | let _: Struct4<isize> = Struct4 { field: 0 };
+ | ^^^^^^^
+
+warning: use of deprecated struct `unstable_generic_param::Struct4`: test
+ --> $DIR/generics-default-stability.rs:78:12
+ |
+LL | let _: Struct4<isize> = Struct4 { field: 0 };
+ | ^^^^^^^
+
+warning: use of deprecated struct `unstable_generic_param::Struct5`: test
+ --> $DIR/generics-default-stability.rs:84:29
+ |
+LL | let _: Struct5<isize> = Struct5 { field: 1 };
+ | ^^^^^^^
+
+warning: use of deprecated struct `unstable_generic_param::Struct5`: test
+ --> $DIR/generics-default-stability.rs:84:12
+ |
+LL | let _: Struct5<isize> = Struct5 { field: 1 };
+ | ^^^^^^^
+
+warning: use of deprecated struct `unstable_generic_param::Struct5`: test
+ --> $DIR/generics-default-stability.rs:89:12
+ |
+LL | let _: Struct5 = STRUCT5;
+ | ^^^^^^^
+
+warning: use of deprecated struct `unstable_generic_param::Struct5`: test
+ --> $DIR/generics-default-stability.rs:90:12
+ |
+LL | let _: Struct5<usize> = STRUCT5;
+ | ^^^^^^^
+
+warning: use of deprecated struct `unstable_generic_param::Struct5`: test
+ --> $DIR/generics-default-stability.rs:92:29
+ |
+LL | let _: Struct5<isize> = Struct5 { field: 0 };
+ | ^^^^^^^
+
+warning: use of deprecated struct `unstable_generic_param::Struct5`: test
+ --> $DIR/generics-default-stability.rs:92:12
+ |
+LL | let _: Struct5<isize> = Struct5 { field: 0 };
+ | ^^^^^^^
+
+warning: use of deprecated type alias `unstable_generic_param::Alias4`: test
+ --> $DIR/generics-default-stability.rs:147:28
+ |
+LL | let _: Alias4<isize> = Alias4::Some(1);
+ | ^^^^^^
+
+warning: use of deprecated type alias `unstable_generic_param::Alias4`: test
+ --> $DIR/generics-default-stability.rs:147:12
+ |
+LL | let _: Alias4<isize> = Alias4::Some(1);
+ | ^^^^^^
+
+warning: use of deprecated type alias `unstable_generic_param::Alias4`: test
+ --> $DIR/generics-default-stability.rs:151:12
+ |
+LL | let _: Alias4 = ALIAS4;
+ | ^^^^^^
+
+warning: use of deprecated type alias `unstable_generic_param::Alias4`: test
+ --> $DIR/generics-default-stability.rs:152:12
+ |
+LL | let _: Alias4<usize> = ALIAS4;
+ | ^^^^^^
+
+warning: use of deprecated type alias `unstable_generic_param::Alias4`: test
+ --> $DIR/generics-default-stability.rs:153:28
+ |
+LL | let _: Alias4<isize> = Alias4::Some(0);
+ | ^^^^^^
+
+warning: use of deprecated type alias `unstable_generic_param::Alias4`: test
+ --> $DIR/generics-default-stability.rs:153:12
+ |
+LL | let _: Alias4<isize> = Alias4::Some(0);
+ | ^^^^^^
+
+warning: use of deprecated type alias `unstable_generic_param::Alias5`: test
+ --> $DIR/generics-default-stability.rs:158:28
+ |
+LL | let _: Alias5<isize> = Alias5::Some(1);
+ | ^^^^^^
+
+warning: use of deprecated type alias `unstable_generic_param::Alias5`: test
+ --> $DIR/generics-default-stability.rs:158:12
+ |
+LL | let _: Alias5<isize> = Alias5::Some(1);
+ | ^^^^^^
+
+warning: use of deprecated type alias `unstable_generic_param::Alias5`: test
+ --> $DIR/generics-default-stability.rs:162:12
+ |
+LL | let _: Alias5 = ALIAS5;
+ | ^^^^^^
+
+warning: use of deprecated type alias `unstable_generic_param::Alias5`: test
+ --> $DIR/generics-default-stability.rs:163:12
+ |
+LL | let _: Alias5<usize> = ALIAS5;
+ | ^^^^^^
+
+warning: use of deprecated type alias `unstable_generic_param::Alias5`: test
+ --> $DIR/generics-default-stability.rs:165:28
+ |
+LL | let _: Alias5<isize> = Alias5::Some(0);
+ | ^^^^^^
+
+warning: use of deprecated type alias `unstable_generic_param::Alias5`: test
+ --> $DIR/generics-default-stability.rs:165:12
+ |
+LL | let _: Alias5<isize> = Alias5::Some(0);
+ | ^^^^^^
+
+warning: use of deprecated tuple variant `unstable_generic_param::Enum4::Some`: test
+ --> $DIR/generics-default-stability.rs:219:34
+ |
+LL | let _: Enum4<isize> = Enum4::Some(1);
+ | ^^^^
+
+warning: use of deprecated enum `unstable_generic_param::Enum4`: test
+ --> $DIR/generics-default-stability.rs:219:12
+ |
+LL | let _: Enum4<isize> = Enum4::Some(1);
+ | ^^^^^
+
+warning: use of deprecated enum `unstable_generic_param::Enum4`: test
+ --> $DIR/generics-default-stability.rs:223:12
+ |
+LL | let _: Enum4 = ENUM4;
+ | ^^^^^
+
+warning: use of deprecated enum `unstable_generic_param::Enum4`: test
+ --> $DIR/generics-default-stability.rs:224:12
+ |
+LL | let _: Enum4<usize> = ENUM4;
+ | ^^^^^
+
+warning: use of deprecated tuple variant `unstable_generic_param::Enum4::Some`: test
+ --> $DIR/generics-default-stability.rs:225:34
+ |
+LL | let _: Enum4<isize> = Enum4::Some(0);
+ | ^^^^
+
+warning: use of deprecated enum `unstable_generic_param::Enum4`: test
+ --> $DIR/generics-default-stability.rs:225:12
+ |
+LL | let _: Enum4<isize> = Enum4::Some(0);
+ | ^^^^^
+
+warning: use of deprecated tuple variant `unstable_generic_param::Enum5::Some`: test
+ --> $DIR/generics-default-stability.rs:230:34
+ |
+LL | let _: Enum5<isize> = Enum5::Some(1);
+ | ^^^^
+
+warning: use of deprecated enum `unstable_generic_param::Enum5`: test
+ --> $DIR/generics-default-stability.rs:230:12
+ |
+LL | let _: Enum5<isize> = Enum5::Some(1);
+ | ^^^^^
+
+warning: use of deprecated enum `unstable_generic_param::Enum5`: test
+ --> $DIR/generics-default-stability.rs:234:12
+ |
+LL | let _: Enum5 = ENUM5;
+ | ^^^^^
+
+warning: use of deprecated enum `unstable_generic_param::Enum5`: test
+ --> $DIR/generics-default-stability.rs:235:12
+ |
+LL | let _: Enum5<usize> = ENUM5;
+ | ^^^^^
+
+warning: use of deprecated tuple variant `unstable_generic_param::Enum5::Some`: test
+ --> $DIR/generics-default-stability.rs:237:34
+ |
+LL | let _: Enum5<isize> = Enum5::Some(0);
+ | ^^^^
+
+warning: use of deprecated enum `unstable_generic_param::Enum5`: test
+ --> $DIR/generics-default-stability.rs:237:12
+ |
+LL | let _: Enum5<isize> = Enum5::Some(0);
+ | ^^^^^
+
+error[E0658]: use of unstable library feature 'unstable_default'
+ --> $DIR/generics-default-stability.rs:23:20
+ |
+LL | let _: Struct1<isize> = Struct1 { field: 1 };
+ | ^^^^^
+ |
+ = help: add `#![feature(unstable_default)]` to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_default'
+ --> $DIR/generics-default-stability.rs:27:20
+ |
+LL | let _: Struct1<usize> = STRUCT1;
+ | ^^^^^
+ |
+ = help: add `#![feature(unstable_default)]` to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_default'
+ --> $DIR/generics-default-stability.rs:28:20
+ |
+LL | let _: Struct1<isize> = Struct1 { field: 0 };
+ | ^^^^^
+ |
+ = help: add `#![feature(unstable_default)]` to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_default'
+ --> $DIR/generics-default-stability.rs:57:27
+ |
+LL | let _: Struct3<isize, usize> = STRUCT3;
+ | ^^^^^
+ |
+ = help: add `#![feature(unstable_default)]` to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_default'
+ --> $DIR/generics-default-stability.rs:59:27
+ |
+LL | let _: Struct3<isize, isize> = Struct3 { field1: 0, field2: 0 };
+ | ^^^^^
+ |
+ = help: add `#![feature(unstable_default)]` to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_default'
+ --> $DIR/generics-default-stability.rs:60:27
+ |
+LL | let _: Struct3<usize, usize> = Struct3 { field1: 0, field2: 0 };
+ | ^^^^^
+ |
+ = help: add `#![feature(unstable_default)]` to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_default'
+ --> $DIR/generics-default-stability.rs:84:20
+ |
+LL | let _: Struct5<isize> = Struct5 { field: 1 };
+ | ^^^^^
+ |
+ = help: add `#![feature(unstable_default)]` to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_default'
+ --> $DIR/generics-default-stability.rs:90:20
+ |
+LL | let _: Struct5<usize> = STRUCT5;
+ | ^^^^^
+ |
+ = help: add `#![feature(unstable_default)]` to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_default'
+ --> $DIR/generics-default-stability.rs:92:20
+ |
+LL | let _: Struct5<isize> = Struct5 { field: 0 };
+ | ^^^^^
+ |
+ = help: add `#![feature(unstable_default)]` to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_default'
+ --> $DIR/generics-default-stability.rs:100:19
+ |
+LL | let _: Alias1<isize> = Alias1::Some(1);
+ | ^^^^^
+ |
+ = help: add `#![feature(unstable_default)]` to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_default'
+ --> $DIR/generics-default-stability.rs:104:19
+ |
+LL | let _: Alias1<usize> = ALIAS1;
+ | ^^^^^
+ |
+ = help: add `#![feature(unstable_default)]` to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_default'
+ --> $DIR/generics-default-stability.rs:105:19
+ |
+LL | let _: Alias1<isize> = Alias1::Some(0);
+ | ^^^^^
+ |
+ = help: add `#![feature(unstable_default)]` to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_default'
+ --> $DIR/generics-default-stability.rs:133:26
+ |
+LL | let _: Alias3<isize, usize> = ALIAS3;
+ | ^^^^^
+ |
+ = help: add `#![feature(unstable_default)]` to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_default'
+ --> $DIR/generics-default-stability.rs:135:26
+ |
+LL | let _: Alias3<isize, isize> = Alias3::Ok(0);
+ | ^^^^^
+ |
+ = help: add `#![feature(unstable_default)]` to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_default'
+ --> $DIR/generics-default-stability.rs:136:26
+ |
+LL | let _: Alias3<usize, usize> = Alias3::Ok(0);
+ | ^^^^^
+ |
+ = help: add `#![feature(unstable_default)]` to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_default'
+ --> $DIR/generics-default-stability.rs:158:19
+ |
+LL | let _: Alias5<isize> = Alias5::Some(1);
+ | ^^^^^
+ |
+ = help: add `#![feature(unstable_default)]` to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_default'
+ --> $DIR/generics-default-stability.rs:163:19
+ |
+LL | let _: Alias5<usize> = ALIAS5;
+ | ^^^^^
+ |
+ = help: add `#![feature(unstable_default)]` to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_default'
+ --> $DIR/generics-default-stability.rs:165:19
+ |
+LL | let _: Alias5<isize> = Alias5::Some(0);
+ | ^^^^^
+ |
+ = help: add `#![feature(unstable_default)]` to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_default'
+ --> $DIR/generics-default-stability.rs:172:18
+ |
+LL | let _: Enum1<isize> = Enum1::Some(1);
+ | ^^^^^
+ |
+ = help: add `#![feature(unstable_default)]` to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_default'
+ --> $DIR/generics-default-stability.rs:176:18
+ |
+LL | let _: Enum1<usize> = ENUM1;
+ | ^^^^^
+ |
+ = help: add `#![feature(unstable_default)]` to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_default'
+ --> $DIR/generics-default-stability.rs:177:18
+ |
+LL | let _: Enum1<isize> = Enum1::Some(0);
+ | ^^^^^
+ |
+ = help: add `#![feature(unstable_default)]` to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_default'
+ --> $DIR/generics-default-stability.rs:205:25
+ |
+LL | let _: Enum3<isize, usize> = ENUM3;
+ | ^^^^^
+ |
+ = help: add `#![feature(unstable_default)]` to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_default'
+ --> $DIR/generics-default-stability.rs:207:25
+ |
+LL | let _: Enum3<isize, isize> = Enum3::Ok(0);
+ | ^^^^^
+ |
+ = help: add `#![feature(unstable_default)]` to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_default'
+ --> $DIR/generics-default-stability.rs:208:25
+ |
+LL | let _: Enum3<usize, usize> = Enum3::Ok(0);
+ | ^^^^^
+ |
+ = help: add `#![feature(unstable_default)]` to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_default'
+ --> $DIR/generics-default-stability.rs:230:18
+ |
+LL | let _: Enum5<isize> = Enum5::Some(1);
+ | ^^^^^
+ |
+ = help: add `#![feature(unstable_default)]` to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_default'
+ --> $DIR/generics-default-stability.rs:235:18
+ |
+LL | let _: Enum5<usize> = ENUM5;
+ | ^^^^^
+ |
+ = help: add `#![feature(unstable_default)]` to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_default'
+ --> $DIR/generics-default-stability.rs:237:18
+ |
+LL | let _: Enum5<isize> = Enum5::Some(0);
+ | ^^^^^
+ |
+ = help: add `#![feature(unstable_default)]` to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'box_alloc_param'
+ --> $DIR/generics-default-stability.rs:244:24
+ |
+LL | let _: Box1<isize, System> = Box1::new(1);
+ | ^^^^^^
+ |
+ = help: add `#![feature(box_alloc_param)]` to the crate attributes to enable
+
+warning: use of deprecated field `unstable_generic_param::Struct4::field`: test
+ --> $DIR/generics-default-stability.rs:71:39
+ |
+LL | let _: Struct4<isize> = Struct4 { field: 1 };
+ | ^^^^^^^^
+
+warning: use of deprecated field `unstable_generic_param::Struct4::field`: test
+ --> $DIR/generics-default-stability.rs:78:39
+ |
+LL | let _: Struct4<isize> = Struct4 { field: 0 };
+ | ^^^^^^^^
+
+warning: use of deprecated field `unstable_generic_param::Struct5::field`: test
+ --> $DIR/generics-default-stability.rs:84:39
+ |
+LL | let _: Struct5<isize> = Struct5 { field: 1 };
+ | ^^^^^^^^
+
+warning: use of deprecated field `unstable_generic_param::Struct5::field`: test
+ --> $DIR/generics-default-stability.rs:92:39
+ |
+LL | let _: Struct5<isize> = Struct5 { field: 0 };
+ | ^^^^^^^^
+
+error: aborting due to 28 previous errors; 40 warnings emitted
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/stability-attribute/issue-28075.rs b/src/test/ui/stability-attribute/issue-28075.rs
new file mode 100644
index 000000000..6b4ea46f3
--- /dev/null
+++ b/src/test/ui/stability-attribute/issue-28075.rs
@@ -0,0 +1,13 @@
+// Unstable entities should be caught in import lists
+
+// aux-build:lint-stability.rs
+
+#![allow(warnings)]
+
+extern crate lint_stability;
+
+use lint_stability::{unstable, deprecated};
+//~^ ERROR use of unstable library feature 'unstable_test_feature'
+
+fn main() {
+}
diff --git a/src/test/ui/stability-attribute/issue-28075.stderr b/src/test/ui/stability-attribute/issue-28075.stderr
new file mode 100644
index 000000000..7e53bb544
--- /dev/null
+++ b/src/test/ui/stability-attribute/issue-28075.stderr
@@ -0,0 +1,11 @@
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/issue-28075.rs:9:22
+ |
+LL | use lint_stability::{unstable, deprecated};
+ | ^^^^^^^^
+ |
+ = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/stability-attribute/issue-28388-3.rs b/src/test/ui/stability-attribute/issue-28388-3.rs
new file mode 100644
index 000000000..7ba993501
--- /dev/null
+++ b/src/test/ui/stability-attribute/issue-28388-3.rs
@@ -0,0 +1,11 @@
+// Prefix in imports with empty braces should be resolved and checked privacy, stability, etc.
+
+// aux-build:lint-stability.rs
+
+extern crate lint_stability;
+
+use lint_stability::UnstableEnum::{};
+//~^ ERROR use of unstable library feature 'unstable_test_feature'
+use lint_stability::StableEnum::{}; // OK
+
+fn main() {}
diff --git a/src/test/ui/stability-attribute/issue-28388-3.stderr b/src/test/ui/stability-attribute/issue-28388-3.stderr
new file mode 100644
index 000000000..d2e46683b
--- /dev/null
+++ b/src/test/ui/stability-attribute/issue-28388-3.stderr
@@ -0,0 +1,11 @@
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/issue-28388-3.rs:7:5
+ |
+LL | use lint_stability::UnstableEnum::{};
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/stability-attribute/issue-99286-stable-intrinsics.rs b/src/test/ui/stability-attribute/issue-99286-stable-intrinsics.rs
new file mode 100644
index 000000000..b9eee9922
--- /dev/null
+++ b/src/test/ui/stability-attribute/issue-99286-stable-intrinsics.rs
@@ -0,0 +1,17 @@
+// check-pass
+//
+// Regression test for issue #99286
+// Tests that stabilized intrinsics are accessible
+// through 'std::intrinsics', even though the module
+// is unstable.
+
+#![allow(unused_imports)]
+#![allow(deprecated)]
+
+use std::intrinsics::drop_in_place as _;
+use std::intrinsics::copy_nonoverlapping as _;
+use std::intrinsics::copy as _;
+use std::intrinsics::write_bytes as _;
+use std::intrinsics::{drop_in_place, copy_nonoverlapping, copy, write_bytes};
+
+fn main() {}
diff --git a/src/test/ui/stability-attribute/missing-const-stability.rs b/src/test/ui/stability-attribute/missing-const-stability.rs
new file mode 100644
index 000000000..d89886af3
--- /dev/null
+++ b/src/test/ui/stability-attribute/missing-const-stability.rs
@@ -0,0 +1,32 @@
+#![feature(staged_api)]
+#![feature(const_trait_impl)]
+#![stable(feature = "stable", since = "1.0.0")]
+
+#[stable(feature = "stable", since = "1.0.0")]
+pub const fn foo() {} //~ ERROR function has missing const stability attribute
+
+#[unstable(feature = "unstable", issue = "none")]
+pub const fn bar() {} // ok because function is unstable
+
+#[stable(feature = "stable", since = "1.0.0")]
+pub struct Foo;
+impl Foo {
+ #[stable(feature = "stable", since = "1.0.0")]
+ pub const fn foo() {} //~ ERROR associated function has missing const stability attribute
+
+ #[unstable(feature = "unstable", issue = "none")]
+ pub const fn bar() {} // ok because function is unstable
+}
+
+#[stable(feature = "stable", since = "1.0.0")]
+pub trait Bar {
+ #[stable(feature = "stable", since = "1.0.0")]
+ fn fun();
+}
+#[stable(feature = "stable", since = "1.0.0")]
+impl const Bar for Foo {
+ //~^ ERROR implementation has missing const stability attribute
+ fn fun() {}
+}
+
+fn main() {}
diff --git a/src/test/ui/stability-attribute/missing-const-stability.stderr b/src/test/ui/stability-attribute/missing-const-stability.stderr
new file mode 100644
index 000000000..10978728f
--- /dev/null
+++ b/src/test/ui/stability-attribute/missing-const-stability.stderr
@@ -0,0 +1,23 @@
+error: function has missing const stability attribute
+ --> $DIR/missing-const-stability.rs:6:1
+ |
+LL | pub const fn foo() {}
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: implementation has missing const stability attribute
+ --> $DIR/missing-const-stability.rs:27:1
+ |
+LL | / impl const Bar for Foo {
+LL | |
+LL | | fn fun() {}
+LL | | }
+ | |_^
+
+error: associated function has missing const stability attribute
+ --> $DIR/missing-const-stability.rs:15:5
+ |
+LL | pub const fn foo() {}
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/stability-attribute/missing-stability-attr-at-top-level.rs b/src/test/ui/stability-attribute/missing-stability-attr-at-top-level.rs
new file mode 100644
index 000000000..38faa2469
--- /dev/null
+++ b/src/test/ui/stability-attribute/missing-stability-attr-at-top-level.rs
@@ -0,0 +1,4 @@
+#![feature(staged_api)]
+//~^ ERROR module has missing stability attribute
+
+fn main() {}
diff --git a/src/test/ui/stability-attribute/missing-stability-attr-at-top-level.stderr b/src/test/ui/stability-attribute/missing-stability-attr-at-top-level.stderr
new file mode 100644
index 000000000..c7ade234d
--- /dev/null
+++ b/src/test/ui/stability-attribute/missing-stability-attr-at-top-level.stderr
@@ -0,0 +1,11 @@
+error: module has missing stability attribute
+ --> $DIR/missing-stability-attr-at-top-level.rs:1:1
+ |
+LL | / #![feature(staged_api)]
+LL | |
+LL | |
+LL | | fn main() {}
+ | |____________^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/stability-attribute/stability-attribute-implies-missing.rs b/src/test/ui/stability-attribute/stability-attribute-implies-missing.rs
new file mode 100644
index 000000000..613878536
--- /dev/null
+++ b/src/test/ui/stability-attribute/stability-attribute-implies-missing.rs
@@ -0,0 +1,10 @@
+#![feature(staged_api)]
+#![stable(feature = "stability_attribute_implies", since = "1.0.0")]
+
+// Tests that `implied_by = "bar"` results in an error being emitted if `bar` does not exist.
+
+#[unstable(feature = "foobar", issue = "1", implied_by = "bar")]
+//~^ ERROR feature `bar` implying `foobar` does not exist
+pub fn foobar() {}
+
+fn main() {}
diff --git a/src/test/ui/stability-attribute/stability-attribute-implies-missing.stderr b/src/test/ui/stability-attribute/stability-attribute-implies-missing.stderr
new file mode 100644
index 000000000..ff1856f17
--- /dev/null
+++ b/src/test/ui/stability-attribute/stability-attribute-implies-missing.stderr
@@ -0,0 +1,8 @@
+error: feature `bar` implying `foobar` does not exist
+ --> $DIR/stability-attribute-implies-missing.rs:6:1
+ |
+LL | #[unstable(feature = "foobar", issue = "1", implied_by = "bar")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/stability-attribute/stability-attribute-implies-no-feature.rs b/src/test/ui/stability-attribute/stability-attribute-implies-no-feature.rs
new file mode 100644
index 000000000..947f9f73e
--- /dev/null
+++ b/src/test/ui/stability-attribute/stability-attribute-implies-no-feature.rs
@@ -0,0 +1,13 @@
+// aux-build:stability-attribute-implies.rs
+
+// Tests that despite the `foobar` feature being implied by now-stable feature `foo`, if `foobar`
+// isn't allowed in this crate then an error will be emitted.
+
+extern crate stability_attribute_implies;
+use stability_attribute_implies::{foo, foobar};
+//~^ ERROR use of unstable library feature 'foobar'
+
+fn main() {
+ foo(); // no error - stable
+ foobar(); //~ ERROR use of unstable library feature 'foobar'
+}
diff --git a/src/test/ui/stability-attribute/stability-attribute-implies-no-feature.stderr b/src/test/ui/stability-attribute/stability-attribute-implies-no-feature.stderr
new file mode 100644
index 000000000..c2331f676
--- /dev/null
+++ b/src/test/ui/stability-attribute/stability-attribute-implies-no-feature.stderr
@@ -0,0 +1,21 @@
+error[E0658]: use of unstable library feature 'foobar'
+ --> $DIR/stability-attribute-implies-no-feature.rs:7:40
+ |
+LL | use stability_attribute_implies::{foo, foobar};
+ | ^^^^^^
+ |
+ = note: see issue #1 <https://github.com/rust-lang/rust/issues/1> for more information
+ = help: add `#![feature(foobar)]` to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'foobar'
+ --> $DIR/stability-attribute-implies-no-feature.rs:12:5
+ |
+LL | foobar();
+ | ^^^^^^
+ |
+ = note: see issue #1 <https://github.com/rust-lang/rust/issues/1> for more information
+ = help: add `#![feature(foobar)]` to the crate attributes to enable
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/stability-attribute/stability-attribute-implies-using-stable.rs b/src/test/ui/stability-attribute/stability-attribute-implies-using-stable.rs
new file mode 100644
index 000000000..1a2d8e271
--- /dev/null
+++ b/src/test/ui/stability-attribute/stability-attribute-implies-using-stable.rs
@@ -0,0 +1,15 @@
+// aux-build:stability-attribute-implies.rs
+#![deny(stable_features)]
+#![feature(foo)]
+//~^ ERROR the feature `foo` has been partially stabilized since 1.62.0 and is succeeded by the feature `foobar`
+
+// Tests that the use of `implied_by` in the `#[unstable]` attribute results in a diagnostic
+// mentioning partial stabilization, and that given the implied unstable feature is unused (there
+// is no `foobar` call), that the compiler suggests removing the flag.
+
+extern crate stability_attribute_implies;
+use stability_attribute_implies::foo;
+
+fn main() {
+ foo();
+}
diff --git a/src/test/ui/stability-attribute/stability-attribute-implies-using-stable.stderr b/src/test/ui/stability-attribute/stability-attribute-implies-using-stable.stderr
new file mode 100644
index 000000000..c9b3f07cc
--- /dev/null
+++ b/src/test/ui/stability-attribute/stability-attribute-implies-using-stable.stderr
@@ -0,0 +1,22 @@
+error: the feature `foo` has been partially stabilized since 1.62.0 and is succeeded by the feature `foobar`
+ --> $DIR/stability-attribute-implies-using-stable.rs:3:12
+ |
+LL | #![feature(foo)]
+ | ^^^
+ |
+note: the lint level is defined here
+ --> $DIR/stability-attribute-implies-using-stable.rs:2:9
+ |
+LL | #![deny(stable_features)]
+ | ^^^^^^^^^^^^^^^
+help: if you are using features which are still unstable, change to using `foobar`
+ |
+LL | #![feature(foobar)]
+ | ~~~~~~
+help: if you are using features which are now stable, remove this line
+ |
+LL - #![feature(foo)]
+ |
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/stability-attribute/stability-attribute-implies-using-unstable.rs b/src/test/ui/stability-attribute/stability-attribute-implies-using-unstable.rs
new file mode 100644
index 000000000..3c73c5abf
--- /dev/null
+++ b/src/test/ui/stability-attribute/stability-attribute-implies-using-unstable.rs
@@ -0,0 +1,17 @@
+// aux-build:stability-attribute-implies.rs
+#![deny(stable_features)]
+#![feature(foo)]
+//~^ ERROR the feature `foo` has been partially stabilized since 1.62.0 and is succeeded by the feature `foobar`
+
+// Tests that the use of `implied_by` in the `#[unstable]` attribute results in a diagnostic
+// mentioning partial stabilization and that given the implied unstable feature is used (there is a
+// `foobar` call), that the compiler suggests changing to that feature and doesn't error about its
+// use.
+
+extern crate stability_attribute_implies;
+use stability_attribute_implies::{foo, foobar};
+
+fn main() {
+ foo();
+ foobar(); // no error!
+}
diff --git a/src/test/ui/stability-attribute/stability-attribute-implies-using-unstable.stderr b/src/test/ui/stability-attribute/stability-attribute-implies-using-unstable.stderr
new file mode 100644
index 000000000..9a5c7ef5a
--- /dev/null
+++ b/src/test/ui/stability-attribute/stability-attribute-implies-using-unstable.stderr
@@ -0,0 +1,22 @@
+error: the feature `foo` has been partially stabilized since 1.62.0 and is succeeded by the feature `foobar`
+ --> $DIR/stability-attribute-implies-using-unstable.rs:3:12
+ |
+LL | #![feature(foo)]
+ | ^^^
+ |
+note: the lint level is defined here
+ --> $DIR/stability-attribute-implies-using-unstable.rs:2:9
+ |
+LL | #![deny(stable_features)]
+ | ^^^^^^^^^^^^^^^
+help: if you are using features which are still unstable, change to using `foobar`
+ |
+LL | #![feature(foobar)]
+ | ~~~~~~
+help: if you are using features which are now stable, remove this line
+ |
+LL - #![feature(foo)]
+ |
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/stability-attribute/stability-attribute-issue-43027.rs b/src/test/ui/stability-attribute/stability-attribute-issue-43027.rs
new file mode 100644
index 000000000..3f4fdfd01
--- /dev/null
+++ b/src/test/ui/stability-attribute/stability-attribute-issue-43027.rs
@@ -0,0 +1,15 @@
+// check-pass
+#![feature(staged_api)]
+#![stable(feature = "test", since = "0")]
+
+#[stable(feature = "test", since = "0")]
+pub struct A<T>(pub T);
+
+#[stable(feature = "test", since = "0")]
+pub struct B<T>(#[stable(feature = "test", since = "0")] pub T);
+
+fn main() {
+ // Make sure the field is used to fill the stability cache
+ A(0).0;
+ B(0).0;
+}
diff --git a/src/test/ui/stability-attribute/stability-attribute-issue.rs b/src/test/ui/stability-attribute/stability-attribute-issue.rs
new file mode 100644
index 000000000..cda1aff13
--- /dev/null
+++ b/src/test/ui/stability-attribute/stability-attribute-issue.rs
@@ -0,0 +1,12 @@
+// aux-build:stability_attribute_issue.rs
+#![deny(deprecated)]
+
+extern crate stability_attribute_issue;
+use stability_attribute_issue::*;
+
+fn main() {
+ unstable();
+ //~^ ERROR use of unstable library feature 'unstable_test_feature'
+ unstable_msg();
+ //~^ ERROR use of unstable library feature 'unstable_test_feature': message
+}
diff --git a/src/test/ui/stability-attribute/stability-attribute-issue.stderr b/src/test/ui/stability-attribute/stability-attribute-issue.stderr
new file mode 100644
index 000000000..df4aec7e5
--- /dev/null
+++ b/src/test/ui/stability-attribute/stability-attribute-issue.stderr
@@ -0,0 +1,21 @@
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/stability-attribute-issue.rs:8:5
+ |
+LL | unstable();
+ | ^^^^^^^^
+ |
+ = note: see issue #1 <https://github.com/rust-lang/rust/issues/1> for more information
+ = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature': message
+ --> $DIR/stability-attribute-issue.rs:10:5
+ |
+LL | unstable_msg();
+ | ^^^^^^^^^^^^
+ |
+ = note: see issue #2 <https://github.com/rust-lang/rust/issues/2> for more information
+ = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.rs b/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.rs
new file mode 100644
index 000000000..f61acc8aa
--- /dev/null
+++ b/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.rs
@@ -0,0 +1,5 @@
+// compile-flags:-Zforce-unstable-if-unmarked
+
+#[unstable()] //~ ERROR: stability attributes may not be used
+#[stable()] //~ ERROR: stability attributes may not be used
+fn main() {}
diff --git a/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.stderr b/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.stderr
new file mode 100644
index 000000000..45d965ea0
--- /dev/null
+++ b/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.stderr
@@ -0,0 +1,15 @@
+error[E0734]: stability attributes may not be used outside of the standard library
+ --> $DIR/stability-attribute-non-staged-force-unstable.rs:3:1
+ |
+LL | #[unstable()]
+ | ^^^^^^^^^^^^^
+
+error[E0734]: stability attributes may not be used outside of the standard library
+ --> $DIR/stability-attribute-non-staged-force-unstable.rs:4:1
+ |
+LL | #[stable()]
+ | ^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0734`.
diff --git a/src/test/ui/stability-attribute/stability-attribute-non-staged.rs b/src/test/ui/stability-attribute/stability-attribute-non-staged.rs
new file mode 100644
index 000000000..4015f2f97
--- /dev/null
+++ b/src/test/ui/stability-attribute/stability-attribute-non-staged.rs
@@ -0,0 +1,3 @@
+#[unstable()] //~ ERROR: stability attributes may not be used
+#[stable()] //~ ERROR: stability attributes may not be used
+fn main() {}
diff --git a/src/test/ui/stability-attribute/stability-attribute-non-staged.stderr b/src/test/ui/stability-attribute/stability-attribute-non-staged.stderr
new file mode 100644
index 000000000..391f3c274
--- /dev/null
+++ b/src/test/ui/stability-attribute/stability-attribute-non-staged.stderr
@@ -0,0 +1,15 @@
+error[E0734]: stability attributes may not be used outside of the standard library
+ --> $DIR/stability-attribute-non-staged.rs:1:1
+ |
+LL | #[unstable()]
+ | ^^^^^^^^^^^^^
+
+error[E0734]: stability attributes may not be used outside of the standard library
+ --> $DIR/stability-attribute-non-staged.rs:2:1
+ |
+LL | #[stable()]
+ | ^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0734`.
diff --git a/src/test/ui/stability-attribute/stability-attribute-sanity-2.rs b/src/test/ui/stability-attribute/stability-attribute-sanity-2.rs
new file mode 100644
index 000000000..de3ea4eac
--- /dev/null
+++ b/src/test/ui/stability-attribute/stability-attribute-sanity-2.rs
@@ -0,0 +1,17 @@
+// More checks that stability attributes are used correctly
+
+#![feature(staged_api)]
+
+#![stable(feature = "stable_test_feature", since = "1.0.0")]
+
+#[stable(feature = "a", feature = "b", since = "1.0.0")] //~ ERROR multiple 'feature' items
+fn f1() { }
+
+#[stable(feature = "a", sinse = "1.0.0")] //~ ERROR unknown meta item 'sinse'
+fn f2() { }
+
+#[unstable(feature = "a", issue = "no")]
+//~^ ERROR `issue` must be a non-zero numeric string or "none"
+fn f3() { }
+
+fn main() { }
diff --git a/src/test/ui/stability-attribute/stability-attribute-sanity-2.stderr b/src/test/ui/stability-attribute/stability-attribute-sanity-2.stderr
new file mode 100644
index 000000000..8dbcc6c97
--- /dev/null
+++ b/src/test/ui/stability-attribute/stability-attribute-sanity-2.stderr
@@ -0,0 +1,24 @@
+error[E0538]: multiple 'feature' items
+ --> $DIR/stability-attribute-sanity-2.rs:7:25
+ |
+LL | #[stable(feature = "a", feature = "b", since = "1.0.0")]
+ | ^^^^^^^^^^^^^
+
+error[E0541]: unknown meta item 'sinse'
+ --> $DIR/stability-attribute-sanity-2.rs:10:25
+ |
+LL | #[stable(feature = "a", sinse = "1.0.0")]
+ | ^^^^^^^^^^^^^^^ expected one of `feature`, `since`
+
+error[E0545]: `issue` must be a non-zero numeric string or "none"
+ --> $DIR/stability-attribute-sanity-2.rs:13:27
+ |
+LL | #[unstable(feature = "a", issue = "no")]
+ | ^^^^^^^^----
+ | |
+ | invalid digit found in string
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0538, E0541, E0545.
+For more information about an error, try `rustc --explain E0538`.
diff --git a/src/test/ui/stability-attribute/stability-attribute-sanity-3.rs b/src/test/ui/stability-attribute/stability-attribute-sanity-3.rs
new file mode 100644
index 000000000..13ef3d3f5
--- /dev/null
+++ b/src/test/ui/stability-attribute/stability-attribute-sanity-3.rs
@@ -0,0 +1,12 @@
+// More checks that stability attributes are used correctly
+
+#![feature(staged_api)]
+
+#![stable(feature = "stable_test_feature", since = "1.0.0")]
+
+#[macro_export]
+macro_rules! mac { //~ ERROR macro has missing stability attribute
+ () => ()
+}
+
+fn main() { }
diff --git a/src/test/ui/stability-attribute/stability-attribute-sanity-3.stderr b/src/test/ui/stability-attribute/stability-attribute-sanity-3.stderr
new file mode 100644
index 000000000..b1c56ef22
--- /dev/null
+++ b/src/test/ui/stability-attribute/stability-attribute-sanity-3.stderr
@@ -0,0 +1,10 @@
+error: macro has missing stability attribute
+ --> $DIR/stability-attribute-sanity-3.rs:8:1
+ |
+LL | / macro_rules! mac {
+LL | | () => ()
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/stability-attribute/stability-attribute-sanity-4.rs b/src/test/ui/stability-attribute/stability-attribute-sanity-4.rs
new file mode 100644
index 000000000..64f996352
--- /dev/null
+++ b/src/test/ui/stability-attribute/stability-attribute-sanity-4.rs
@@ -0,0 +1,29 @@
+// Various checks that stability attributes are used correctly, per RFC 507
+
+#![feature(staged_api)]
+
+#![stable(feature = "rust1", since = "1.0.0")]
+
+mod bogus_attribute_types_2 {
+ #[unstable] //~ ERROR malformed `unstable` attribute
+ fn f1() { }
+
+ #[unstable = "b"] //~ ERROR malformed `unstable` attribute
+ fn f2() { }
+
+ #[stable] //~ ERROR malformed `stable` attribute
+ fn f3() { }
+
+ #[stable = "a"] //~ ERROR malformed `stable` attribute
+ fn f4() { }
+
+ #[stable(feature = "a", since = "b")]
+ #[deprecated] //~ ERROR missing 'since'
+ fn f5() { }
+
+ #[stable(feature = "a", since = "b")]
+ #[deprecated = "a"] //~ ERROR missing 'since'
+ fn f6() { }
+}
+
+fn main() { }
diff --git a/src/test/ui/stability-attribute/stability-attribute-sanity-4.stderr b/src/test/ui/stability-attribute/stability-attribute-sanity-4.stderr
new file mode 100644
index 000000000..a76f5be1e
--- /dev/null
+++ b/src/test/ui/stability-attribute/stability-attribute-sanity-4.stderr
@@ -0,0 +1,39 @@
+error: malformed `unstable` attribute input
+ --> $DIR/stability-attribute-sanity-4.rs:8:5
+ |
+LL | #[unstable]
+ | ^^^^^^^^^^^ help: must be of the form: `#[unstable(feature = "name", reason = "...", issue = "N")]`
+
+error: malformed `unstable` attribute input
+ --> $DIR/stability-attribute-sanity-4.rs:11:5
+ |
+LL | #[unstable = "b"]
+ | ^^^^^^^^^^^^^^^^^ help: must be of the form: `#[unstable(feature = "name", reason = "...", issue = "N")]`
+
+error: malformed `stable` attribute input
+ --> $DIR/stability-attribute-sanity-4.rs:14:5
+ |
+LL | #[stable]
+ | ^^^^^^^^^ help: must be of the form: `#[stable(feature = "name", since = "version")]`
+
+error: malformed `stable` attribute input
+ --> $DIR/stability-attribute-sanity-4.rs:17:5
+ |
+LL | #[stable = "a"]
+ | ^^^^^^^^^^^^^^^ help: must be of the form: `#[stable(feature = "name", since = "version")]`
+
+error[E0542]: missing 'since'
+ --> $DIR/stability-attribute-sanity-4.rs:21:5
+ |
+LL | #[deprecated]
+ | ^^^^^^^^^^^^^
+
+error[E0542]: missing 'since'
+ --> $DIR/stability-attribute-sanity-4.rs:25:5
+ |
+LL | #[deprecated = "a"]
+ | ^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0542`.
diff --git a/src/test/ui/stability-attribute/stability-attribute-sanity.rs b/src/test/ui/stability-attribute/stability-attribute-sanity.rs
new file mode 100644
index 000000000..cc30e6ab9
--- /dev/null
+++ b/src/test/ui/stability-attribute/stability-attribute-sanity.rs
@@ -0,0 +1,76 @@
+// Various checks that stability attributes are used correctly, per RFC 507
+
+#![feature(staged_api)]
+
+#![stable(feature = "rust1", since = "1.0.0")]
+
+mod bogus_attribute_types_1 {
+ #[stable(feature = "a", since = "b", reason)] //~ ERROR unknown meta item 'reason' [E0541]
+ fn f1() { }
+
+ #[stable(feature = "a", since)] //~ ERROR incorrect meta item [E0539]
+ fn f2() { }
+
+ #[stable(feature, since = "a")] //~ ERROR incorrect meta item [E0539]
+ fn f3() { }
+
+ #[stable(feature = "a", since(b))] //~ ERROR incorrect meta item [E0539]
+ fn f5() { }
+
+ #[stable(feature(b), since = "a")] //~ ERROR incorrect meta item [E0539]
+ fn f6() { }
+}
+
+mod missing_feature_names {
+ #[unstable(issue = "none")] //~ ERROR missing 'feature' [E0546]
+ fn f1() { }
+
+ #[unstable(feature = "b")] //~ ERROR missing 'issue' [E0547]
+ fn f2() { }
+
+ #[stable(since = "a")] //~ ERROR missing 'feature' [E0546]
+ fn f3() { }
+}
+
+mod missing_version {
+ #[stable(feature = "a")] //~ ERROR missing 'since' [E0542]
+ fn f1() { }
+
+ #[stable(feature = "a", since = "b")]
+ #[deprecated(note = "a")] //~ ERROR missing 'since' [E0542]
+ fn f2() { }
+
+ #[stable(feature = "a", since = "b")]
+ #[deprecated(since = "a")] //~ ERROR missing 'note' [E0543]
+ fn f3() { }
+}
+
+#[unstable(feature = "b", issue = "none")]
+#[stable(feature = "a", since = "b")] //~ ERROR multiple stability levels [E0544]
+fn multiple1() { }
+
+#[unstable(feature = "b", issue = "none")]
+#[unstable(feature = "b", issue = "none")] //~ ERROR multiple stability levels [E0544]
+fn multiple2() { }
+
+#[stable(feature = "a", since = "b")]
+#[stable(feature = "a", since = "b")] //~ ERROR multiple stability levels [E0544]
+fn multiple3() { }
+
+#[stable(feature = "a", since = "b")] //~ ERROR invalid stability version found
+#[deprecated(since = "b", note = "text")]
+#[deprecated(since = "b", note = "text")] //~ ERROR multiple `deprecated` attributes
+#[rustc_const_unstable(feature = "c", issue = "none")]
+#[rustc_const_unstable(feature = "d", issue = "none")] //~ ERROR multiple stability levels
+pub const fn multiple4() { }
+
+#[stable(feature = "a", since = "1.0.0")] //~ ERROR invalid deprecation version found
+//~^ ERROR feature `a` is declared stable since 1.0.0
+#[deprecated(since = "invalid", note = "text")]
+fn invalid_deprecation_version() {}
+
+#[deprecated(since = "a", note = "text")]
+fn deprecated_without_unstable_or_stable() { }
+//~^^ ERROR deprecated attribute must be paired with either stable or unstable attribute
+
+fn main() { }
diff --git a/src/test/ui/stability-attribute/stability-attribute-sanity.stderr b/src/test/ui/stability-attribute/stability-attribute-sanity.stderr
new file mode 100644
index 000000000..079230b2a
--- /dev/null
+++ b/src/test/ui/stability-attribute/stability-attribute-sanity.stderr
@@ -0,0 +1,136 @@
+error: multiple `deprecated` attributes
+ --> $DIR/stability-attribute-sanity.rs:62:1
+ |
+LL | #[deprecated(since = "b", note = "text")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
+ |
+note: attribute also specified here
+ --> $DIR/stability-attribute-sanity.rs:61:1
+ |
+LL | #[deprecated(since = "b", note = "text")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0541]: unknown meta item 'reason'
+ --> $DIR/stability-attribute-sanity.rs:8:42
+ |
+LL | #[stable(feature = "a", since = "b", reason)]
+ | ^^^^^^ expected one of `feature`, `since`
+
+error[E0539]: incorrect meta item
+ --> $DIR/stability-attribute-sanity.rs:11:29
+ |
+LL | #[stable(feature = "a", since)]
+ | ^^^^^
+
+error[E0539]: incorrect meta item
+ --> $DIR/stability-attribute-sanity.rs:14:14
+ |
+LL | #[stable(feature, since = "a")]
+ | ^^^^^^^
+
+error[E0539]: incorrect meta item
+ --> $DIR/stability-attribute-sanity.rs:17:29
+ |
+LL | #[stable(feature = "a", since(b))]
+ | ^^^^^^^^
+
+error[E0539]: incorrect meta item
+ --> $DIR/stability-attribute-sanity.rs:20:14
+ |
+LL | #[stable(feature(b), since = "a")]
+ | ^^^^^^^^^^
+
+error[E0546]: missing 'feature'
+ --> $DIR/stability-attribute-sanity.rs:25:5
+ |
+LL | #[unstable(issue = "none")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0547]: missing 'issue'
+ --> $DIR/stability-attribute-sanity.rs:28:5
+ |
+LL | #[unstable(feature = "b")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0546]: missing 'feature'
+ --> $DIR/stability-attribute-sanity.rs:31:5
+ |
+LL | #[stable(since = "a")]
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0542]: missing 'since'
+ --> $DIR/stability-attribute-sanity.rs:36:5
+ |
+LL | #[stable(feature = "a")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0542]: missing 'since'
+ --> $DIR/stability-attribute-sanity.rs:40:5
+ |
+LL | #[deprecated(note = "a")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0543]: missing 'note'
+ --> $DIR/stability-attribute-sanity.rs:44:5
+ |
+LL | #[deprecated(since = "a")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0544]: multiple stability levels
+ --> $DIR/stability-attribute-sanity.rs:49:1
+ |
+LL | #[stable(feature = "a", since = "b")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0544]: multiple stability levels
+ --> $DIR/stability-attribute-sanity.rs:53:1
+ |
+LL | #[unstable(feature = "b", issue = "none")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0544]: multiple stability levels
+ --> $DIR/stability-attribute-sanity.rs:57:1
+ |
+LL | #[stable(feature = "a", since = "b")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0544]: multiple stability levels
+ --> $DIR/stability-attribute-sanity.rs:64:1
+ |
+LL | #[rustc_const_unstable(feature = "d", issue = "none")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: invalid stability version found
+ --> $DIR/stability-attribute-sanity.rs:60:1
+ |
+LL | #[stable(feature = "a", since = "b")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid stability version
+...
+LL | pub const fn multiple4() { }
+ | ---------------------------- the stability attribute annotates this item
+
+error: invalid deprecation version found
+ --> $DIR/stability-attribute-sanity.rs:67:1
+ |
+LL | #[stable(feature = "a", since = "1.0.0")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid deprecation version
+...
+LL | fn invalid_deprecation_version() {}
+ | ----------------------------------- the stability attribute annotates this item
+
+error[E0549]: deprecated attribute must be paired with either stable or unstable attribute
+ --> $DIR/stability-attribute-sanity.rs:72:1
+ |
+LL | #[deprecated(since = "a", note = "text")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0711]: feature `a` is declared stable since 1.0.0, but was previously declared stable since b
+ --> $DIR/stability-attribute-sanity.rs:67:1
+ |
+LL | #[stable(feature = "a", since = "1.0.0")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 20 previous errors
+
+Some errors have detailed explanations: E0539, E0541, E0542, E0543, E0544, E0546, E0547, E0549.
+For more information about an error, try `rustc --explain E0539`.
diff --git a/src/test/ui/stability-attribute/stability-attribute-trait-impl.rs b/src/test/ui/stability-attribute/stability-attribute-trait-impl.rs
new file mode 100644
index 000000000..ce2726ffd
--- /dev/null
+++ b/src/test/ui/stability-attribute/stability-attribute-trait-impl.rs
@@ -0,0 +1,29 @@
+#![feature(staged_api)]
+//~^ ERROR module has missing stability attribute
+
+#[stable(feature = "a", since = "1")]
+struct StableType;
+
+#[unstable(feature = "b", issue = "none")]
+struct UnstableType;
+
+#[stable(feature = "c", since = "1")]
+trait StableTrait {}
+
+#[unstable(feature = "d", issue = "none")]
+trait UnstableTrait {}
+
+#[unstable(feature = "e", issue = "none")]
+impl UnstableTrait for UnstableType {}
+
+#[unstable(feature = "f", issue = "none")]
+impl StableTrait for UnstableType {}
+
+#[unstable(feature = "g", issue = "none")]
+impl UnstableTrait for StableType {}
+
+#[unstable(feature = "h", issue = "none")]
+//~^ ERROR an `#[unstable]` annotation here has no effect [ineffective_unstable_trait_impl]
+impl StableTrait for StableType {}
+
+fn main() {}
diff --git a/src/test/ui/stability-attribute/stability-attribute-trait-impl.stderr b/src/test/ui/stability-attribute/stability-attribute-trait-impl.stderr
new file mode 100644
index 000000000..310f02024
--- /dev/null
+++ b/src/test/ui/stability-attribute/stability-attribute-trait-impl.stderr
@@ -0,0 +1,23 @@
+error: an `#[unstable]` annotation here has no effect
+ --> $DIR/stability-attribute-trait-impl.rs:25:1
+ |
+LL | #[unstable(feature = "h", issue = "none")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: `#[deny(ineffective_unstable_trait_impl)]` on by default
+ = note: see issue #55436 <https://github.com/rust-lang/rust/issues/55436> for more information
+
+error: module has missing stability attribute
+ --> $DIR/stability-attribute-trait-impl.rs:1:1
+ |
+LL | / #![feature(staged_api)]
+LL | |
+LL | |
+LL | | #[stable(feature = "a", since = "1")]
+... |
+LL | |
+LL | | fn main() {}
+ | |____________^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/stability-attribute/stability-in-private-module.rs b/src/test/ui/stability-attribute/stability-in-private-module.rs
new file mode 100644
index 000000000..f12e9198b
--- /dev/null
+++ b/src/test/ui/stability-attribute/stability-in-private-module.rs
@@ -0,0 +1,4 @@
+fn main() {
+ let _ = std::thread::thread_info::current_thread();
+ //~^ERROR module `thread_info` is private
+}
diff --git a/src/test/ui/stability-attribute/stability-in-private-module.stderr b/src/test/ui/stability-attribute/stability-in-private-module.stderr
new file mode 100644
index 000000000..e64f2acbd
--- /dev/null
+++ b/src/test/ui/stability-attribute/stability-in-private-module.stderr
@@ -0,0 +1,15 @@
+error[E0603]: module `thread_info` is private
+ --> $DIR/stability-in-private-module.rs:2:26
+ |
+LL | let _ = std::thread::thread_info::current_thread();
+ | ^^^^^^^^^^^ private module
+ |
+note: the module `thread_info` is defined here
+ --> $SRC_DIR/std/src/thread/mod.rs:LL:COL
+ |
+LL | use crate::sys_common::thread_info;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0603`.
diff --git a/src/test/ui/stability-attribute/stable-in-unstable.rs b/src/test/ui/stability-attribute/stable-in-unstable.rs
new file mode 100644
index 000000000..272a1a972
--- /dev/null
+++ b/src/test/ui/stability-attribute/stable-in-unstable.rs
@@ -0,0 +1,46 @@
+// This test is meant to test that we can have a stable item in an unstable module, and that
+// calling that item through the unstable module is unstable, but that re-exporting it from another
+// crate in a stable module is fine.
+//
+// This is necessary to support moving items from `std` into `core` or `alloc` unstably while still
+// exporting the original stable interface in `std`, such as moving `Error` into `core`.
+//
+// aux-build:stable-in-unstable-core.rs
+// aux-build:stable-in-unstable-std.rs
+#![crate_type = "lib"]
+
+extern crate stable_in_unstable_core;
+extern crate stable_in_unstable_std;
+
+mod isolated1 {
+ use stable_in_unstable_core::new_unstable_module; //~ ERROR use of unstable library feature 'unstable_test_feature'
+ use stable_in_unstable_core::new_unstable_module::OldTrait; //~ ERROR use of unstable library feature 'unstable_test_feature'
+}
+
+mod isolated2 {
+ use stable_in_unstable_std::old_stable_module::OldTrait;
+
+ struct LocalType;
+
+ impl OldTrait for LocalType {}
+}
+
+mod isolated3 {
+ use stable_in_unstable_core::new_unstable_module::OldTrait; //~ ERROR use of unstable library feature 'unstable_test_feature'
+
+ struct LocalType;
+
+ impl OldTrait for LocalType {}
+}
+
+mod isolated4 {
+ struct LocalType;
+
+ impl stable_in_unstable_core::new_unstable_module::OldTrait for LocalType {} //~ ERROR use of unstable library feature 'unstable_test_feature'
+}
+
+mod isolated5 {
+ struct LocalType;
+
+ impl stable_in_unstable_std::old_stable_module::OldTrait for LocalType {}
+}
diff --git a/src/test/ui/stability-attribute/stable-in-unstable.stderr b/src/test/ui/stability-attribute/stable-in-unstable.stderr
new file mode 100644
index 000000000..e123d8358
--- /dev/null
+++ b/src/test/ui/stability-attribute/stable-in-unstable.stderr
@@ -0,0 +1,39 @@
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/stable-in-unstable.rs:16:9
+ |
+LL | use stable_in_unstable_core::new_unstable_module;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #1 <https://github.com/rust-lang/rust/issues/1> for more information
+ = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/stable-in-unstable.rs:17:9
+ |
+LL | use stable_in_unstable_core::new_unstable_module::OldTrait;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #1 <https://github.com/rust-lang/rust/issues/1> for more information
+ = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/stable-in-unstable.rs:29:9
+ |
+LL | use stable_in_unstable_core::new_unstable_module::OldTrait;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #1 <https://github.com/rust-lang/rust/issues/1> for more information
+ = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/stable-in-unstable.rs:39:10
+ |
+LL | impl stable_in_unstable_core::new_unstable_module::OldTrait for LocalType {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #1 <https://github.com/rust-lang/rust/issues/1> for more information
+ = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/stability-attribute/suggest-vec-allocator-api.rs b/src/test/ui/stability-attribute/suggest-vec-allocator-api.rs
new file mode 100644
index 000000000..fac52ab77
--- /dev/null
+++ b/src/test/ui/stability-attribute/suggest-vec-allocator-api.rs
@@ -0,0 +1,9 @@
+fn main() {
+ let _: Vec<u8, _> = vec![]; //~ ERROR use of unstable library feature 'allocator_api'
+ #[rustfmt::skip]
+ let _: Vec<
+ String,
+ _> = vec![]; //~ ERROR use of unstable library feature 'allocator_api'
+ let _ = Vec::<u16, _>::new(); //~ ERROR use of unstable library feature 'allocator_api'
+ let _boxed: Box<u32, _> = Box::new(10); //~ ERROR use of unstable library feature 'allocator_api'
+}
diff --git a/src/test/ui/stability-attribute/suggest-vec-allocator-api.stderr b/src/test/ui/stability-attribute/suggest-vec-allocator-api.stderr
new file mode 100644
index 000000000..41e5787b8
--- /dev/null
+++ b/src/test/ui/stability-attribute/suggest-vec-allocator-api.stderr
@@ -0,0 +1,49 @@
+error[E0658]: use of unstable library feature 'allocator_api'
+ --> $DIR/suggest-vec-allocator-api.rs:2:20
+ |
+LL | let _: Vec<u8, _> = vec![];
+ | ----^
+ | |
+ | help: consider wrapping the inner types in tuple: `(u8, _)`
+ |
+ = note: see issue #32838 <https://github.com/rust-lang/rust/issues/32838> for more information
+ = help: add `#![feature(allocator_api)]` to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'allocator_api'
+ --> $DIR/suggest-vec-allocator-api.rs:6:9
+ |
+LL | _> = vec![];
+ | ^
+ |
+ = note: see issue #32838 <https://github.com/rust-lang/rust/issues/32838> for more information
+ = help: add `#![feature(allocator_api)]` to the crate attributes to enable
+help: consider wrapping the inner types in tuple
+ |
+LL ~ let _: Vec<(
+LL + String,
+LL ~ _)> = vec![];
+ |
+
+error[E0658]: use of unstable library feature 'allocator_api'
+ --> $DIR/suggest-vec-allocator-api.rs:8:26
+ |
+LL | let _boxed: Box<u32, _> = Box::new(10);
+ | ^
+ |
+ = note: see issue #32838 <https://github.com/rust-lang/rust/issues/32838> for more information
+ = help: add `#![feature(allocator_api)]` to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'allocator_api'
+ --> $DIR/suggest-vec-allocator-api.rs:7:24
+ |
+LL | let _ = Vec::<u16, _>::new();
+ | -----^
+ | |
+ | help: consider wrapping the inner types in tuple: `(u16, _)`
+ |
+ = note: see issue #32838 <https://github.com/rust-lang/rust/issues/32838> for more information
+ = help: add `#![feature(allocator_api)]` to the crate attributes to enable
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0658`.