diff --git a/src/librustc_metadata/rmeta/encoder.rs b/src/librustc_metadata/rmeta/encoder.rs
index 2589e162dffe2..47a59ea6499bc 100644
--- a/src/librustc_metadata/rmeta/encoder.rs
+++ b/src/librustc_metadata/rmeta/encoder.rs
@@ -1612,6 +1612,9 @@ impl EncodeContext<'tcx> {
                         EntryKind::TypeParam,
                         default.is_some(),
                     );
+                    if default.is_some() {
+                        self.encode_stability(def_id.to_def_id());
+                    }
                 }
                 GenericParamKind::Const { .. } => {
                     self.encode_info_for_generic_param(
@@ -1619,6 +1622,7 @@ impl EncodeContext<'tcx> {
                         EntryKind::ConstParam,
                         true,
                     );
+                    // FIXME(const_generics:defaults)
                 }
             }
         }
diff --git a/src/librustc_middle/middle/stability.rs b/src/librustc_middle/middle/stability.rs
index 54c05bca3bd2b..bcd14727630db 100644
--- a/src/librustc_middle/middle/stability.rs
+++ b/src/librustc_middle/middle/stability.rs
@@ -374,9 +374,27 @@ impl<'tcx> TyCtxt<'tcx> {
     /// If the item defined by `def_id` is unstable and the corresponding `#![feature]` does not
     /// exist, emits an error.
     ///
-    /// Additionally, this function will also check if the item is deprecated. If so, and `id` is
-    /// not `None`, a deprecated lint attached to `id` will be emitted.
+    /// This function will also check if the item is deprecated.
+    /// If so, and `id` is not `None`, a deprecated lint attached to `id` will be emitted.
     pub fn check_stability(self, def_id: DefId, id: Option<HirId>, span: Span) {
+        self.check_optional_stability(def_id, id, span, |span, def_id| {
+            // The API could be uncallable for other reasons, for example when a private module
+            // was referenced.
+            self.sess.delay_span_bug(span, &format!("encountered unmarked API: {:?}", def_id));
+        })
+    }
+
+    /// Like `check_stability`, except that we permit items to have custom behaviour for
+    /// missing stability attributes (not necessarily just emit a `bug!`). This is necessary
+    /// for default generic parameters, which only have stability attributes if they were
+    /// added after the type on which they're defined.
+    pub fn check_optional_stability(
+        self,
+        def_id: DefId,
+        id: Option<HirId>,
+        span: Span,
+        unmarked: impl FnOnce(Span, DefId) -> (),
+    ) {
         let soft_handler = |lint, span, msg: &_| {
             self.struct_span_lint_hir(lint, id.unwrap_or(hir::CRATE_HIR_ID), span, |lint| {
                 lint.build(msg).emit()
@@ -387,11 +405,7 @@ impl<'tcx> TyCtxt<'tcx> {
             EvalResult::Deny { feature, reason, issue, is_soft } => {
                 report_unstable(self.sess, feature, reason, issue, is_soft, span, soft_handler)
             }
-            EvalResult::Unmarked => {
-                // The API could be uncallable for other reasons, for example when a private module
-                // was referenced.
-                self.sess.delay_span_bug(span, &format!("encountered unmarked API: {:?}", def_id));
-            }
+            EvalResult::Unmarked => unmarked(span, def_id),
         }
     }
 
diff --git a/src/librustc_passes/stability.rs b/src/librustc_passes/stability.rs
index 054748c09fc44..1830cfdd717e8 100644
--- a/src/librustc_passes/stability.rs
+++ b/src/librustc_passes/stability.rs
@@ -36,6 +36,23 @@ enum AnnotationKind {
     Container,
 }
 
+/// Whether to inherit deprecation flags for nested items. In most cases, we do want to inherit
+/// deprecation, because nested items rarely have individual deprecation attributes, and so
+/// should be treated as deprecated if their parent is. However, default generic parameters
+/// have separate deprecation attributes from their parents, so we do not wish to inherit
+/// deprecation in this case. For example, inheriting deprecation for `T` in `Foo<T>`
+/// would cause a duplicate warning arising from both `Foo` and `T` being deprecated.
+enum InheritDeprecation {
+    Yes,
+    No,
+}
+
+impl InheritDeprecation {
+    fn yes(&self) -> bool {
+        matches!(self, InheritDeprecation::Yes)
+    }
+}
+
 // A private tree-walker for producing an Index.
 struct Annotator<'a, 'tcx> {
     tcx: TyCtxt<'tcx>,
@@ -55,12 +72,20 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
         attrs: &[Attribute],
         item_sp: Span,
         kind: AnnotationKind,
+        inherit_deprecation: InheritDeprecation,
         visit_children: F,
     ) where
         F: FnOnce(&mut Self),
     {
         if !self.tcx.features().staged_api {
-            self.forbid_staged_api_attrs(hir_id, attrs, item_sp, kind, visit_children);
+            self.forbid_staged_api_attrs(
+                hir_id,
+                attrs,
+                item_sp,
+                kind,
+                inherit_deprecation,
+                visit_children,
+            );
             return;
         }
 
@@ -106,8 +131,11 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
             // If parent is deprecated and we're not, inherit this by merging
             // deprecated_since and its reason.
             if let Some(parent_stab) = self.parent_stab {
-                if parent_stab.rustc_depr.is_some() && stab.rustc_depr.is_none() {
-                    stab.rustc_depr = parent_stab.rustc_depr
+                if inherit_deprecation.yes()
+                    && parent_stab.rustc_depr.is_some()
+                    && stab.rustc_depr.is_none()
+                {
+                    stab.rustc_depr = parent_stab.rustc_depr.clone()
                 }
             }
 
@@ -157,7 +185,7 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
         if stab.is_none() {
             debug!("annotate: stab not found, parent = {:?}", self.parent_stab);
             if let Some(stab) = self.parent_stab {
-                if stab.level.is_unstable() {
+                if inherit_deprecation.yes() && stab.level.is_unstable() {
                     self.index.stab_map.insert(hir_id, stab);
                 }
             }
@@ -200,6 +228,7 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
         attrs: &[Attribute],
         item_sp: Span,
         kind: AnnotationKind,
+        inherit_deprecation: InheritDeprecation,
         visit_children: impl FnOnce(&mut Self),
     ) {
         // Emit errors for non-staged-api crates.
@@ -227,7 +256,7 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
         // Propagate unstability.  This can happen even for non-staged-api crates in case
         // -Zforce-unstable-if-unmarked is set.
         if let Some(stab) = self.parent_stab {
-            if stab.level.is_unstable() {
+            if inherit_deprecation.yes() && stab.level.is_unstable() {
                 self.index.stab_map.insert(hir_id, stab);
             }
         }
@@ -280,54 +309,119 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
             }
             hir::ItemKind::Struct(ref sd, _) => {
                 if let Some(ctor_hir_id) = sd.ctor_hir_id() {
-                    self.annotate(ctor_hir_id, &i.attrs, i.span, AnnotationKind::Required, |_| {})
+                    self.annotate(
+                        ctor_hir_id,
+                        &i.attrs,
+                        i.span,
+                        AnnotationKind::Required,
+                        InheritDeprecation::Yes,
+                        |_| {},
+                    )
                 }
             }
             _ => {}
         }
 
-        self.annotate(i.hir_id, &i.attrs, i.span, kind, |v| intravisit::walk_item(v, i));
+        self.annotate(i.hir_id, &i.attrs, i.span, kind, InheritDeprecation::Yes, |v| {
+            intravisit::walk_item(v, i)
+        });
         self.in_trait_impl = orig_in_trait_impl;
     }
 
     fn visit_trait_item(&mut self, ti: &'tcx hir::TraitItem<'tcx>) {
-        self.annotate(ti.hir_id, &ti.attrs, ti.span, AnnotationKind::Required, |v| {
-            intravisit::walk_trait_item(v, ti);
-        });
+        self.annotate(
+            ti.hir_id,
+            &ti.attrs,
+            ti.span,
+            AnnotationKind::Required,
+            InheritDeprecation::Yes,
+            |v| {
+                intravisit::walk_trait_item(v, ti);
+            },
+        );
     }
 
     fn visit_impl_item(&mut self, ii: &'tcx hir::ImplItem<'tcx>) {
         let kind =
             if self.in_trait_impl { AnnotationKind::Prohibited } else { AnnotationKind::Required };
-        self.annotate(ii.hir_id, &ii.attrs, ii.span, kind, |v| {
+        self.annotate(ii.hir_id, &ii.attrs, ii.span, kind, InheritDeprecation::Yes, |v| {
             intravisit::walk_impl_item(v, ii);
         });
     }
 
     fn visit_variant(&mut self, var: &'tcx Variant<'tcx>, g: &'tcx Generics<'tcx>, item_id: HirId) {
-        self.annotate(var.id, &var.attrs, var.span, AnnotationKind::Required, |v| {
-            if let Some(ctor_hir_id) = var.data.ctor_hir_id() {
-                v.annotate(ctor_hir_id, &var.attrs, var.span, AnnotationKind::Required, |_| {});
-            }
+        self.annotate(
+            var.id,
+            &var.attrs,
+            var.span,
+            AnnotationKind::Required,
+            InheritDeprecation::Yes,
+            |v| {
+                if let Some(ctor_hir_id) = var.data.ctor_hir_id() {
+                    v.annotate(
+                        ctor_hir_id,
+                        &var.attrs,
+                        var.span,
+                        AnnotationKind::Required,
+                        InheritDeprecation::Yes,
+                        |_| {},
+                    );
+                }
 
-            intravisit::walk_variant(v, var, g, item_id)
-        })
+                intravisit::walk_variant(v, var, g, item_id)
+            },
+        )
     }
 
     fn visit_struct_field(&mut self, s: &'tcx StructField<'tcx>) {
-        self.annotate(s.hir_id, &s.attrs, s.span, AnnotationKind::Required, |v| {
-            intravisit::walk_struct_field(v, s);
-        });
+        self.annotate(
+            s.hir_id,
+            &s.attrs,
+            s.span,
+            AnnotationKind::Required,
+            InheritDeprecation::Yes,
+            |v| {
+                intravisit::walk_struct_field(v, s);
+            },
+        );
     }
 
     fn visit_foreign_item(&mut self, i: &'tcx hir::ForeignItem<'tcx>) {
-        self.annotate(i.hir_id, &i.attrs, i.span, AnnotationKind::Required, |v| {
-            intravisit::walk_foreign_item(v, i);
-        });
+        self.annotate(
+            i.hir_id,
+            &i.attrs,
+            i.span,
+            AnnotationKind::Required,
+            InheritDeprecation::Yes,
+            |v| {
+                intravisit::walk_foreign_item(v, i);
+            },
+        );
     }
 
     fn visit_macro_def(&mut self, md: &'tcx hir::MacroDef<'tcx>) {
-        self.annotate(md.hir_id, &md.attrs, md.span, AnnotationKind::Required, |_| {});
+        self.annotate(
+            md.hir_id,
+            &md.attrs,
+            md.span,
+            AnnotationKind::Required,
+            InheritDeprecation::Yes,
+            |_| {},
+        );
+    }
+
+    fn visit_generic_param(&mut self, p: &'tcx hir::GenericParam<'tcx>) {
+        let kind = match &p.kind {
+            // FIXME(const_generics:defaults)
+            hir::GenericParamKind::Type { default, .. } if default.is_some() => {
+                AnnotationKind::Container
+            }
+            _ => AnnotationKind::Prohibited,
+        };
+
+        self.annotate(p.hir_id, &p.attrs, p.span, kind, InheritDeprecation::No, |v| {
+            intravisit::walk_generic_param(v, p);
+        });
     }
 }
 
@@ -401,6 +495,10 @@ impl<'a, 'tcx> Visitor<'tcx> for MissingStabilityAnnotations<'a, 'tcx> {
     fn visit_macro_def(&mut self, md: &'tcx hir::MacroDef<'tcx>) {
         self.check_missing_stability(md.hir_id, md.span);
     }
+
+    // Note that we don't need to `check_missing_stability` for default generic parameters,
+    // as we assume that any default generic parameters without attributes are automatically
+    // stable (assuming they have not inherited instability from their parent).
 }
 
 fn new_index(tcx: TyCtxt<'tcx>) -> Index<'tcx> {
@@ -464,6 +562,7 @@ fn new_index(tcx: TyCtxt<'tcx>) -> Index<'tcx> {
             &krate.item.attrs,
             krate.item.span,
             AnnotationKind::Required,
+            InheritDeprecation::Yes,
             |v| intravisit::walk_crate(v, krate),
         );
     }
diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs
index 6529d784ad452..ba2c0581c9263 100644
--- a/src/librustc_typeck/astconv.rs
+++ b/src/librustc_typeck/astconv.rs
@@ -776,7 +776,21 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
                 (GenericParamDefKind::Lifetime, GenericArg::Lifetime(lt)) => {
                     self.ast_region_to_region(&lt, Some(param)).into()
                 }
-                (GenericParamDefKind::Type { .. }, GenericArg::Type(ty)) => {
+                (GenericParamDefKind::Type { has_default, .. }, GenericArg::Type(ty)) => {
+                    if *has_default {
+                        tcx.check_optional_stability(
+                            param.def_id,
+                            Some(arg.id()),
+                            arg.span(),
+                            |_, _| {
+                                // Default generic parameters may not be marked
+                                // with stability attributes, i.e. when the
+                                // default parameter was defined at the same time
+                                // as the rest of the type. As such, we ignore missing
+                                // stability attributes.
+                            },
+                        )
+                    }
                     if let (hir::TyKind::Infer, false) = (&ty.kind, self.allow_ty_infer()) {
                         inferred_params.push(ty.span);
                         tcx.types.err.into()
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 0000000000000..b5490381a46b6
--- /dev/null
+++ b/src/test/ui/stability-attribute/auxiliary/unstable_generic_param.rs
@@ -0,0 +1,123 @@
+#![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 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 0000000000000..3fd14e25d0ef2
--- /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 0000000000000..19fa09f311ba8
--- /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 0000000000000..b68336da1a5f7
--- /dev/null
+++ b/src/test/ui/stability-attribute/generics-default-stability.rs
@@ -0,0 +1,120 @@
+// 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 item 'unstable_generic_param::Struct4': test [deprecated]
+    //~^^ use of deprecated item 'unstable_generic_param::Struct4': test [deprecated]
+    //~^^^ use of deprecated item 'unstable_generic_param::Struct4::field': test [deprecated]
+    let _ = STRUCT4;
+    let _: Struct4 = STRUCT4; //~ use of deprecated item 'unstable_generic_param::Struct4': test [deprecated]
+    let _: Struct4<usize> = STRUCT4; //~ use of deprecated item 'unstable_generic_param::Struct4': test [deprecated]
+    let _: Struct4<isize> = Struct4 { field: 0 };
+    //~^ use of deprecated item 'unstable_generic_param::Struct4': test [deprecated]
+    //~^^ use of deprecated item 'unstable_generic_param::Struct4': test [deprecated]
+    //~^^^ use of deprecated item '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 item 'unstable_generic_param::Struct5': test [deprecated]
+    //~^^ use of deprecated item 'unstable_generic_param::Struct5': test [deprecated]
+    //~^^^ use of deprecated item 'unstable_generic_param::Struct5::field': test [deprecated]
+    let _ = STRUCT5;
+    let _: Struct5 = STRUCT5; //~ use of deprecated item 'unstable_generic_param::Struct5': test [deprecated]
+    let _: Struct5<usize> = STRUCT5; //~ ERROR use of unstable library feature 'unstable_default'
+    //~^ use of deprecated item 'unstable_generic_param::Struct5': test [deprecated]
+    let _: Struct5<isize> = Struct5 { field: 0 }; //~ ERROR use of unstable library feature 'unstable_default'
+    //~^ use of deprecated item 'unstable_generic_param::Struct5': test [deprecated]
+    //~^^ use of deprecated item 'unstable_generic_param::Struct5': test [deprecated]
+    //~^^^ use of deprecated item 'unstable_generic_param::Struct5::field': test [deprecated]
+
+    let _: Struct6<isize> = Struct6 { field: 1 }; // ok
+    let _: Struct6<isize> = Struct6 { field: 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 0000000000000..37a809f8bca65
--- /dev/null
+++ b/src/test/ui/stability-attribute/generics-default-stability.stderr
@@ -0,0 +1,205 @@
+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 item '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 item 'unstable_generic_param::Struct4': test
+  --> $DIR/generics-default-stability.rs:84:12
+   |
+LL |     let _: Struct4<isize> = Struct4 { field: 1 };
+   |            ^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'unstable_generic_param::Struct4': test
+  --> $DIR/generics-default-stability.rs:89:12
+   |
+LL |     let _: Struct4 = STRUCT4;
+   |            ^^^^^^^
+
+warning: use of deprecated item 'unstable_generic_param::Struct4': test
+  --> $DIR/generics-default-stability.rs:90:12
+   |
+LL |     let _: Struct4<usize> = STRUCT4;
+   |            ^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'unstable_generic_param::Struct4': test
+  --> $DIR/generics-default-stability.rs:91:29
+   |
+LL |     let _: Struct4<isize> = Struct4 { field: 0 };
+   |                             ^^^^^^^
+
+warning: use of deprecated item 'unstable_generic_param::Struct4': test
+  --> $DIR/generics-default-stability.rs:91:12
+   |
+LL |     let _: Struct4<isize> = Struct4 { field: 0 };
+   |            ^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'unstable_generic_param::Struct5': test
+  --> $DIR/generics-default-stability.rs:97:29
+   |
+LL |     let _: Struct5<isize> = Struct5 { field: 1 };
+   |                             ^^^^^^^
+
+warning: use of deprecated item 'unstable_generic_param::Struct5': test
+  --> $DIR/generics-default-stability.rs:97:12
+   |
+LL |     let _: Struct5<isize> = Struct5 { field: 1 };
+   |            ^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'unstable_generic_param::Struct5': test
+  --> $DIR/generics-default-stability.rs:102:12
+   |
+LL |     let _: Struct5 = STRUCT5;
+   |            ^^^^^^^
+
+warning: use of deprecated item 'unstable_generic_param::Struct5': test
+  --> $DIR/generics-default-stability.rs:103:12
+   |
+LL |     let _: Struct5<usize> = STRUCT5;
+   |            ^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'unstable_generic_param::Struct5': test
+  --> $DIR/generics-default-stability.rs:105:29
+   |
+LL |     let _: Struct5<isize> = Struct5 { field: 0 };
+   |                             ^^^^^^^
+
+warning: use of deprecated item 'unstable_generic_param::Struct5': test
+  --> $DIR/generics-default-stability.rs:105:12
+   |
+LL |     let _: Struct5<isize> = Struct5 { field: 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 'box_alloc_param'
+  --> $DIR/generics-default-stability.rs:113: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 item 'unstable_generic_param::Struct4::field': test
+  --> $DIR/generics-default-stability.rs:84:39
+   |
+LL |     let _: Struct4<isize> = Struct4 { field: 1 };
+   |                                       ^^^^^^^^
+
+warning: use of deprecated item 'unstable_generic_param::Struct4::field': test
+  --> $DIR/generics-default-stability.rs:91:39
+   |
+LL |     let _: Struct4<isize> = Struct4 { field: 0 };
+   |                                       ^^^^^^^^
+
+warning: use of deprecated item 'unstable_generic_param::Struct5::field': test
+  --> $DIR/generics-default-stability.rs:97:39
+   |
+LL |     let _: Struct5<isize> = Struct5 { field: 1 };
+   |                                       ^^^^^^^^
+
+warning: use of deprecated item 'unstable_generic_param::Struct5::field': test
+  --> $DIR/generics-default-stability.rs:105:39
+   |
+LL |     let _: Struct5<isize> = Struct5 { field: 0 };
+   |                                       ^^^^^^^^
+
+error: aborting due to 13 previous errors; 16 warnings emitted
+
+For more information about this error, try `rustc --explain E0658`.