about summary refs log tree commit diff
path: root/src/test/ui
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-09-27 12:51:21 +0000
committerbors <bors@rust-lang.org>2020-09-27 12:51:21 +0000
commitd902752866cbbdb331e3cf28ff6bba86ab0f6c62 (patch)
tree94ffd454f33732663936012eda8cafa4a24b23e2 /src/test/ui
parentb8363295d555494bbaa119eba8b16a3057e6728c (diff)
parent98eab09cf4ee1a35290a2061ee0e7a19703923a8 (diff)
Auto merge of #77118 - exrook:stability-generic-parameters-2, r=varkor
 Stability annotations on generic parameters (take 2.5)

Rebase of #72314 + more tests

Implements rust-lang/wg-allocators#2.
Diffstat (limited to 'src/test/ui')
-rw-r--r--src/test/ui/stability-attribute/auxiliary/unstable_generic_param.rs229
-rw-r--r--src/test/ui/stability-attribute/generics-default-stability-where.rs12
-rw-r--r--src/test/ui/stability-attribute/generics-default-stability-where.stderr11
-rw-r--r--src/test/ui/stability-attribute/generics-default-stability.rs264
-rw-r--r--src/test/ui/stability-attribute/generics-default-stability.stderr493
5 files changed, 1009 insertions, 0 deletions
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 00000000000..231ab966558
--- /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,
+}
+
+#[rustc_deprecated(since = "1.1.0", reason = "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,
+}
+
+#[rustc_deprecated(since = "1.1.0", reason = "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),
+}
+
+#[rustc_deprecated(since = "1.1.0", reason = "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,
+}
+
+#[rustc_deprecated(since = "1.1.0", reason = "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>;
+
+#[rustc_deprecated(since = "1.1.0", reason = "test")]
+#[stable(feature = "stable_test_feature", since = "1.0.0")]
+pub type Alias4<T = usize> = Option<T>;
+
+#[rustc_deprecated(since = "1.1.0", reason = "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-where.rs b/src/test/ui/stability-attribute/generics-default-stability-where.rs
new file mode 100644
index 00000000000..3fd14e25d0e
--- /dev/null
+++ b/src/test/ui/stability-attribute/generics-default-stability-where.rs
@@ -0,0 +1,12 @@
+// ignore-tidy-linelength
+// 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 00000000000..19fa09f311b
--- /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:8: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 00000000000..d6f28e3e447
--- /dev/null
+++ b/src/test/ui/stability-attribute/generics-default-stability.rs
@@ -0,0 +1,264 @@
+// ignore-tidy-linelength
+// 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() {
+    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 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 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 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 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 00000000000..a5df70bb8b3
--- /dev/null
+++ b/src/test/ui/stability-attribute/generics-default-stability.stderr
@@ -0,0 +1,493 @@
+error[E0658]: use of unstable library feature 'unstable_default'
+  --> $DIR/generics-default-stability.rs:17: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.rs:21: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.rs:25:13
+   |
+LL | impl Trait2<usize> for S {
+   |             ^^^^^
+   |
+   = help: add `#![feature(unstable_default)]` to the crate attributes to enable
+
+warning: use of deprecated struct `unstable_generic_param::Struct4`: test
+  --> $DIR/generics-default-stability.rs:84: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:84:12
+   |
+LL |     let _: Struct4<isize> = Struct4 { field: 1 };
+   |            ^^^^^^^^^^^^^^
+
+warning: use of deprecated struct `unstable_generic_param::Struct4`: test
+  --> $DIR/generics-default-stability.rs:89:12
+   |
+LL |     let _: Struct4 = STRUCT4;
+   |            ^^^^^^^
+
+warning: use of deprecated struct `unstable_generic_param::Struct4`: test
+  --> $DIR/generics-default-stability.rs:90:12
+   |
+LL |     let _: Struct4<usize> = STRUCT4;
+   |            ^^^^^^^^^^^^^^
+
+warning: use of deprecated struct `unstable_generic_param::Struct4`: test
+  --> $DIR/generics-default-stability.rs:91:29
+   |
+LL |     let _: Struct4<isize> = Struct4 { field: 0 };
+   |                             ^^^^^^^
+
+warning: use of deprecated struct `unstable_generic_param::Struct4`: test
+  --> $DIR/generics-default-stability.rs:91:12
+   |
+LL |     let _: Struct4<isize> = Struct4 { field: 0 };
+   |            ^^^^^^^^^^^^^^
+
+warning: use of deprecated struct `unstable_generic_param::Struct5`: test
+  --> $DIR/generics-default-stability.rs:97:29
+   |
+LL |     let _: Struct5<isize> = Struct5 { field: 1 };
+   |                             ^^^^^^^
+
+warning: use of deprecated struct `unstable_generic_param::Struct5`: test
+  --> $DIR/generics-default-stability.rs:97:12
+   |
+LL |     let _: Struct5<isize> = Struct5 { field: 1 };
+   |            ^^^^^^^^^^^^^^
+
+warning: use of deprecated struct `unstable_generic_param::Struct5`: test
+  --> $DIR/generics-default-stability.rs:102:12
+   |
+LL |     let _: Struct5 = STRUCT5;
+   |            ^^^^^^^
+
+warning: use of deprecated struct `unstable_generic_param::Struct5`: test
+  --> $DIR/generics-default-stability.rs:103:12
+   |
+LL |     let _: Struct5<usize> = STRUCT5;
+   |            ^^^^^^^^^^^^^^
+
+warning: use of deprecated struct `unstable_generic_param::Struct5`: test
+  --> $DIR/generics-default-stability.rs:105:29
+   |
+LL |     let _: Struct5<isize> = Struct5 { field: 0 };
+   |                             ^^^^^^^
+
+warning: use of deprecated struct `unstable_generic_param::Struct5`: test
+  --> $DIR/generics-default-stability.rs:105:12
+   |
+LL |     let _: Struct5<isize> = Struct5 { field: 0 };
+   |            ^^^^^^^^^^^^^^
+
+warning: use of deprecated type alias `unstable_generic_param::Alias4`: test
+  --> $DIR/generics-default-stability.rs:160:28
+   |
+LL |     let _: Alias4<isize> = Alias4::Some(1);
+   |                            ^^^^^^^^^^^^
+
+warning: use of deprecated type alias `unstable_generic_param::Alias4`: test
+  --> $DIR/generics-default-stability.rs:160:12
+   |
+LL |     let _: Alias4<isize> = Alias4::Some(1);
+   |            ^^^^^^^^^^^^^
+
+warning: use of deprecated type alias `unstable_generic_param::Alias4`: test
+  --> $DIR/generics-default-stability.rs:164:12
+   |
+LL |     let _: Alias4 = ALIAS4;
+   |            ^^^^^^
+
+warning: use of deprecated type alias `unstable_generic_param::Alias4`: test
+  --> $DIR/generics-default-stability.rs:165:12
+   |
+LL |     let _: Alias4<usize> = ALIAS4;
+   |            ^^^^^^^^^^^^^
+
+warning: use of deprecated type alias `unstable_generic_param::Alias4`: test
+  --> $DIR/generics-default-stability.rs:166:28
+   |
+LL |     let _: Alias4<isize> = Alias4::Some(0);
+   |                            ^^^^^^^^^^^^
+
+warning: use of deprecated type alias `unstable_generic_param::Alias4`: test
+  --> $DIR/generics-default-stability.rs:166:12
+   |
+LL |     let _: Alias4<isize> = Alias4::Some(0);
+   |            ^^^^^^^^^^^^^
+
+warning: use of deprecated type alias `unstable_generic_param::Alias5`: test
+  --> $DIR/generics-default-stability.rs:171:28
+   |
+LL |     let _: Alias5<isize> = Alias5::Some(1);
+   |                            ^^^^^^^^^^^^
+
+warning: use of deprecated type alias `unstable_generic_param::Alias5`: test
+  --> $DIR/generics-default-stability.rs:171:12
+   |
+LL |     let _: Alias5<isize> = Alias5::Some(1);
+   |            ^^^^^^^^^^^^^
+
+warning: use of deprecated type alias `unstable_generic_param::Alias5`: test
+  --> $DIR/generics-default-stability.rs:175:12
+   |
+LL |     let _: Alias5 = ALIAS5;
+   |            ^^^^^^
+
+warning: use of deprecated type alias `unstable_generic_param::Alias5`: test
+  --> $DIR/generics-default-stability.rs:176:12
+   |
+LL |     let _: Alias5<usize> = ALIAS5;
+   |            ^^^^^^^^^^^^^
+
+warning: use of deprecated type alias `unstable_generic_param::Alias5`: test
+  --> $DIR/generics-default-stability.rs:178:28
+   |
+LL |     let _: Alias5<isize> = Alias5::Some(0);
+   |                            ^^^^^^^^^^^^
+
+warning: use of deprecated type alias `unstable_generic_param::Alias5`: test
+  --> $DIR/generics-default-stability.rs:178:12
+   |
+LL |     let _: Alias5<isize> = Alias5::Some(0);
+   |            ^^^^^^^^^^^^^
+
+warning: use of deprecated variant `unstable_generic_param::Enum4::Some`: test
+  --> $DIR/generics-default-stability.rs:232:27
+   |
+LL |     let _: Enum4<isize> = Enum4::Some(1);
+   |                           ^^^^^^^^^^^
+
+warning: use of deprecated enum `unstable_generic_param::Enum4`: test
+  --> $DIR/generics-default-stability.rs:232:12
+   |
+LL |     let _: Enum4<isize> = Enum4::Some(1);
+   |            ^^^^^^^^^^^^
+
+warning: use of deprecated enum `unstable_generic_param::Enum4`: test
+  --> $DIR/generics-default-stability.rs:236:12
+   |
+LL |     let _: Enum4 = ENUM4;
+   |            ^^^^^
+
+warning: use of deprecated enum `unstable_generic_param::Enum4`: test
+  --> $DIR/generics-default-stability.rs:237:12
+   |
+LL |     let _: Enum4<usize> = ENUM4;
+   |            ^^^^^^^^^^^^
+
+warning: use of deprecated variant `unstable_generic_param::Enum4::Some`: test
+  --> $DIR/generics-default-stability.rs:238:27
+   |
+LL |     let _: Enum4<isize> = Enum4::Some(0);
+   |                           ^^^^^^^^^^^
+
+warning: use of deprecated enum `unstable_generic_param::Enum4`: test
+  --> $DIR/generics-default-stability.rs:238:12
+   |
+LL |     let _: Enum4<isize> = Enum4::Some(0);
+   |            ^^^^^^^^^^^^
+
+warning: use of deprecated variant `unstable_generic_param::Enum5::Some`: test
+  --> $DIR/generics-default-stability.rs:243:27
+   |
+LL |     let _: Enum5<isize> = Enum5::Some(1);
+   |                           ^^^^^^^^^^^
+
+warning: use of deprecated enum `unstable_generic_param::Enum5`: test
+  --> $DIR/generics-default-stability.rs:243:12
+   |
+LL |     let _: Enum5<isize> = Enum5::Some(1);
+   |            ^^^^^^^^^^^^
+
+warning: use of deprecated enum `unstable_generic_param::Enum5`: test
+  --> $DIR/generics-default-stability.rs:247:12
+   |
+LL |     let _: Enum5 = ENUM5;
+   |            ^^^^^
+
+warning: use of deprecated enum `unstable_generic_param::Enum5`: test
+  --> $DIR/generics-default-stability.rs:248:12
+   |
+LL |     let _: Enum5<usize> = ENUM5;
+   |            ^^^^^^^^^^^^
+
+warning: use of deprecated variant `unstable_generic_param::Enum5::Some`: test
+  --> $DIR/generics-default-stability.rs:250:27
+   |
+LL |     let _: Enum5<isize> = Enum5::Some(0);
+   |                           ^^^^^^^^^^^
+
+warning: use of deprecated enum `unstable_generic_param::Enum5`: test
+  --> $DIR/generics-default-stability.rs:250:12
+   |
+LL |     let _: Enum5<isize> = Enum5::Some(0);
+   |            ^^^^^^^^^^^^
+
+error[E0658]: use of unstable library feature 'unstable_default'
+  --> $DIR/generics-default-stability.rs:36: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:40: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:41: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:70: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:72: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:73: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:97: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:103: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:105: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:113: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:117: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:118: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:146: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:148: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:149: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:171: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:176: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:178: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:185: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:189: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:190: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:218: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:220: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:221: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:243: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:248: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:250: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:257: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:84:39
+   |
+LL |     let _: Struct4<isize> = Struct4 { field: 1 };
+   |                                       ^^^^^^^^
+
+warning: use of deprecated field `unstable_generic_param::Struct4::field`: test
+  --> $DIR/generics-default-stability.rs:91:39
+   |
+LL |     let _: Struct4<isize> = Struct4 { field: 0 };
+   |                                       ^^^^^^^^
+
+warning: use of deprecated field `unstable_generic_param::Struct5::field`: test
+  --> $DIR/generics-default-stability.rs:97:39
+   |
+LL |     let _: Struct5<isize> = Struct5 { field: 1 };
+   |                                       ^^^^^^^^
+
+warning: use of deprecated field `unstable_generic_param::Struct5::field`: test
+  --> $DIR/generics-default-stability.rs:105:39
+   |
+LL |     let _: Struct5<isize> = Struct5 { field: 0 };
+   |                                       ^^^^^^^^
+
+error: aborting due to 31 previous errors; 40 warnings emitted
+
+For more information about this error, try `rustc --explain E0658`.