about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEduard Burtescu <edy.burt@gmail.com>2016-11-10 19:08:21 +0200
committerEduard-Mihai Burtescu <edy.burt@gmail.com>2016-11-28 04:18:11 +0200
commit9aaf26e7aa4068d7e5643b136fb70ecd689a746d (patch)
tree60fdabfe4a91fa16c2b24d8d310bc3ff50ca28cc
parentf97c132cac79ef6bdf9f950b415c67bb43af387a (diff)
downloadrust-9aaf26e7aa4068d7e5643b136fb70ecd689a746d.tar.gz
rust-9aaf26e7aa4068d7e5643b136fb70ecd689a746d.zip
rustc: rework stability to be on-demand for type-directed lookup.
-rwxr-xr-xsrc/etc/generate-deriving-span-tests.py5
-rw-r--r--src/librustc/dep_graph/dep_node.rs4
-rw-r--r--src/librustc/hir/lowering.rs3
-rw-r--r--src/librustc/lint/builtin.rs9
-rw-r--r--src/librustc/middle/stability.rs512
-rw-r--r--src/librustc_driver/driver.rs21
-rw-r--r--src/librustc_lint/builtin.rs137
-rw-r--r--src/librustc_lint/lib.rs1
-rw-r--r--src/librustc_typeck/astconv.rs8
-rw-r--r--src/librustc_typeck/check/_match.rs11
-rw-r--r--src/librustc_typeck/check/method/mod.rs5
-rw-r--r--src/librustc_typeck/check/mod.rs20
-rw-r--r--src/libsyntax/test.rs7
-rw-r--r--src/test/compile-fail-fulldeps/dropck_tarena_cycle_checked.rs2
-rw-r--r--src/test/compile-fail-fulldeps/dropck_tarena_unsound_drop.rs2
-rw-r--r--src/test/compile-fail-fulldeps/proc-macro/at-the-root.rs2
-rw-r--r--src/test/compile-fail-fulldeps/proc-macro/attribute.rs2
-rw-r--r--src/test/compile-fail-fulldeps/proc-macro/define-two.rs2
-rw-r--r--src/test/compile-fail-fulldeps/proc-macro/error-on-test.rs2
-rw-r--r--src/test/compile-fail-fulldeps/proc-macro/illegal-proc-macro-derive-use.rs2
-rw-r--r--src/test/compile-fail-fulldeps/proc-macro/shadow-builtin.rs2
-rw-r--r--src/test/compile-fail-fulldeps/proc-macro/signature.rs2
-rw-r--r--src/test/compile-fail/E0254.rs2
-rw-r--r--src/test/compile-fail/E0259.rs2
-rw-r--r--src/test/compile-fail/E0260.rs2
-rw-r--r--src/test/compile-fail/borrowck/borrowck-borrowed-uniq-rvalue.rs1
-rw-r--r--src/test/compile-fail/borrowck/borrowck-call-is-borrow-issue-12224.rs2
-rw-r--r--src/test/compile-fail/borrowck/borrowck-insert-during-each.rs1
-rw-r--r--src/test/compile-fail/borrowck/borrowck-overloaded-call.rs2
-rw-r--r--src/test/compile-fail/derives-span-Clone-enum-struct-variant.rs (renamed from src/test/compile-fail/deriving-span-Clone-enum-struct-variant.rs)4
-rw-r--r--src/test/compile-fail/derives-span-Clone-enum.rs (renamed from src/test/compile-fail/deriving-span-Clone-enum.rs)4
-rw-r--r--src/test/compile-fail/derives-span-Clone-struct.rs (renamed from src/test/compile-fail/deriving-span-Clone-struct.rs)4
-rw-r--r--src/test/compile-fail/derives-span-Clone-tuple-struct.rs (renamed from src/test/compile-fail/deriving-span-Clone-tuple-struct.rs)4
-rw-r--r--src/test/compile-fail/derives-span-Debug-enum-struct-variant.rs (renamed from src/test/compile-fail/deriving-span-Show-enum-struct-variant.rs)4
-rw-r--r--src/test/compile-fail/derives-span-Debug-enum.rs (renamed from src/test/compile-fail/deriving-span-Show-enum.rs)4
-rw-r--r--src/test/compile-fail/derives-span-Debug-struct.rs (renamed from src/test/compile-fail/deriving-span-Show-struct.rs)4
-rw-r--r--src/test/compile-fail/derives-span-Debug-tuple-struct.rs (renamed from src/test/compile-fail/deriving-span-Show-tuple-struct.rs)4
-rw-r--r--src/test/compile-fail/derives-span-Default-struct.rs (renamed from src/test/compile-fail/deriving-span-Default-struct.rs)4
-rw-r--r--src/test/compile-fail/derives-span-Default-tuple-struct.rs (renamed from src/test/compile-fail/deriving-span-Default-tuple-struct.rs)4
-rw-r--r--src/test/compile-fail/derives-span-Eq-enum-struct-variant.rs (renamed from src/test/compile-fail/deriving-span-TotalEq-enum-struct-variant.rs)4
-rw-r--r--src/test/compile-fail/derives-span-Eq-enum.rs (renamed from src/test/compile-fail/deriving-span-TotalEq-enum.rs)4
-rw-r--r--src/test/compile-fail/derives-span-Eq-struct.rs (renamed from src/test/compile-fail/deriving-span-TotalEq-struct.rs)4
-rw-r--r--src/test/compile-fail/derives-span-Eq-tuple-struct.rs (renamed from src/test/compile-fail/deriving-span-TotalEq-tuple-struct.rs)4
-rw-r--r--src/test/compile-fail/derives-span-Hash-enum-struct-variant.rs (renamed from src/test/compile-fail/deriving-span-Hash-enum-struct-variant.rs)4
-rw-r--r--src/test/compile-fail/derives-span-Hash-enum.rs (renamed from src/test/compile-fail/deriving-span-Hash-enum.rs)4
-rw-r--r--src/test/compile-fail/derives-span-Hash-struct.rs (renamed from src/test/compile-fail/deriving-span-Hash-struct.rs)4
-rw-r--r--src/test/compile-fail/derives-span-Hash-tuple-struct.rs (renamed from src/test/compile-fail/deriving-span-Hash-tuple-struct.rs)4
-rw-r--r--src/test/compile-fail/derives-span-Ord-enum-struct-variant.rs (renamed from src/test/compile-fail/deriving-span-TotalOrd-enum-struct-variant.rs)4
-rw-r--r--src/test/compile-fail/derives-span-Ord-enum.rs (renamed from src/test/compile-fail/deriving-span-TotalOrd-enum.rs)4
-rw-r--r--src/test/compile-fail/derives-span-Ord-struct.rs (renamed from src/test/compile-fail/deriving-span-TotalOrd-struct.rs)4
-rw-r--r--src/test/compile-fail/derives-span-Ord-tuple-struct.rs (renamed from src/test/compile-fail/deriving-span-TotalOrd-tuple-struct.rs)4
-rw-r--r--src/test/compile-fail/derives-span-PartialEq-enum-struct-variant.rs (renamed from src/test/compile-fail/deriving-span-PartialEq-enum-struct-variant.rs)4
-rw-r--r--src/test/compile-fail/derives-span-PartialEq-enum.rs (renamed from src/test/compile-fail/deriving-span-PartialEq-enum.rs)4
-rw-r--r--src/test/compile-fail/derives-span-PartialEq-struct.rs (renamed from src/test/compile-fail/deriving-span-PartialEq-struct.rs)4
-rw-r--r--src/test/compile-fail/derives-span-PartialEq-tuple-struct.rs (renamed from src/test/compile-fail/deriving-span-PartialEq-tuple-struct.rs)4
-rw-r--r--src/test/compile-fail/derives-span-PartialOrd-enum-struct-variant.rs (renamed from src/test/compile-fail/deriving-span-PartialOrd-enum-struct-variant.rs)4
-rw-r--r--src/test/compile-fail/derives-span-PartialOrd-enum.rs (renamed from src/test/compile-fail/deriving-span-PartialOrd-enum.rs)4
-rw-r--r--src/test/compile-fail/derives-span-PartialOrd-struct.rs (renamed from src/test/compile-fail/deriving-span-PartialOrd-struct.rs)4
-rw-r--r--src/test/compile-fail/derives-span-PartialOrd-tuple-struct.rs (renamed from src/test/compile-fail/deriving-span-PartialOrd-tuple-struct.rs)4
-rw-r--r--src/test/compile-fail/forget-init-unsafe.rs2
-rw-r--r--src/test/compile-fail/issue-15094.rs2
-rw-r--r--src/test/compile-fail/issue-17545.rs2
-rw-r--r--src/test/compile-fail/issue-20225.rs2
-rw-r--r--src/test/compile-fail/issue-22034.rs2
-rw-r--r--src/test/compile-fail/issue-2392.rs3
-rw-r--r--src/test/compile-fail/issue-28075.rs1
-rw-r--r--src/test/compile-fail/issue-36881.rs2
-rw-r--r--src/test/compile-fail/issue-4335.rs2
-rw-r--r--src/test/compile-fail/lint-output-format-2.rs25
-rw-r--r--src/test/compile-fail/lint-output-format.rs5
-rw-r--r--src/test/compile-fail/lint-stability-2.rs423
-rw-r--r--src/test/compile-fail/lint-stability-deprecated.rs467
-rw-r--r--src/test/compile-fail/lint-stability-fields-deprecated.rs348
-rw-r--r--src/test/compile-fail/lint-stability-fields.rs142
-rw-r--r--src/test/compile-fail/lint-stability.rs240
-rw-r--r--src/test/compile-fail/map-types.rs2
-rw-r--r--src/test/compile-fail/mir-dataflow/def-inits-1.rs2
-rw-r--r--src/test/compile-fail/mir-dataflow/inits-1.rs2
-rw-r--r--src/test/compile-fail/mir-dataflow/uninits-1.rs2
-rw-r--r--src/test/compile-fail/mir-dataflow/uninits-2.rs2
-rw-r--r--src/test/compile-fail/non-copyable-void.rs2
-rw-r--r--src/test/compile-fail/overloaded-calls-bad.rs2
-rw-r--r--src/test/compile-fail/overloaded-calls-nontuple.rs2
-rw-r--r--src/test/compile-fail/range_inclusive_gate.rs6
-rw-r--r--src/test/compile-fail/reflect-assoc.rs2
-rw-r--r--src/test/compile-fail/reflect-object-param.rs2
-rw-r--r--src/test/compile-fail/reflect.rs2
-rw-r--r--src/test/compile-fail/regions-steal-closure.rs2
-rw-r--r--src/test/compile-fail/resolve_self_super_hint.rs2
-rw-r--r--src/test/compile-fail/stability-attribute-sanity-2.rs5
-rw-r--r--src/test/compile-fail/stability-attribute-sanity-3.rs22
-rw-r--r--src/test/compile-fail/static-mut-foreign-requires-unsafe.rs2
-rw-r--r--src/test/compile-fail/task-rng-isnt-sendable.rs2
-rw-r--r--src/test/compile-fail/unboxed-closures-fnmut-as-fn.rs2
-rw-r--r--src/test/compile-fail/unboxed-closures-infer-argument-types-two-region-pointers.rs2
-rw-r--r--src/test/compile-fail/unboxed-closures-recursive-fn-using-fn-mut.rs2
-rw-r--r--src/test/ui/span/issue-23827.rs2
97 files changed, 1774 insertions, 858 deletions
diff --git a/src/etc/generate-deriving-span-tests.py b/src/etc/generate-deriving-span-tests.py
index 790fc894287..6642da858e5 100755
--- a/src/etc/generate-deriving-span-tests.py
+++ b/src/etc/generate-deriving-span-tests.py
@@ -37,8 +37,6 @@ TEMPLATE = """// Copyright {year} The Rust Project Developers. See the COPYRIGHT
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-extern crate rand;
-
 {error_deriving}
 struct Error;
 {code}
@@ -106,7 +104,6 @@ STRUCT = 2
 ALL = STRUCT | ENUM
 
 traits = {
-    'Zero': (STRUCT, [], 1),
     'Default': (STRUCT, [], 1),
     'FromPrimitive': (0, [], 0), # only works for C-like enums
 
@@ -116,7 +113,7 @@ traits = {
 
 for (trait, supers, errs) in [('Clone', [], 1),
                               ('PartialEq', [], 2),
-                              ('PartialOrd', ['PartialEq'], 8),
+                              ('PartialOrd', ['PartialEq'], 9),
                               ('Eq', ['PartialEq'], 1),
                               ('Ord', ['Eq', 'PartialOrd', 'PartialEq'], 1),
                               ('Debug', [], 1),
diff --git a/src/librustc/dep_graph/dep_node.rs b/src/librustc/dep_graph/dep_node.rs
index 351feaba034..397d61d5372 100644
--- a/src/librustc/dep_graph/dep_node.rs
+++ b/src/librustc/dep_graph/dep_node.rs
@@ -90,7 +90,7 @@ pub enum DepNode<D: Clone + Debug> {
     RvalueCheck(D),
     Reachability,
     DeadCheck,
-    StabilityCheck,
+    StabilityCheck(D),
     LateLintCheck,
     TransCrate,
     TransCrateItem(D),
@@ -189,7 +189,6 @@ impl<D: Clone + Debug> DepNode<D> {
             Privacy => Some(Privacy),
             Reachability => Some(Reachability),
             DeadCheck => Some(DeadCheck),
-            StabilityCheck => Some(StabilityCheck),
             LateLintCheck => Some(LateLintCheck),
             TransCrate => Some(TransCrate),
             TransWriteMetadata => Some(TransWriteMetadata),
@@ -217,6 +216,7 @@ impl<D: Clone + Debug> DepNode<D> {
             Mir(ref d) => op(d).map(Mir),
             BorrowCheck(ref d) => op(d).map(BorrowCheck),
             RvalueCheck(ref d) => op(d).map(RvalueCheck),
+            StabilityCheck(ref d) => op(d).map(StabilityCheck),
             TransCrateItem(ref d) => op(d).map(TransCrateItem),
             TransInlinedItem(ref d) => op(d).map(TransInlinedItem),
             AssociatedItems(ref d) => op(d).map(AssociatedItems),
diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs
index e93210121b7..39d0ed9a67b 100644
--- a/src/librustc/hir/lowering.rs
+++ b/src/librustc/hir/lowering.rs
@@ -1362,7 +1362,8 @@ impl<'a> LoweringContext<'a> {
                         } else {
                             let fields = fields.into_iter().map(|&(s, e)| {
                                 let expr = P(this.lower_expr(&e));
-                                this.field(Symbol::intern(s), expr, e.span)
+                                let unstable_span = this.allow_internal_unstable("...", e.span);
+                                this.field(Symbol::intern(s), expr, unstable_span)
                             }).collect();
                             let attrs = ast_expr.attrs.clone();
 
diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs
index 96aee04b6b7..78d5067b273 100644
--- a/src/librustc/lint/builtin.rs
+++ b/src/librustc/lint/builtin.rs
@@ -211,6 +211,12 @@ declare_lint! {
      not named `mod.rs`"
 }
 
+declare_lint! {
+    pub DEPRECATED,
+    Warn,
+    "detects use of deprecated items"
+}
+
 /// Does nothing as a lint pass, but registers some `Lint`s
 /// which are used by other parts of the compiler.
 #[derive(Copy, Clone)]
@@ -250,7 +256,8 @@ impl LintPass for HardwiredLints {
             SAFE_EXTERN_STATICS,
             PATTERNS_IN_FNS_WITHOUT_BODY,
             EXTRA_REQUIREMENT_IN_IMPL,
-            LEGACY_DIRECTORY_OWNERSHIP
+            LEGACY_DIRECTORY_OWNERSHIP,
+            DEPRECATED
         )
     }
 }
diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs
index d01954ab95a..f5e18e13465 100644
--- a/src/librustc/middle/stability.rs
+++ b/src/librustc/middle/stability.rs
@@ -15,11 +15,10 @@ pub use self::StabilityLevel::*;
 
 use dep_graph::DepNode;
 use hir::map as hir_map;
-use session::Session;
 use lint;
 use hir::def::Def;
 use hir::def_id::{CrateNum, CRATE_DEF_INDEX, DefId, DefIndex, LOCAL_CRATE};
-use ty::{self, TyCtxt, AdtKind};
+use ty::TyCtxt;
 use middle::privacy::AccessLevels;
 use syntax::symbol::Symbol;
 use syntax_pos::{Span, DUMMY_SP};
@@ -30,9 +29,9 @@ use syntax::attr::{self, Stability, Deprecation};
 use util::nodemap::{DefIdMap, FxHashSet, FxHashMap};
 
 use hir;
-use hir::{Item, Generics, StructField, Variant, PatKind};
+use hir::{Item, Generics, StructField, Variant};
 use hir::intravisit::{self, Visitor};
-use hir::pat_util::EnumerateAndAdjustIterator;
+use hir::itemlikevisit::DeepVisitor;
 
 use std::mem::replace;
 use std::cmp::Ordering;
@@ -101,7 +100,13 @@ pub struct Index<'tcx> {
     depr_map: DefIdMap<Option<DeprecationEntry>>,
 
     /// Maps for each crate whether it is part of the staged API.
-    staged_api: FxHashMap<CrateNum, bool>
+    staged_api: FxHashMap<CrateNum, bool>,
+
+    /// Features enabled for this crate.
+    active_features: FxHashSet<Symbol>,
+
+    /// Features used by this crate. Updated before and during typeck.
+    used_features: FxHashMap<Symbol, attr::StabilityLevel>
 }
 
 // A private tree-walker for producing an Index.
@@ -110,7 +115,6 @@ struct Annotator<'a, 'tcx: 'a> {
     index: &'a mut Index<'tcx>,
     parent_stab: Option<&'tcx Stability>,
     parent_depr: Option<DeprecationEntry>,
-    access_levels: &'a AccessLevels,
     in_trait_impl: bool,
 }
 
@@ -183,20 +187,12 @@ impl<'a, 'tcx: 'a> Annotator<'a, 'tcx> {
                 self.parent_stab = orig_parent_stab;
             } else {
                 debug!("annotate: not found, parent = {:?}", self.parent_stab);
-                let mut is_error = kind == AnnotationKind::Required &&
-                                   self.access_levels.is_reachable(id) &&
-                                   !self.tcx.sess.opts.test;
                 if let Some(stab) = self.parent_stab {
                     if stab.level.is_unstable() {
                         let def_id = self.tcx.map.local_def_id(id);
                         self.index.stab_map.insert(def_id, Some(stab));
-                        is_error = false;
                     }
                 }
-                if is_error {
-                    self.tcx.sess.span_err(item_sp, "This node does not have \
-                                                     a stability attribute");
-                }
                 visit_children(self);
             }
         } else {
@@ -313,9 +309,81 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
     }
 }
 
+struct MissingStabilityAnnotations<'a, 'tcx: 'a> {
+    tcx: TyCtxt<'a, 'tcx, 'tcx>,
+    access_levels: &'a AccessLevels,
+}
+
+impl<'a, 'tcx: 'a> MissingStabilityAnnotations<'a, 'tcx> {
+    fn check_missing_stability(&self, id: NodeId, span: Span) {
+        let def_id = self.tcx.map.local_def_id(id);
+        let is_error = !self.tcx.sess.opts.test &&
+                        !self.tcx.stability.borrow().stab_map.contains_key(&def_id) &&
+                        self.access_levels.is_reachable(id);
+        if is_error {
+            self.tcx.sess.span_err(span, "This node does not have a stability attribute");
+        }
+    }
+}
+
+impl<'a, 'tcx, 'v> Visitor<'v> for MissingStabilityAnnotations<'a, 'tcx> {
+    fn visit_item(&mut self, i: &Item) {
+        match i.node {
+            // Inherent impls and foreign modules serve only as containers for other items,
+            // they don't have their own stability. They still can be annotated as unstable
+            // and propagate this unstability to children, but this annotation is completely
+            // optional. They inherit stability from their parents when unannotated.
+            hir::ItemImpl(.., None, _, _) | hir::ItemForeignMod(..) => {}
+
+            _ => self.check_missing_stability(i.id, i.span)
+        }
+
+        intravisit::walk_item(self, i)
+    }
+
+    fn visit_trait_item(&mut self, ti: &hir::TraitItem) {
+        self.check_missing_stability(ti.id, ti.span);
+        intravisit::walk_trait_item(self, ti);
+    }
+
+    fn visit_impl_item(&mut self, ii: &hir::ImplItem) {
+        let impl_def_id = self.tcx.map.local_def_id(self.tcx.map.get_parent(ii.id));
+        if self.tcx.impl_trait_ref(impl_def_id).is_none() {
+            self.check_missing_stability(ii.id, ii.span);
+        }
+        intravisit::walk_impl_item(self, ii);
+    }
+
+    fn visit_variant(&mut self, var: &Variant, g: &Generics, item_id: NodeId) {
+        self.check_missing_stability(var.node.data.id(), var.span);
+        intravisit::walk_variant(self, var, g, item_id);
+    }
+
+    fn visit_struct_field(&mut self, s: &StructField) {
+        self.check_missing_stability(s.id, s.span);
+        intravisit::walk_struct_field(self, s);
+    }
+
+    fn visit_foreign_item(&mut self, i: &hir::ForeignItem) {
+        self.check_missing_stability(i.id, i.span);
+        intravisit::walk_foreign_item(self, i);
+    }
+
+    fn visit_macro_def(&mut self, md: &hir::MacroDef) {
+        if md.imported_from.is_none() {
+            self.check_missing_stability(md.id, md.span);
+        }
+    }
+}
+
 impl<'a, 'tcx> Index<'tcx> {
     /// Construct the stability index for a crate being compiled.
-    pub fn build(&mut self, tcx: TyCtxt<'a, 'tcx, 'tcx>, access_levels: &AccessLevels) {
+    pub fn build(&mut self, tcx: TyCtxt<'a, 'tcx, 'tcx>) {
+        let ref active_lib_features = tcx.sess.features.borrow().declared_lib_features;
+
+        // Put the active features into a map for quick lookup
+        self.active_features = active_lib_features.iter().map(|&(ref s, _)| s.clone()).collect();
+
         let _task = tcx.dep_graph.in_task(DepNode::StabilityIndex);
         let krate = tcx.map.krate();
         let mut annotator = Annotator {
@@ -323,7 +391,6 @@ impl<'a, 'tcx> Index<'tcx> {
             index: self,
             parent_stab: None,
             parent_depr: None,
-            access_levels: access_levels,
             in_trait_impl: false,
         };
         annotator.annotate(ast::CRATE_NODE_ID, &krate.attrs, krate.span, AnnotationKind::Required,
@@ -348,87 +415,118 @@ impl<'a, 'tcx> Index<'tcx> {
             staged_api: staged_api,
             stab_map: DefIdMap(),
             depr_map: DefIdMap(),
+            active_features: FxHashSet(),
+            used_features: FxHashMap(),
         }
     }
 }
 
 /// Cross-references the feature names of unstable APIs with enabled
-/// features and possibly prints errors. Returns a list of all
-/// features used.
-pub fn check_unstable_api_usage<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>)
-                                          -> FxHashMap<Symbol, attr::StabilityLevel> {
-    let _task = tcx.dep_graph.in_task(DepNode::StabilityCheck);
-    let ref active_lib_features = tcx.sess.features.borrow().declared_lib_features;
-
-    // Put the active features into a map for quick lookup
-    let active_features = active_lib_features.iter().map(|&(ref s, _)| s.clone()).collect();
-
-    let mut checker = Checker {
-        tcx: tcx,
-        active_features: active_features,
-        used_features: FxHashMap(),
-    };
-    intravisit::walk_crate(&mut checker, tcx.map.krate());
-
-    checker.used_features
+/// features and possibly prints errors.
+pub fn check_unstable_api_usage<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
+    let mut checker = Checker { tcx: tcx };
+    tcx.visit_all_item_likes_in_krate(DepNode::StabilityCheck,
+                                      &mut DeepVisitor::new(&mut checker));
 }
 
 struct Checker<'a, 'tcx: 'a> {
     tcx: TyCtxt<'a, 'tcx, 'tcx>,
-    active_features: FxHashSet<Symbol>,
-    used_features: FxHashMap<Symbol, attr::StabilityLevel>,
 }
 
-impl<'a, 'tcx> Checker<'a, 'tcx> {
-    fn check(&mut self, id: DefId, span: Span,
-             stab: &Option<&Stability>, _depr: &Option<DeprecationEntry>) {
-        if !is_staged_api(self.tcx, id) {
+impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
+    pub fn check_stability(self, def_id: DefId, id: NodeId, span: Span) {
+        if self.sess.codemap().span_allows_unstable(span) {
+            debug!("stability: \
+                    skipping span={:?} since it is internal", span);
             return;
         }
+
+        let lint_deprecated = |note: Option<Symbol>| {
+            let msg = if let Some(note) = note {
+                format!("use of deprecated item: {}", note)
+            } else {
+                format!("use of deprecated item")
+            };
+
+            self.sess.add_lint(lint::builtin::DEPRECATED, id, span, msg);
+        };
+
+        // Deprecated attributes apply in-crate and cross-crate.
+        if let Some(depr_entry) = self.lookup_deprecation_entry(def_id) {
+            let skip = if id == ast::DUMMY_NODE_ID {
+                true
+            } else {
+                let parent_def_id = self.map.local_def_id(self.map.get_parent(id));
+                self.lookup_deprecation_entry(parent_def_id).map_or(false, |parent_depr| {
+                    parent_depr.same_origin(&depr_entry)
+                })
+            };
+
+            if !skip {
+                lint_deprecated(depr_entry.attr.note);
+            }
+        }
+
+        let is_staged_api = *self.stability.borrow_mut().staged_api.entry(def_id.krate)
+            .or_insert_with(|| self.sess.cstore.is_staged_api(def_id.krate));
+        if !is_staged_api {
+            return;
+        }
+
+        let stability = self.lookup_stability(def_id);
+        debug!("stability: \
+                inspecting def_id={:?} span={:?} of stability={:?}", def_id, span, stability);
+
+        if let Some(&Stability{rustc_depr: Some(attr::RustcDeprecation { reason, .. }), ..})
+                = stability {
+            if id != ast::DUMMY_NODE_ID {
+                lint_deprecated(Some(reason));
+            }
+        }
+
         // Only the cross-crate scenario matters when checking unstable APIs
-        let cross_crate = !id.is_local();
+        let cross_crate = !def_id.is_local();
         if !cross_crate {
             return
         }
 
-        match *stab {
-            Some(&Stability { level: attr::Unstable {ref reason, issue}, ref feature, .. }) => {
-                self.used_features.insert(feature.clone(),
-                                          attr::Unstable { reason: reason.clone(), issue: issue });
+        if let Some(&Stability { ref level, ref feature, .. }) = stability {
+            self.stability.borrow_mut().used_features.insert(feature.clone(), level.clone());
+        }
 
-                if !self.active_features.contains(feature) {
+        match stability {
+            Some(&Stability { level: attr::Unstable {ref reason, issue}, ref feature, .. }) => {
+                if !self.stability.borrow().active_features.contains(feature) {
                     let msg = match *reason {
                         Some(ref r) => format!("use of unstable library feature '{}': {}",
                                                &feature.as_str(), &r),
                         None => format!("use of unstable library feature '{}'", &feature)
                     };
-                    emit_feature_err(&self.tcx.sess.parse_sess, &feature.as_str(), span,
+                    emit_feature_err(&self.sess.parse_sess, &feature.as_str(), span,
                                      GateIssue::Library(Some(issue)), &msg);
                 }
             }
-            Some(&Stability { ref level, ref feature, .. }) => {
-                self.used_features.insert(feature.clone(), level.clone());
-
+            Some(_) => {
                 // Stable APIs are always ok to call and deprecated APIs are
-                // handled by a lint.
+                // handled by the lint emitting logic above.
             }
             None => {
                 // This is an 'unmarked' API, which should not exist
                 // in the standard library.
-                if self.tcx.sess.features.borrow().unmarked_api {
-                    self.tcx.sess.struct_span_warn(span, "use of unmarked library feature")
-                                 .span_note(span, "this is either a bug in the library you are \
-                                                   using or a bug in the compiler - please \
-                                                   report it in both places")
-                                 .emit()
+                if self.sess.features.borrow().unmarked_api {
+                    self.sess.struct_span_warn(span, "use of unmarked library feature")
+                             .span_note(span, "this is either a bug in the library you are \
+                                               using or a bug in the compiler - please \
+                                               report it in both places")
+                             .emit()
                 } else {
-                    self.tcx.sess.struct_span_err(span, "use of unmarked library feature")
-                                 .span_note(span, "this is either a bug in the library you are \
-                                                   using or a bug in the compiler - please \
-                                                   report it in both places")
-                                 .span_note(span, "use #![feature(unmarked_api)] in the \
-                                                   crate attributes to override this")
-                                 .emit()
+                    self.sess.struct_span_err(span, "use of unmarked library feature")
+                             .span_note(span, "this is either a bug in the library you are \
+                                               using or a bug in the compiler - please \
+                                               report it in both places")
+                             .span_note(span, "use #![feature(unmarked_api)] in the \
+                                               crate attributes to override this")
+                             .emit()
                 }
             }
         }
@@ -436,249 +534,55 @@ impl<'a, 'tcx> Checker<'a, 'tcx> {
 }
 
 impl<'a, 'tcx> Visitor<'tcx> for Checker<'a, 'tcx> {
-    /// Because stability levels are scoped lexically, we want to walk
-    /// nested items in the context of the outer item, so enable
-    /// deep-walking.
-    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
-        Some(&self.tcx.map)
-    }
-
     fn visit_item(&mut self, item: &'tcx hir::Item) {
-        // When compiling with --test we don't enforce stability on the
-        // compiler-generated test module, demarcated with `DUMMY_SP` plus the
-        // name `__test`
-        if item.span == DUMMY_SP && item.name == "__test" { return }
-
-        check_item(self.tcx, item, true,
-                   &mut |id, sp, stab, depr| self.check(id, sp, stab, depr));
-        intravisit::walk_item(self, item);
-    }
-
-    fn visit_expr(&mut self, ex: &'tcx hir::Expr) {
-        check_expr(self.tcx, ex,
-                   &mut |id, sp, stab, depr| self.check(id, sp, stab, depr));
-        intravisit::walk_expr(self, ex);
-    }
-
-    fn visit_path(&mut self, path: &'tcx hir::Path, _: ast::NodeId) {
-        check_path(self.tcx, path,
-                   &mut |id, sp, stab, depr| self.check(id, sp, stab, depr));
-        intravisit::walk_path(self, path)
-    }
-
-    fn visit_pat(&mut self, pat: &'tcx hir::Pat) {
-        check_pat(self.tcx, pat,
-                  &mut |id, sp, stab, depr| self.check(id, sp, stab, depr));
-        intravisit::walk_pat(self, pat)
-    }
-
-    fn visit_ty(&mut self, ty: &'tcx hir::Ty) {
-        check_ty(self.tcx, ty,
-                 &mut |id, sp, stab, depr| self.check(id, sp, stab, depr));
-        intravisit::walk_ty(self, ty)
-    }
-}
-
-/// Helper for discovering nodes to check for stability
-pub fn check_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
-                            item: &hir::Item,
-                            warn_about_defns: bool,
-                            cb: &mut FnMut(DefId, Span,
-                                           &Option<&Stability>,
-                                           &Option<DeprecationEntry>)) {
-    match item.node {
-        hir::ItemExternCrate(_) => {
-            // compiler-generated `extern crate` items have a dummy span.
-            if item.span == DUMMY_SP { return }
-
-            let cnum = match tcx.sess.cstore.extern_mod_stmt_cnum(item.id) {
-                Some(cnum) => cnum,
-                None => return,
-            };
-            let id = DefId { krate: cnum, index: CRATE_DEF_INDEX };
-            maybe_do_stability_check(tcx, id, item.span, cb);
-        }
-
-        // For implementations of traits, check the stability of each item
-        // individually as it's possible to have a stable trait with unstable
-        // items.
-        hir::ItemImpl(.., Some(ref t), _, ref impl_item_refs) => {
-            let trait_did = t.path.def.def_id();
-            for impl_item_ref in impl_item_refs {
-                let impl_item = tcx.map.impl_item(impl_item_ref.id);
-                let item = tcx.associated_items(trait_did)
-                    .find(|item| item.name == impl_item.name).unwrap();
-                if warn_about_defns {
-                    maybe_do_stability_check(tcx, item.def_id, impl_item.span, cb);
-                }
+        match item.node {
+            hir::ItemExternCrate(_) => {
+                // compiler-generated `extern crate` items have a dummy span.
+                if item.span == DUMMY_SP { return }
+
+                let cnum = match self.tcx.sess.cstore.extern_mod_stmt_cnum(item.id) {
+                    Some(cnum) => cnum,
+                    None => return,
+                };
+                let def_id = DefId { krate: cnum, index: CRATE_DEF_INDEX };
+                self.tcx.check_stability(def_id, item.id, item.span);
             }
-        }
 
-        _ => (/* pass */)
-    }
-}
-
-/// Helper for discovering nodes to check for stability
-pub fn check_expr<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, e: &hir::Expr,
-                            cb: &mut FnMut(DefId, Span,
-                                           &Option<&Stability>,
-                                           &Option<DeprecationEntry>)) {
-    let span;
-    let id = match e.node {
-        hir::ExprMethodCall(i, ..) => {
-            span = i.span;
-            let method_call = ty::MethodCall::expr(e.id);
-            tcx.tables().method_map[&method_call].def_id
-        }
-        hir::ExprPath(ref qpath @ hir::QPath::TypeRelative(..)) => {
-            span = e.span;
-            tcx.tables().qpath_def(qpath, e.id).def_id()
-        }
-        hir::ExprField(ref base_e, ref field) => {
-            span = field.span;
-            match tcx.tables().expr_ty_adjusted(base_e).sty {
-                ty::TyAdt(def, _) => {
-                    def.struct_variant().field_named(field.node).did
-                }
-                _ => span_bug!(e.span,
-                               "stability::check_expr: named field access on non-ADT")
-            }
-        }
-        hir::ExprTupField(ref base_e, ref field) => {
-            span = field.span;
-            match tcx.tables().expr_ty_adjusted(base_e).sty {
-                ty::TyAdt(def, _) => {
-                    def.struct_variant().fields[field.node].did
-                }
-                ty::TyTuple(..) => return,
-                _ => span_bug!(e.span,
-                               "stability::check_expr: unnamed field access on \
-                                something other than a tuple or struct")
-            }
-        }
-        hir::ExprStruct(_, ref expr_fields, _) => {
-            match tcx.tables().expr_ty(e).sty {
-                ty::TyAdt(adt, ..) => match adt.adt_kind() {
-                    AdtKind::Struct | AdtKind::Union => {
-                        // check the stability of each field that appears
-                        // in the construction expression.
-                        for field in expr_fields {
-                            let did = adt.struct_variant().field_named(field.name.node).did;
-                            maybe_do_stability_check(tcx, did, field.span, cb);
+            // For implementations of traits, check the stability of each item
+            // individually as it's possible to have a stable trait with unstable
+            // items.
+            hir::ItemImpl(.., Some(ref t), _, ref impl_item_refs) => {
+                if let Def::Trait(trait_did) = t.path.def {
+                    for impl_item_ref in impl_item_refs {
+                        let impl_item = self.tcx.map.impl_item(impl_item_ref.id);
+                        let trait_item_def_id = self.tcx.associated_items(trait_did)
+                            .find(|item| item.name == impl_item.name).map(|item| item.def_id);
+                        if let Some(def_id) = trait_item_def_id {
+                            // Pass `DUMMY_NODE_ID` to skip deprecation warnings.
+                            self.tcx.check_stability(def_id, ast::DUMMY_NODE_ID, impl_item.span);
                         }
-
-                        // we're done.
-                        return
                     }
-                    AdtKind::Enum => {
-                        // we don't look at stability attributes on
-                        // struct-like enums (yet...), but it's definitely not
-                        // a bug to have construct one.
-                        return
-                    }
-                },
-                ref ty => span_bug!(e.span, "stability::check_expr: struct \
-                                         construction of non-ADT type: {:?}", ty)
+                }
             }
-        }
-        _ => return
-    };
-
-    maybe_do_stability_check(tcx, id, span, cb);
-}
 
-pub fn check_path<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
-                            path: &hir::Path,
-                            cb: &mut FnMut(DefId, Span,
-                                           &Option<&Stability>,
-                                           &Option<DeprecationEntry>)) {
-    match path.def {
-        Def::PrimTy(..) | Def::SelfTy(..) | Def::Err => {}
-        _ => maybe_do_stability_check(tcx, path.def.def_id(), path.span, cb)
-    }
-}
-
-pub fn check_pat<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, pat: &hir::Pat,
-                           cb: &mut FnMut(DefId, Span,
-                                          &Option<&Stability>,
-                                          &Option<DeprecationEntry>)) {
-    debug!("check_pat(pat = {:?})", pat);
-    if is_internal(tcx, pat.span) { return; }
-
-    if let PatKind::Path(ref qpath @ hir::QPath::TypeRelative(..)) = pat.node {
-        let def_id = tcx.tables().qpath_def(qpath, pat.id).def_id();
-        maybe_do_stability_check(tcx, def_id, pat.span, cb)
-    }
-
-    let v = match tcx.tables().pat_ty_opt(pat).map(|ty| &ty.sty) {
-        Some(&ty::TyAdt(adt, _)) if !adt.is_enum() => adt.struct_variant(),
-        _ => return,
-    };
-    match pat.node {
-        // Foo(a, b, c)
-        PatKind::TupleStruct(_, ref pat_fields, ddpos) => {
-            for (i, field) in pat_fields.iter().enumerate_and_adjust(v.fields.len(), ddpos) {
-                maybe_do_stability_check(tcx, v.fields[i].did, field.span, cb)
-            }
-        }
-        // Foo { a, b, c }
-        PatKind::Struct(_, ref pat_fields, _) => {
-            for field in pat_fields {
-                let did = v.field_named(field.node.name).did;
-                maybe_do_stability_check(tcx, did, field.span, cb);
-            }
+            _ => (/* pass */)
         }
-        // everything else is fine.
-        _ => {}
+        intravisit::walk_item(self, item);
     }
-}
-
-pub fn check_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty: &hir::Ty,
-                          cb: &mut FnMut(DefId, Span,
-                                         &Option<&Stability>,
-                                         &Option<DeprecationEntry>)) {
-    debug!("check_ty(ty = {:?})", ty);
-    if is_internal(tcx, ty.span) { return; }
 
-    if let hir::TyPath(hir::QPath::TypeRelative(..)) = ty.node {
-        let def_id = tcx.tables().type_relative_path_defs[&ty.id].def_id();
-        maybe_do_stability_check(tcx, def_id, ty.span, cb);
+    fn visit_path(&mut self, path: &'tcx hir::Path, id: ast::NodeId) {
+        match path.def {
+            Def::PrimTy(..) | Def::SelfTy(..) | Def::Err => {}
+            _ => self.tcx.check_stability(path.def.def_id(), id, path.span)
+        }
+        intravisit::walk_path(self, path)
     }
 }
 
-fn maybe_do_stability_check<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
-                                      id: DefId, span: Span,
-                                      cb: &mut FnMut(DefId, Span,
-                                                     &Option<&Stability>,
-                                                     &Option<DeprecationEntry>)) {
-    if is_internal(tcx, span) {
-        debug!("maybe_do_stability_check: \
-                skipping span={:?} since it is internal", span);
-        return;
-    }
-    let (stability, deprecation) = if is_staged_api(tcx, id) {
-        (tcx.lookup_stability(id), None)
-    } else {
-        (None, tcx.lookup_deprecation_entry(id))
-    };
-    debug!("maybe_do_stability_check: \
-            inspecting id={:?} span={:?} of stability={:?}", id, span, stability);
-    cb(id, span, &stability, &deprecation);
-}
-
-fn is_internal<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, span: Span) -> bool {
-    tcx.sess.codemap().span_allows_unstable(span)
-}
-
-fn is_staged_api<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, id: DefId) -> bool {
-    *tcx.stability.borrow_mut().staged_api.entry(id.krate).or_insert_with(
-        || tcx.sess.cstore.is_staged_api(id.krate))
-}
-
-impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {
+impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
     /// Lookup the stability for a node, loading external crate
     /// metadata as necessary.
-    pub fn lookup_stability(self, id: DefId) -> Option<&'tcx Stability> {
+    pub fn lookup_stability(self, id: DefId) -> Option<&'gcx Stability> {
         if let Some(st) = self.stability.borrow().stab_map.get(&id) {
             return *st;
         }
@@ -702,7 +606,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {
         depr
     }
 
-    fn lookup_stability_uncached(self, id: DefId) -> Option<&'tcx Stability> {
+    fn lookup_stability_uncached(self, id: DefId) -> Option<&'gcx Stability> {
         debug!("lookup(id={:?})", id);
         if id.is_local() {
             None // The stability cache is filled partially lazily
@@ -724,9 +628,22 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {
 /// Given the list of enabled features that were not language features (i.e. that
 /// were expected to be library features), and the list of features used from
 /// libraries, identify activated features that don't exist and error about them.
-pub fn check_unused_or_stable_features(sess: &Session,
-                                       lib_features_used: &FxHashMap<Symbol,
-                                                                     attr::StabilityLevel>) {
+pub fn check_unused_or_stable_features<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
+                                                 access_levels: &AccessLevels) {
+    let sess = &tcx.sess;
+
+    if tcx.stability.borrow().staged_api[&LOCAL_CRATE] && tcx.sess.features.borrow().staged_api {
+        let _task = tcx.dep_graph.in_task(DepNode::StabilityIndex);
+        let krate = tcx.map.krate();
+        let mut missing = MissingStabilityAnnotations {
+            tcx: tcx,
+            access_levels: access_levels,
+        };
+        missing.check_missing_stability(ast::CRATE_NODE_ID, krate.span);
+        intravisit::walk_crate(&mut missing, krate);
+        krate.visit_all_item_likes(&mut DeepVisitor::new(&mut missing));
+    }
+
     let ref declared_lib_features = sess.features.borrow().declared_lib_features;
     let mut remaining_lib_features: FxHashMap<Symbol, Span>
         = declared_lib_features.clone().into_iter().collect();
@@ -744,7 +661,8 @@ pub fn check_unused_or_stable_features(sess: &Session,
                       format_stable_since_msg(version));
     }
 
-    for (used_lib_feature, level) in lib_features_used {
+    let index = tcx.stability.borrow();
+    for (used_lib_feature, level) in &index.used_features {
         match remaining_lib_features.remove(used_lib_feature) {
             Some(span) => {
                 if let &attr::StabilityLevel::Stable { since: ref version } = level {
diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs
index 0b148771f4f..7dc71f8189b 100644
--- a/src/librustc_driver/driver.rs
+++ b/src/librustc_driver/driver.rs
@@ -886,6 +886,14 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
              "load_dep_graph",
              || rustc_incremental::load_dep_graph(tcx, &incremental_hashes_map));
 
+        time(time_passes, "stability index", || {
+            tcx.stability.borrow_mut().build(tcx)
+        });
+
+        time(time_passes,
+             "stability checking",
+             || stability::check_unstable_api_usage(tcx));
+
         // passes are timed inside typeck
         analysis.hir_ty_to_ty =
             try_with_f!(typeck::check_crate(tcx), (tcx, analysis, incremental_hashes_map));
@@ -899,11 +907,6 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
                 rustc_privacy::check_crate(tcx, &analysis.export_map)
             });
 
-        // Do not move this check past lint
-        time(time_passes, "stability index", || {
-            tcx.stability.borrow_mut().build(tcx, &analysis.access_levels)
-        });
-
         time(time_passes,
              "intrinsic checking",
              || middle::intrinsicck::check_crate(tcx));
@@ -972,14 +975,8 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
             middle::dead::check_crate(tcx, &analysis.access_levels);
         });
 
-        let ref lib_features_used =
-            time(time_passes,
-                 "stability checking",
-                 || stability::check_unstable_api_usage(tcx));
-
         time(time_passes, "unused lib feature checking", || {
-            stability::check_unused_or_stable_features(&tcx.sess,
-                                                       lib_features_used)
+            stability::check_unused_or_stable_features(tcx, &analysis.access_levels)
         });
 
         time(time_passes,
diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs
index 490b0028d74..f14fa7d4fdc 100644
--- a/src/librustc_lint/builtin.rs
+++ b/src/librustc_lint/builtin.rs
@@ -30,14 +30,13 @@
 
 use rustc::hir::def::Def;
 use rustc::hir::def_id::DefId;
-use middle::stability;
 use rustc::cfg;
 use rustc::ty::subst::Substs;
 use rustc::ty::{self, Ty, TyCtxt};
 use rustc::traits::{self, Reveal};
 use rustc::hir::map as hir_map;
 use util::nodemap::NodeSet;
-use lint::{Level, LateContext, LintContext, LintArray, Lint};
+use lint::{Level, LateContext, LintContext, LintArray};
 use lint::{LintPass, LateLintPass, EarlyLintPass, EarlyContext};
 
 use std::collections::HashSet;
@@ -45,7 +44,6 @@ use std::collections::HashSet;
 use syntax::ast;
 use syntax::attr;
 use syntax::feature_gate::{AttributeGate, AttributeType, Stability, deprecated_attributes};
-use syntax::symbol::Symbol;
 use syntax_pos::Span;
 
 use rustc::hir::{self, PatKind};
@@ -608,139 +606,6 @@ impl LateLintPass for MissingDebugImplementations {
 }
 
 declare_lint! {
-    DEPRECATED,
-    Warn,
-    "detects use of deprecated items"
-}
-
-/// Checks for use of items with `#[deprecated]` or `#[rustc_deprecated]` attributes
-#[derive(Clone)]
-pub struct Deprecated {
-    /// Tracks the `NodeId` of the current item.
-    ///
-    /// This is required since not all node ids are present in the hir map.
-    current_item: ast::NodeId,
-}
-
-impl Deprecated {
-    pub fn new() -> Deprecated {
-        Deprecated { current_item: ast::CRATE_NODE_ID }
-    }
-
-    fn lint(&self,
-            cx: &LateContext,
-            _id: DefId,
-            span: Span,
-            stability: &Option<&attr::Stability>,
-            deprecation: &Option<stability::DeprecationEntry>) {
-        // Deprecated attributes apply in-crate and cross-crate.
-        if let Some(&attr::Stability{rustc_depr: Some(attr::RustcDeprecation{reason, ..}), ..})
-                = *stability {
-            output(cx, DEPRECATED, span, Some(reason))
-        } else if let Some(ref depr_entry) = *deprecation {
-            if let Some(parent_depr) = cx.tcx.lookup_deprecation_entry(self.parent_def(cx)) {
-                if parent_depr.same_origin(depr_entry) {
-                    return;
-                }
-            }
-
-            output(cx, DEPRECATED, span, depr_entry.attr.note)
-        }
-
-        fn output(cx: &LateContext, lint: &'static Lint, span: Span, note: Option<Symbol>) {
-            let msg = if let Some(note) = note {
-                format!("use of deprecated item: {}", note)
-            } else {
-                format!("use of deprecated item")
-            };
-
-            cx.span_lint(lint, span, &msg);
-        }
-    }
-
-    fn push_item(&mut self, item_id: ast::NodeId) {
-        self.current_item = item_id;
-    }
-
-    fn item_post(&mut self, cx: &LateContext, item_id: ast::NodeId) {
-        assert_eq!(self.current_item, item_id);
-        self.current_item = cx.tcx.map.get_parent(item_id);
-    }
-
-    fn parent_def(&self, cx: &LateContext) -> DefId {
-        cx.tcx.map.local_def_id(self.current_item)
-    }
-}
-
-impl LintPass for Deprecated {
-    fn get_lints(&self) -> LintArray {
-        lint_array!(DEPRECATED)
-    }
-}
-
-impl LateLintPass for Deprecated {
-    fn check_item(&mut self, cx: &LateContext, item: &hir::Item) {
-        self.push_item(item.id);
-        stability::check_item(cx.tcx,
-                              item,
-                              false,
-                              &mut |id, sp, stab, depr| self.lint(cx, id, sp, &stab, &depr));
-    }
-
-    fn check_item_post(&mut self, cx: &LateContext, item: &hir::Item) {
-        self.item_post(cx, item.id);
-    }
-
-    fn check_expr(&mut self, cx: &LateContext, e: &hir::Expr) {
-        stability::check_expr(cx.tcx,
-                              e,
-                              &mut |id, sp, stab, depr| self.lint(cx, id, sp, &stab, &depr));
-    }
-
-    fn check_path(&mut self, cx: &LateContext, path: &hir::Path, _: ast::NodeId) {
-        stability::check_path(cx.tcx,
-                              path,
-                              &mut |id, sp, stab, depr| self.lint(cx, id, sp, &stab, &depr));
-    }
-
-    fn check_pat(&mut self, cx: &LateContext, pat: &hir::Pat) {
-        stability::check_pat(cx.tcx,
-                             pat,
-                             &mut |id, sp, stab, depr| self.lint(cx, id, sp, &stab, &depr));
-    }
-
-    fn check_ty(&mut self, cx: &LateContext, ty: &hir::Ty) {
-        stability::check_ty(cx.tcx, ty,
-                            &mut |id, sp, stab, depr|
-                               self.lint(cx, id, sp, &stab, &depr));
-    }
-
-    fn check_impl_item(&mut self, _: &LateContext, item: &hir::ImplItem) {
-        self.push_item(item.id);
-    }
-
-    fn check_impl_item_post(&mut self, cx: &LateContext, item: &hir::ImplItem) {
-        self.item_post(cx, item.id);
-    }
-
-    fn check_trait_item(&mut self, _: &LateContext, item: &hir::TraitItem) {
-        self.push_item(item.id);
-    }
-
-    fn check_trait_item_post(&mut self, cx: &LateContext, item: &hir::TraitItem) {
-        self.item_post(cx, item.id);
-    }
-
-    fn check_foreign_item(&mut self, _: &LateContext, item: &hir::ForeignItem) {
-        self.push_item(item.id);
-    }
-
-    fn check_foreign_item_post(&mut self, cx: &LateContext, item: &hir::ForeignItem) {
-        self.item_post(cx, item.id);
-    }
-}
-
-declare_lint! {
     DEPRECATED_ATTR,
     Warn,
     "detects use of deprecated attributes"
diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs
index 0b92107c817..ec0a124770c 100644
--- a/src/librustc_lint/lib.rs
+++ b/src/librustc_lint/lib.rs
@@ -145,7 +145,6 @@ pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) {
                  );
 
     add_builtin_with_new!(sess,
-                          Deprecated,
                           TypeLimits,
                           MissingDoc,
                           MissingDebugImplementations,
diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs
index 646f941deae..8a8b3434294 100644
--- a/src/librustc_typeck/astconv.rs
+++ b/src/librustc_typeck/astconv.rs
@@ -1258,6 +1258,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
     // Will fail except for T::A and Self::A; i.e., if ty/ty_path_def are not a type
     // parameter or Self.
     pub fn associated_path_def_to_ty(&self,
+                                     ref_id: ast::NodeId,
                                      span: Span,
                                      ty: Ty<'tcx>,
                                      ty_path_def: Def,
@@ -1339,7 +1340,9 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
         let ty = self.projected_ty_from_poly_trait_ref(span, bound, assoc_name);
 
         let item = tcx.associated_items(trait_did).find(|i| i.name == assoc_name);
-        (ty, Def::AssociatedTy(item.expect("missing associated type").def_id))
+        let def_id = item.expect("missing associated type").def_id;
+        tcx.check_stability(def_id, ref_id, span);
+        (ty, Def::AssociatedTy(def_id))
     }
 
     fn qpath_to_ty(&self,
@@ -1659,7 +1662,8 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
                 } else {
                     Def::Err
                 };
-                let (ty, def) = self.associated_path_def_to_ty(ast_ty.span, ty, def, segment);
+                let (ty, def) = self.associated_path_def_to_ty(ast_ty.id, ast_ty.span,
+                                                               ty, def, segment);
 
                 // Write back the new resolution.
                 tcx.tables.borrow_mut().type_relative_path_defs.insert(ast_ty.id, def);
diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs
index 9381d653ed2..63e797a87ff 100644
--- a/src/librustc_typeck/check/_match.rs
+++ b/src/librustc_typeck/check/_match.rs
@@ -508,7 +508,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
         self.demand_eqtype(pat.span, expected, pat_ty);
 
         // Type check subpatterns.
-        self.check_struct_pat_fields(pat_ty, pat.span, variant, fields, etc);
+        self.check_struct_pat_fields(pat_ty, pat.id, pat.span, variant, fields, etc);
         pat_ty
     }
 
@@ -603,6 +603,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
             for (i, subpat) in subpats.iter().enumerate_and_adjust(variant.fields.len(), ddpos) {
                 let field_ty = self.field_ty(subpat.span, &variant.fields[i], substs);
                 self.check_pat(&subpat, field_ty);
+
+                self.tcx.check_stability(variant.fields[i].did, pat.id, subpat.span);
             }
         } else {
             let subpats_ending = if subpats.len() == 1 { "" } else { "s" };
@@ -622,6 +624,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
 
     fn check_struct_pat_fields(&self,
                                adt_ty: Ty<'tcx>,
+                               pat_id: ast::NodeId,
                                span: Span,
                                variant: ty::VariantDef<'tcx>,
                                fields: &'gcx [Spanned<hir::FieldPat>],
@@ -659,7 +662,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
                 Vacant(vacant) => {
                     vacant.insert(span);
                     field_map.get(&field.name)
-                        .map(|f| self.field_ty(span, f, substs))
+                        .map(|f| {
+                            self.tcx.check_stability(f.did, pat_id, span);
+
+                            self.field_ty(span, f, substs)
+                        })
                         .unwrap_or_else(|| {
                             struct_span_err!(tcx.sess, span, E0026,
                                              "{} `{}` does not have a field named `{}`",
diff --git a/src/librustc_typeck/check/method/mod.rs b/src/librustc_typeck/check/method/mod.rs
index bd34e993e1e..f2dcc174d55 100644
--- a/src/librustc_typeck/check/method/mod.rs
+++ b/src/librustc_typeck/check/method/mod.rs
@@ -136,6 +136,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
             self.tcx.used_trait_imports.borrow_mut().insert(import_id);
         }
 
+        self.tcx.check_stability(pick.item.def_id, call_expr.id, span);
+
         Ok(self.confirm_method(span,
                                self_expr,
                                call_expr,
@@ -340,6 +342,9 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
         }
 
         let def = pick.item.def();
+
+        self.tcx.check_stability(def.def_id(), expr_id, span);
+
         if let probe::InherentImplPick = pick.kind {
             if !pick.item.vis.is_accessible_from(self.body_id, &self.tcx.map) {
                 let msg = format!("{} `{}` is private", def.kind_name(), method_name);
diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs
index f803262a0ec..76bd961ebd2 100644
--- a/src/librustc_typeck/check/mod.rs
+++ b/src/librustc_typeck/check/mod.rs
@@ -2998,6 +2998,9 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
                         if field.vis.is_accessible_from(self.body_id, &self.tcx().map) {
                             autoderef.finalize(lvalue_pref, Some(base));
                             self.write_autoderef_adjustment(base.id, autoderefs, base_t);
+
+                            self.tcx.check_stability(field.did, expr.id, expr.span);
+
                             return field_ty;
                         }
                         private_candidate = Some((base_def.did, field_ty));
@@ -3100,6 +3103,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
                         let field_ty = self.field_ty(expr.span, field, substs);
                         private_candidate = Some((base_def.did, field_ty));
                         if field.vis.is_accessible_from(self.body_id, &self.tcx().map) {
+                            self.tcx.check_stability(field.did, expr.id, expr.span);
                             Some(field_ty)
                         } else {
                             None
@@ -3192,13 +3196,14 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
 
     fn check_expr_struct_fields(&self,
                                 adt_ty: Ty<'tcx>,
+                                expr_id: ast::NodeId,
                                 span: Span,
                                 variant: ty::VariantDef<'tcx>,
                                 ast_fields: &'gcx [hir::Field],
                                 check_completeness: bool) {
         let tcx = self.tcx;
-        let (substs, kind_name) = match adt_ty.sty {
-            ty::TyAdt(adt, substs) => (substs, adt.variant_descr()),
+        let (substs, adt_kind, kind_name) = match adt_ty.sty {
+            ty::TyAdt(adt, substs) => (substs, adt.adt_kind(), adt.variant_descr()),
             _ => span_bug!(span, "non-ADT passed to check_expr_struct_fields")
         };
 
@@ -3219,6 +3224,13 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
                 expected_field_type = self.field_ty(field.span, v_field, substs);
 
                 seen_fields.insert(field.name.node, field.span);
+
+                // we don't look at stability attributes on
+                // struct-like enums (yet...), but it's definitely not
+                // a bug to have construct one.
+                if adt_kind != ty::AdtKind::Enum {
+                    tcx.check_stability(v_field.did, expr_id, field.span);
+                }
             } else {
                 error_happened = true;
                 expected_field_type = tcx.types.err;
@@ -3381,7 +3393,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
             hir::QPath::TypeRelative(ref qself, _) => qself.span
         };
 
-        self.check_expr_struct_fields(struct_ty, path_span, variant, fields,
+        self.check_expr_struct_fields(struct_ty, expr.id, path_span, variant, fields,
                                       base_expr.is_none());
         if let &Some(ref base_expr) = base_expr {
             self.check_expr_has_type(base_expr, struct_ty);
@@ -4012,7 +4024,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
                 } else {
                     Def::Err
                 };
-                let (ty, def) = AstConv::associated_path_def_to_ty(self, path_span,
+                let (ty, def) = AstConv::associated_path_def_to_ty(self, node_id, path_span,
                                                                    ty, def, segment);
 
                 // Write back the new resolution.
diff --git a/src/libsyntax/test.rs b/src/libsyntax/test.rs
index 4de3baf7d14..fca89e265e4 100644
--- a/src/libsyntax/test.rs
+++ b/src/libsyntax/test.rs
@@ -307,7 +307,7 @@ fn generate_test_harness(sess: &ParseSess,
 /// The expanded code calls some unstable functions in the test crate.
 fn ignored_span(cx: &TestCtxt, sp: Span) -> Span {
     let info = ExpnInfo {
-        call_site: DUMMY_SP,
+        call_site: sp,
         callee: NameAndSpan {
             format: MacroAttribute(Symbol::intern("test")),
             span: None,
@@ -460,6 +460,7 @@ mod __test {
 
 fn mk_std(cx: &TestCtxt) -> P<ast::Item> {
     let id_test = Ident::from_str("test");
+    let sp = ignored_span(cx, DUMMY_SP);
     let (vi, vis, ident) = if cx.is_test_crate {
         (ast::ItemKind::Use(
             P(nospan(ast::ViewPathSimple(id_test,
@@ -474,7 +475,7 @@ fn mk_std(cx: &TestCtxt) -> P<ast::Item> {
         node: vi,
         attrs: vec![],
         vis: vis,
-        span: DUMMY_SP
+        span: sp
     })
 }
 
@@ -598,7 +599,7 @@ fn mk_tests(cx: &TestCtxt) -> P<ast::Item> {
     // FIXME #15962: should be using quote_item, but that stringifies
     // __test_reexports, causing it to be reinterned, losing the
     // gensym information.
-    let sp = DUMMY_SP;
+    let sp = ignored_span(cx, DUMMY_SP);
     let ecx = &cx.ext_cx;
     let struct_type = ecx.ty_path(ecx.path(sp, vec![ecx.ident_of("self"),
                                                     ecx.ident_of("test"),
diff --git a/src/test/compile-fail-fulldeps/dropck_tarena_cycle_checked.rs b/src/test/compile-fail-fulldeps/dropck_tarena_cycle_checked.rs
index bbdc59c8431..7de6e58c784 100644
--- a/src/test/compile-fail-fulldeps/dropck_tarena_cycle_checked.rs
+++ b/src/test/compile-fail-fulldeps/dropck_tarena_cycle_checked.rs
@@ -16,7 +16,7 @@
 //  which is a reduction of this code to more directly show the reason
 //  for the error message we see here.)
 
-#![feature(const_fn)]
+#![feature(const_fn, rustc_private)]
 
 extern crate arena;
 
diff --git a/src/test/compile-fail-fulldeps/dropck_tarena_unsound_drop.rs b/src/test/compile-fail-fulldeps/dropck_tarena_unsound_drop.rs
index 46cb7605574..30829847a3a 100644
--- a/src/test/compile-fail-fulldeps/dropck_tarena_unsound_drop.rs
+++ b/src/test/compile-fail-fulldeps/dropck_tarena_unsound_drop.rs
@@ -19,6 +19,8 @@
 // (Also compare against dropck_tarena_cycle_checked.rs, from which
 // this was reduced to better understand its error message.)
 
+#![feature(rustc_private)]
+
 extern crate arena;
 
 use arena::TypedArena;
diff --git a/src/test/compile-fail-fulldeps/proc-macro/at-the-root.rs b/src/test/compile-fail-fulldeps/proc-macro/at-the-root.rs
index b03e1e4f919..bb7478d9a5f 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/at-the-root.rs
+++ b/src/test/compile-fail-fulldeps/proc-macro/at-the-root.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 #![crate_type = "proc-macro"]
-#![feature(proc_macro)]
+#![feature(proc_macro, proc_macro_lib)]
 
 extern crate proc_macro;
 
diff --git a/src/test/compile-fail-fulldeps/proc-macro/attribute.rs b/src/test/compile-fail-fulldeps/proc-macro/attribute.rs
index e22339694f9..abf11637631 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/attribute.rs
+++ b/src/test/compile-fail-fulldeps/proc-macro/attribute.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 #![crate_type = "proc-macro"]
-#![feature(proc_macro)]
+#![feature(proc_macro, proc_macro_lib)]
 
 extern crate proc_macro;
 
diff --git a/src/test/compile-fail-fulldeps/proc-macro/define-two.rs b/src/test/compile-fail-fulldeps/proc-macro/define-two.rs
index 420249b2581..bdb3c09c4d7 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/define-two.rs
+++ b/src/test/compile-fail-fulldeps/proc-macro/define-two.rs
@@ -11,7 +11,7 @@
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
-#![feature(proc_macro)]
+#![feature(proc_macro, proc_macro_lib)]
 
 extern crate proc_macro;
 
diff --git a/src/test/compile-fail-fulldeps/proc-macro/error-on-test.rs b/src/test/compile-fail-fulldeps/proc-macro/error-on-test.rs
index 1fd48f075de..4751679ddb8 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/error-on-test.rs
+++ b/src/test/compile-fail-fulldeps/proc-macro/error-on-test.rs
@@ -11,7 +11,7 @@
 // compile-flags: --test
 
 #![crate_type = "proc-macro"]
-#![feature(proc_macro)]
+#![feature(proc_macro, proc_macro_lib)]
 
 extern crate proc_macro;
 
diff --git a/src/test/compile-fail-fulldeps/proc-macro/illegal-proc-macro-derive-use.rs b/src/test/compile-fail-fulldeps/proc-macro/illegal-proc-macro-derive-use.rs
index 405994b36e2..70c8db5ddd2 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/illegal-proc-macro-derive-use.rs
+++ b/src/test/compile-fail-fulldeps/proc-macro/illegal-proc-macro-derive-use.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(proc_macro)]
+#![feature(proc_macro, proc_macro_lib)]
 
 extern crate proc_macro;
 
diff --git a/src/test/compile-fail-fulldeps/proc-macro/shadow-builtin.rs b/src/test/compile-fail-fulldeps/proc-macro/shadow-builtin.rs
index 5cb2cc59aab..1bcd4b15eb8 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/shadow-builtin.rs
+++ b/src/test/compile-fail-fulldeps/proc-macro/shadow-builtin.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 #![crate_type = "proc-macro"]
-#![feature(proc_macro)]
+#![feature(proc_macro, proc_macro_lib)]
 
 extern crate proc_macro;
 
diff --git a/src/test/compile-fail-fulldeps/proc-macro/signature.rs b/src/test/compile-fail-fulldeps/proc-macro/signature.rs
index 468c970599e..d9b19d1d85a 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/signature.rs
+++ b/src/test/compile-fail-fulldeps/proc-macro/signature.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 #![crate_type = "proc-macro"]
-#![feature(proc_macro)]
+#![feature(proc_macro, proc_macro_lib)]
 #![allow(warnings)]
 
 extern crate proc_macro;
diff --git a/src/test/compile-fail/E0254.rs b/src/test/compile-fail/E0254.rs
index 3e4b7b9cad2..fe7ee1c129f 100644
--- a/src/test/compile-fail/E0254.rs
+++ b/src/test/compile-fail/E0254.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(collections)]
+
 extern crate collections;
 //~^ NOTE previous import of `collections` here
 
diff --git a/src/test/compile-fail/E0259.rs b/src/test/compile-fail/E0259.rs
index d3e876e2527..95be48b5ff1 100644
--- a/src/test/compile-fail/E0259.rs
+++ b/src/test/compile-fail/E0259.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(collections, libc)]
+
 extern crate collections;
 //~^ NOTE previous import of `collections` here
 
diff --git a/src/test/compile-fail/E0260.rs b/src/test/compile-fail/E0260.rs
index 63647cb4103..ae018d2ada9 100644
--- a/src/test/compile-fail/E0260.rs
+++ b/src/test/compile-fail/E0260.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(collections)]
+
 extern crate collections;
 //~^ NOTE previous import of `collections` here
 
diff --git a/src/test/compile-fail/borrowck/borrowck-borrowed-uniq-rvalue.rs b/src/test/compile-fail/borrowck/borrowck-borrowed-uniq-rvalue.rs
index 8bbecfd48c6..e4eca7e7ece 100644
--- a/src/test/compile-fail/borrowck/borrowck-borrowed-uniq-rvalue.rs
+++ b/src/test/compile-fail/borrowck/borrowck-borrowed-uniq-rvalue.rs
@@ -12,7 +12,6 @@
 
 #![feature(box_syntax)]
 
-extern crate collections;
 use std::collections::HashMap;
 
 fn main() {
diff --git a/src/test/compile-fail/borrowck/borrowck-call-is-borrow-issue-12224.rs b/src/test/compile-fail/borrowck/borrowck-call-is-borrow-issue-12224.rs
index e4ae565fe92..ba1ae64ec33 100644
--- a/src/test/compile-fail/borrowck/borrowck-call-is-borrow-issue-12224.rs
+++ b/src/test/compile-fail/borrowck/borrowck-call-is-borrow-issue-12224.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(fn_traits)]
+
 // Ensure that invoking a closure counts as a unique immutable borrow
 
 type Fn<'a> = Box<FnMut() + 'a>;
diff --git a/src/test/compile-fail/borrowck/borrowck-insert-during-each.rs b/src/test/compile-fail/borrowck/borrowck-insert-during-each.rs
index 2c634865983..8499ebb8ac3 100644
--- a/src/test/compile-fail/borrowck/borrowck-insert-during-each.rs
+++ b/src/test/compile-fail/borrowck/borrowck-insert-during-each.rs
@@ -8,7 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern crate collections;
 use std::collections::HashSet;
 
 struct Foo {
diff --git a/src/test/compile-fail/borrowck/borrowck-overloaded-call.rs b/src/test/compile-fail/borrowck/borrowck-overloaded-call.rs
index 93c37524bf5..4c20688331b 100644
--- a/src/test/compile-fail/borrowck/borrowck-overloaded-call.rs
+++ b/src/test/compile-fail/borrowck/borrowck-overloaded-call.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(unboxed_closures)]
+#![feature(fn_traits, unboxed_closures)]
 
 use std::ops::{Fn, FnMut, FnOnce};
 
diff --git a/src/test/compile-fail/deriving-span-Clone-enum-struct-variant.rs b/src/test/compile-fail/derives-span-Clone-enum-struct-variant.rs
index 9badb5b262d..0b73f5bebb2 100644
--- a/src/test/compile-fail/deriving-span-Clone-enum-struct-variant.rs
+++ b/src/test/compile-fail/derives-span-Clone-enum-struct-variant.rs
@@ -1,4 +1,4 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -10,8 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-extern crate rand;
-
 
 struct Error;
 
diff --git a/src/test/compile-fail/deriving-span-Clone-enum.rs b/src/test/compile-fail/derives-span-Clone-enum.rs
index 6b71610778c..6944ea38b37 100644
--- a/src/test/compile-fail/deriving-span-Clone-enum.rs
+++ b/src/test/compile-fail/derives-span-Clone-enum.rs
@@ -1,4 +1,4 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -10,8 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-extern crate rand;
-
 
 struct Error;
 
diff --git a/src/test/compile-fail/deriving-span-Clone-struct.rs b/src/test/compile-fail/derives-span-Clone-struct.rs
index 845da771de8..92bf148ccbd 100644
--- a/src/test/compile-fail/deriving-span-Clone-struct.rs
+++ b/src/test/compile-fail/derives-span-Clone-struct.rs
@@ -1,4 +1,4 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -10,8 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-extern crate rand;
-
 
 struct Error;
 
diff --git a/src/test/compile-fail/deriving-span-Clone-tuple-struct.rs b/src/test/compile-fail/derives-span-Clone-tuple-struct.rs
index 698e5a79bef..21adfc90301 100644
--- a/src/test/compile-fail/deriving-span-Clone-tuple-struct.rs
+++ b/src/test/compile-fail/derives-span-Clone-tuple-struct.rs
@@ -1,4 +1,4 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -10,8 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-extern crate rand;
-
 
 struct Error;
 
diff --git a/src/test/compile-fail/deriving-span-Show-enum-struct-variant.rs b/src/test/compile-fail/derives-span-Debug-enum-struct-variant.rs
index 1d9099e8ed6..da777e8a14b 100644
--- a/src/test/compile-fail/deriving-span-Show-enum-struct-variant.rs
+++ b/src/test/compile-fail/derives-span-Debug-enum-struct-variant.rs
@@ -1,4 +1,4 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -10,8 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-extern crate rand;
-
 
 struct Error;
 
diff --git a/src/test/compile-fail/deriving-span-Show-enum.rs b/src/test/compile-fail/derives-span-Debug-enum.rs
index ab31ca95bdb..bf5d3f2d81b 100644
--- a/src/test/compile-fail/deriving-span-Show-enum.rs
+++ b/src/test/compile-fail/derives-span-Debug-enum.rs
@@ -1,4 +1,4 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -10,8 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-extern crate rand;
-
 
 struct Error;
 
diff --git a/src/test/compile-fail/deriving-span-Show-struct.rs b/src/test/compile-fail/derives-span-Debug-struct.rs
index eb8ac4649f2..b0b275fa2d3 100644
--- a/src/test/compile-fail/deriving-span-Show-struct.rs
+++ b/src/test/compile-fail/derives-span-Debug-struct.rs
@@ -1,4 +1,4 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -10,8 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-extern crate rand;
-
 
 struct Error;
 
diff --git a/src/test/compile-fail/deriving-span-Show-tuple-struct.rs b/src/test/compile-fail/derives-span-Debug-tuple-struct.rs
index b93db4ab535..9689054a7be 100644
--- a/src/test/compile-fail/deriving-span-Show-tuple-struct.rs
+++ b/src/test/compile-fail/derives-span-Debug-tuple-struct.rs
@@ -1,4 +1,4 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -10,8 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-extern crate rand;
-
 
 struct Error;
 
diff --git a/src/test/compile-fail/deriving-span-Default-struct.rs b/src/test/compile-fail/derives-span-Default-struct.rs
index 56fb3861173..68b99ed25b8 100644
--- a/src/test/compile-fail/deriving-span-Default-struct.rs
+++ b/src/test/compile-fail/derives-span-Default-struct.rs
@@ -1,4 +1,4 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -10,8 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-extern crate rand;
-
 
 struct Error;
 
diff --git a/src/test/compile-fail/deriving-span-Default-tuple-struct.rs b/src/test/compile-fail/derives-span-Default-tuple-struct.rs
index d0b9a7a3db9..822abe975a1 100644
--- a/src/test/compile-fail/deriving-span-Default-tuple-struct.rs
+++ b/src/test/compile-fail/derives-span-Default-tuple-struct.rs
@@ -1,4 +1,4 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -10,8 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-extern crate rand;
-
 
 struct Error;
 
diff --git a/src/test/compile-fail/deriving-span-TotalEq-enum-struct-variant.rs b/src/test/compile-fail/derives-span-Eq-enum-struct-variant.rs
index 6994aa76fff..fdc74d5fef6 100644
--- a/src/test/compile-fail/deriving-span-TotalEq-enum-struct-variant.rs
+++ b/src/test/compile-fail/derives-span-Eq-enum-struct-variant.rs
@@ -1,4 +1,4 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -10,8 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-extern crate rand;
-
 #[derive(PartialEq)]
 struct Error;
 
diff --git a/src/test/compile-fail/deriving-span-TotalEq-enum.rs b/src/test/compile-fail/derives-span-Eq-enum.rs
index 279368d64ab..4bf30fdf93f 100644
--- a/src/test/compile-fail/deriving-span-TotalEq-enum.rs
+++ b/src/test/compile-fail/derives-span-Eq-enum.rs
@@ -1,4 +1,4 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -10,8 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-extern crate rand;
-
 #[derive(PartialEq)]
 struct Error;
 
diff --git a/src/test/compile-fail/deriving-span-TotalEq-struct.rs b/src/test/compile-fail/derives-span-Eq-struct.rs
index 8672e8e050e..685188f1337 100644
--- a/src/test/compile-fail/deriving-span-TotalEq-struct.rs
+++ b/src/test/compile-fail/derives-span-Eq-struct.rs
@@ -1,4 +1,4 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -10,8 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-extern crate rand;
-
 #[derive(PartialEq)]
 struct Error;
 
diff --git a/src/test/compile-fail/deriving-span-TotalEq-tuple-struct.rs b/src/test/compile-fail/derives-span-Eq-tuple-struct.rs
index e79b3b97410..0e636d027dd 100644
--- a/src/test/compile-fail/deriving-span-TotalEq-tuple-struct.rs
+++ b/src/test/compile-fail/derives-span-Eq-tuple-struct.rs
@@ -1,4 +1,4 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -10,8 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-extern crate rand;
-
 #[derive(PartialEq)]
 struct Error;
 
diff --git a/src/test/compile-fail/deriving-span-Hash-enum-struct-variant.rs b/src/test/compile-fail/derives-span-Hash-enum-struct-variant.rs
index d9f4bfe1028..bfb6566223c 100644
--- a/src/test/compile-fail/deriving-span-Hash-enum-struct-variant.rs
+++ b/src/test/compile-fail/derives-span-Hash-enum-struct-variant.rs
@@ -1,4 +1,4 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -10,8 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-extern crate rand;
-
 
 struct Error;
 
diff --git a/src/test/compile-fail/deriving-span-Hash-enum.rs b/src/test/compile-fail/derives-span-Hash-enum.rs
index 1f5a5d5201f..99f28b376df 100644
--- a/src/test/compile-fail/deriving-span-Hash-enum.rs
+++ b/src/test/compile-fail/derives-span-Hash-enum.rs
@@ -1,4 +1,4 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -10,8 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-extern crate rand;
-
 
 struct Error;
 
diff --git a/src/test/compile-fail/deriving-span-Hash-struct.rs b/src/test/compile-fail/derives-span-Hash-struct.rs
index 55a5e9ee6b3..acfd5aa7b2a 100644
--- a/src/test/compile-fail/deriving-span-Hash-struct.rs
+++ b/src/test/compile-fail/derives-span-Hash-struct.rs
@@ -1,4 +1,4 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -10,8 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-extern crate rand;
-
 
 struct Error;
 
diff --git a/src/test/compile-fail/deriving-span-Hash-tuple-struct.rs b/src/test/compile-fail/derives-span-Hash-tuple-struct.rs
index 5c81c57dbcc..3d76b29834f 100644
--- a/src/test/compile-fail/deriving-span-Hash-tuple-struct.rs
+++ b/src/test/compile-fail/derives-span-Hash-tuple-struct.rs
@@ -1,4 +1,4 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -10,8 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-extern crate rand;
-
 
 struct Error;
 
diff --git a/src/test/compile-fail/deriving-span-TotalOrd-enum-struct-variant.rs b/src/test/compile-fail/derives-span-Ord-enum-struct-variant.rs
index 6d5e1fb75d4..06ee588e69f 100644
--- a/src/test/compile-fail/deriving-span-TotalOrd-enum-struct-variant.rs
+++ b/src/test/compile-fail/derives-span-Ord-enum-struct-variant.rs
@@ -1,4 +1,4 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -10,8 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-extern crate rand;
-
 #[derive(Eq,PartialOrd,PartialEq)]
 struct Error;
 
diff --git a/src/test/compile-fail/deriving-span-TotalOrd-enum.rs b/src/test/compile-fail/derives-span-Ord-enum.rs
index 5b342901334..af9cfbc9110 100644
--- a/src/test/compile-fail/deriving-span-TotalOrd-enum.rs
+++ b/src/test/compile-fail/derives-span-Ord-enum.rs
@@ -1,4 +1,4 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -10,8 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-extern crate rand;
-
 #[derive(Eq,PartialOrd,PartialEq)]
 struct Error;
 
diff --git a/src/test/compile-fail/deriving-span-TotalOrd-struct.rs b/src/test/compile-fail/derives-span-Ord-struct.rs
index 61d9d8a76a9..4477d933a6c 100644
--- a/src/test/compile-fail/deriving-span-TotalOrd-struct.rs
+++ b/src/test/compile-fail/derives-span-Ord-struct.rs
@@ -1,4 +1,4 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -10,8 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-extern crate rand;
-
 #[derive(Eq,PartialOrd,PartialEq)]
 struct Error;
 
diff --git a/src/test/compile-fail/deriving-span-TotalOrd-tuple-struct.rs b/src/test/compile-fail/derives-span-Ord-tuple-struct.rs
index caef7968756..ebc75186412 100644
--- a/src/test/compile-fail/deriving-span-TotalOrd-tuple-struct.rs
+++ b/src/test/compile-fail/derives-span-Ord-tuple-struct.rs
@@ -1,4 +1,4 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -10,8 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-extern crate rand;
-
 #[derive(Eq,PartialOrd,PartialEq)]
 struct Error;
 
diff --git a/src/test/compile-fail/deriving-span-PartialEq-enum-struct-variant.rs b/src/test/compile-fail/derives-span-PartialEq-enum-struct-variant.rs
index c340ad8a46a..7c98dcc2a6f 100644
--- a/src/test/compile-fail/deriving-span-PartialEq-enum-struct-variant.rs
+++ b/src/test/compile-fail/derives-span-PartialEq-enum-struct-variant.rs
@@ -1,4 +1,4 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -10,8 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-extern crate rand;
-
 
 struct Error;
 
diff --git a/src/test/compile-fail/deriving-span-PartialEq-enum.rs b/src/test/compile-fail/derives-span-PartialEq-enum.rs
index 9051a6371fc..fe6355e456c 100644
--- a/src/test/compile-fail/deriving-span-PartialEq-enum.rs
+++ b/src/test/compile-fail/derives-span-PartialEq-enum.rs
@@ -1,4 +1,4 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -10,8 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-extern crate rand;
-
 
 struct Error;
 
diff --git a/src/test/compile-fail/deriving-span-PartialEq-struct.rs b/src/test/compile-fail/derives-span-PartialEq-struct.rs
index 310d4ecd03f..10d9d642776 100644
--- a/src/test/compile-fail/deriving-span-PartialEq-struct.rs
+++ b/src/test/compile-fail/derives-span-PartialEq-struct.rs
@@ -1,4 +1,4 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -10,8 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-extern crate rand;
-
 
 struct Error;
 
diff --git a/src/test/compile-fail/deriving-span-PartialEq-tuple-struct.rs b/src/test/compile-fail/derives-span-PartialEq-tuple-struct.rs
index 9b6df0e77e1..c92eb0f63c4 100644
--- a/src/test/compile-fail/deriving-span-PartialEq-tuple-struct.rs
+++ b/src/test/compile-fail/derives-span-PartialEq-tuple-struct.rs
@@ -1,4 +1,4 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -10,8 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-extern crate rand;
-
 
 struct Error;
 
diff --git a/src/test/compile-fail/deriving-span-PartialOrd-enum-struct-variant.rs b/src/test/compile-fail/derives-span-PartialOrd-enum-struct-variant.rs
index 5a2d2063d14..898104d0ab2 100644
--- a/src/test/compile-fail/deriving-span-PartialOrd-enum-struct-variant.rs
+++ b/src/test/compile-fail/derives-span-PartialOrd-enum-struct-variant.rs
@@ -1,4 +1,4 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -10,8 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-extern crate rand;
-
 #[derive(PartialEq)]
 struct Error;
 
diff --git a/src/test/compile-fail/deriving-span-PartialOrd-enum.rs b/src/test/compile-fail/derives-span-PartialOrd-enum.rs
index 9341b6c3e8b..c0585999473 100644
--- a/src/test/compile-fail/deriving-span-PartialOrd-enum.rs
+++ b/src/test/compile-fail/derives-span-PartialOrd-enum.rs
@@ -1,4 +1,4 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -10,8 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-extern crate rand;
-
 #[derive(PartialEq)]
 struct Error;
 
diff --git a/src/test/compile-fail/deriving-span-PartialOrd-struct.rs b/src/test/compile-fail/derives-span-PartialOrd-struct.rs
index 8a707566efa..af05434af9d 100644
--- a/src/test/compile-fail/deriving-span-PartialOrd-struct.rs
+++ b/src/test/compile-fail/derives-span-PartialOrd-struct.rs
@@ -1,4 +1,4 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -10,8 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-extern crate rand;
-
 #[derive(PartialEq)]
 struct Error;
 
diff --git a/src/test/compile-fail/deriving-span-PartialOrd-tuple-struct.rs b/src/test/compile-fail/derives-span-PartialOrd-tuple-struct.rs
index ae1b8b44379..1afb7bc2b4c 100644
--- a/src/test/compile-fail/deriving-span-PartialOrd-tuple-struct.rs
+++ b/src/test/compile-fail/derives-span-PartialOrd-tuple-struct.rs
@@ -1,4 +1,4 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -10,8 +10,6 @@
 
 // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
 
-extern crate rand;
-
 #[derive(PartialEq)]
 struct Error;
 
diff --git a/src/test/compile-fail/forget-init-unsafe.rs b/src/test/compile-fail/forget-init-unsafe.rs
index 46a18c98183..521f122f8af 100644
--- a/src/test/compile-fail/forget-init-unsafe.rs
+++ b/src/test/compile-fail/forget-init-unsafe.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(core_intrinsics)]
+
 use std::intrinsics::{init, forget};
 
 // Test that the `forget` and `init` intrinsics are really unsafe
diff --git a/src/test/compile-fail/issue-15094.rs b/src/test/compile-fail/issue-15094.rs
index da48bbb3ecd..1dd6763cbe5 100644
--- a/src/test/compile-fail/issue-15094.rs
+++ b/src/test/compile-fail/issue-15094.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(unboxed_closures)]
+#![feature(fn_traits, unboxed_closures)]
 
 use std::{fmt, ops};
 
diff --git a/src/test/compile-fail/issue-17545.rs b/src/test/compile-fail/issue-17545.rs
index 49435f83ce3..45bc5ee07a5 100644
--- a/src/test/compile-fail/issue-17545.rs
+++ b/src/test/compile-fail/issue-17545.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(fn_traits)]
+
 pub fn foo<'a, F: Fn(&'a ())>(bar: F) {
     bar.call((
         &(), //~ ERROR borrowed value does not live long enough
diff --git a/src/test/compile-fail/issue-20225.rs b/src/test/compile-fail/issue-20225.rs
index f38961c427a..da98f21e461 100644
--- a/src/test/compile-fail/issue-20225.rs
+++ b/src/test/compile-fail/issue-20225.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(unboxed_closures)]
+#![feature(fn_traits, unboxed_closures)]
 
 struct Foo;
 
diff --git a/src/test/compile-fail/issue-22034.rs b/src/test/compile-fail/issue-22034.rs
index 3e0ab6d8921..dfa9520f38b 100644
--- a/src/test/compile-fail/issue-22034.rs
+++ b/src/test/compile-fail/issue-22034.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(libc)]
+
 extern crate libc;
 
 fn main() {
diff --git a/src/test/compile-fail/issue-2392.rs b/src/test/compile-fail/issue-2392.rs
index 790b774bd21..805725dd749 100644
--- a/src/test/compile-fail/issue-2392.rs
+++ b/src/test/compile-fail/issue-2392.rs
@@ -8,7 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(core)]
+#![feature(core, fnbox)]
+
 use std::boxed::FnBox;
 
 struct FuncContainer {
diff --git a/src/test/compile-fail/issue-28075.rs b/src/test/compile-fail/issue-28075.rs
index d75f5f606a0..3e3d898e368 100644
--- a/src/test/compile-fail/issue-28075.rs
+++ b/src/test/compile-fail/issue-28075.rs
@@ -17,7 +17,6 @@
 extern crate lint_stability;
 
 use lint_stability::{unstable, deprecated}; //~ ERROR use of unstable library feature 'test_feature'
-//~^ WARNING use of deprecated item
 
 use lint_stability::unstable::{self as u}; //~ ERROR use of unstable library feature 'test_feature'
 
diff --git a/src/test/compile-fail/issue-36881.rs b/src/test/compile-fail/issue-36881.rs
index cca20e968e0..d75ac0c7f2e 100644
--- a/src/test/compile-fail/issue-36881.rs
+++ b/src/test/compile-fail/issue-36881.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(rand)]
+
 fn main() {
     extern crate rand;
     use rand::Rng; //~ ERROR unresolved import
diff --git a/src/test/compile-fail/issue-4335.rs b/src/test/compile-fail/issue-4335.rs
index 09371fbafcb..51f5fc5ee98 100644
--- a/src/test/compile-fail/issue-4335.rs
+++ b/src/test/compile-fail/issue-4335.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(fn_traits)]
+
 fn id<T>(t: T) -> T { t }
 
 fn f<'r, T>(v: &'r T) -> Box<FnMut() -> T + 'r> {
diff --git a/src/test/compile-fail/lint-output-format-2.rs b/src/test/compile-fail/lint-output-format-2.rs
new file mode 100644
index 00000000000..2f74325d19c
--- /dev/null
+++ b/src/test/compile-fail/lint-output-format-2.rs
@@ -0,0 +1,25 @@
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags: -F unused_features
+// aux-build:lint_output_format.rs
+
+#![feature(foo)] //~ ERROR unused or unknown feature
+
+#![feature(test_feature)]
+
+extern crate lint_output_format;
+use lint_output_format::{foo, bar};
+//~^ WARNING use of deprecated item: text,
+
+fn main() {
+    let _x = foo(); //~ WARNING #[warn(deprecated)] on by default
+    let _y = bar();
+}
diff --git a/src/test/compile-fail/lint-output-format.rs b/src/test/compile-fail/lint-output-format.rs
index c22ad3182dd..81e0b708b87 100644
--- a/src/test/compile-fail/lint-output-format.rs
+++ b/src/test/compile-fail/lint-output-format.rs
@@ -11,13 +11,12 @@
 // compile-flags: -F unused_features
 // aux-build:lint_output_format.rs
 
-#![feature(foo)] //~ ERROR unused or unknown feature
+#![allow(deprecated)]
 
 extern crate lint_output_format; //~ ERROR use of unstable library feature
 use lint_output_format::{foo, bar}; //~ ERROR use of unstable library feature
-//~^ WARNING use of deprecated item: text,
 
 fn main() {
-    let _x = foo(); //~ WARNING #[warn(deprecated)] on by default
+    let _x = foo();
     let _y = bar(); //~ ERROR use of unstable library feature
 }
diff --git a/src/test/compile-fail/lint-stability-2.rs b/src/test/compile-fail/lint-stability-2.rs
new file mode 100644
index 00000000000..77917ff3cd3
--- /dev/null
+++ b/src/test/compile-fail/lint-stability-2.rs
@@ -0,0 +1,423 @@
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// aux-build:lint_stability.rs
+// aux-build:stability_cfg1.rs
+
+#![allow(deprecated)]
+#![allow(dead_code)]
+#![feature(staged_api)]
+
+#![stable(feature = "rust1", since = "1.0.0")]
+
+#[macro_use]
+extern crate lint_stability;
+
+mod cross_crate {
+    extern crate stability_cfg1;
+
+    use lint_stability::*;
+
+    fn test() {
+        type Foo = MethodTester;
+        let foo = MethodTester;
+
+        deprecated();
+        foo.method_deprecated();
+        Foo::method_deprecated(&foo);
+        <Foo>::method_deprecated(&foo);
+        foo.trait_deprecated();
+        Trait::trait_deprecated(&foo);
+        <Foo>::trait_deprecated(&foo);
+        <Foo as Trait>::trait_deprecated(&foo);
+
+        deprecated_text();
+        foo.method_deprecated_text();
+        Foo::method_deprecated_text(&foo);
+        <Foo>::method_deprecated_text(&foo);
+        foo.trait_deprecated_text();
+        Trait::trait_deprecated_text(&foo);
+        <Foo>::trait_deprecated_text(&foo);
+        <Foo as Trait>::trait_deprecated_text(&foo);
+
+        foo.method_deprecated_unstable();
+        //~^ ERROR use of unstable library feature
+        Foo::method_deprecated_unstable(&foo);
+        //~^ ERROR use of unstable library feature
+        <Foo>::method_deprecated_unstable(&foo);
+        //~^ ERROR use of unstable library feature
+        foo.trait_deprecated_unstable();
+        //~^ ERROR use of unstable library feature
+        <Foo>::trait_deprecated_unstable(&foo);
+        //~^ ERROR use of unstable library feature
+
+        foo.method_deprecated_unstable_text();
+        //~^ ERROR use of unstable library feature
+        Foo::method_deprecated_unstable_text(&foo);
+        //~^ ERROR use of unstable library feature
+        <Foo>::method_deprecated_unstable_text(&foo);
+        //~^ ERROR use of unstable library feature
+        foo.trait_deprecated_unstable_text();
+        //~^ ERROR use of unstable library feature
+        <Foo>::trait_deprecated_unstable_text(&foo);
+        //~^ ERROR use of unstable library feature
+
+        foo.method_unstable(); //~ ERROR use of unstable library feature
+        Foo::method_unstable(&foo); //~ ERROR use of unstable library feature
+        <Foo>::method_unstable(&foo); //~ ERROR use of unstable library feature
+        foo.trait_unstable(); //~ ERROR use of unstable library feature
+        <Foo>::trait_unstable(&foo); //~ ERROR use of unstable library feature
+
+        foo.method_unstable_text();
+        //~^ ERROR use of unstable library feature 'test_feature': text
+        Foo::method_unstable_text(&foo);
+        //~^ ERROR use of unstable library feature 'test_feature': text
+        <Foo>::method_unstable_text(&foo);
+        //~^ ERROR use of unstable library feature 'test_feature': text
+        foo.trait_unstable_text();
+        //~^ ERROR use of unstable library feature 'test_feature': text
+        <Foo>::trait_unstable_text(&foo);
+        //~^ ERROR use of unstable library feature 'test_feature': text
+
+        stable();
+        foo.method_stable();
+        Foo::method_stable(&foo);
+        <Foo>::method_stable(&foo);
+        foo.trait_stable();
+        Trait::trait_stable(&foo);
+        <Foo>::trait_stable(&foo);
+        <Foo as Trait>::trait_stable(&foo);
+
+        stable_text();
+        foo.method_stable_text();
+        Foo::method_stable_text(&foo);
+        <Foo>::method_stable_text(&foo);
+        foo.trait_stable_text();
+        Trait::trait_stable_text(&foo);
+        <Foo>::trait_stable_text(&foo);
+        <Foo as Trait>::trait_stable_text(&foo);
+
+        struct S2<T: TraitWithAssociatedTypes>(T::TypeDeprecated);
+
+        let _ = DeprecatedStruct {
+            i: 0
+        };
+        let _ = StableStruct { i: 0 };
+
+        let _ = DeprecatedUnitStruct;
+        let _ = StableUnitStruct;
+
+        let _ = Enum::DeprecatedVariant;
+        let _ = Enum::StableVariant;
+
+        let _ = DeprecatedTupleStruct (1);
+        let _ = StableTupleStruct (1);
+
+        // At the moment, the lint checker only checks stability in
+        // in the arguments of macros.
+        // Eventually, we will want to lint the contents of the
+        // macro in the module *defining* it. Also, stability levels
+        // on macros themselves are not yet linted.
+        macro_test_arg!(deprecated_text());
+        macro_test_arg!(macro_test_arg!(deprecated_text()));
+    }
+
+    fn test_method_param<Foo: Trait>(foo: Foo) {
+        foo.trait_deprecated();
+        Trait::trait_deprecated(&foo);
+        <Foo>::trait_deprecated(&foo);
+        <Foo as Trait>::trait_deprecated(&foo);
+        foo.trait_deprecated_text();
+        Trait::trait_deprecated_text(&foo);
+        <Foo>::trait_deprecated_text(&foo);
+        <Foo as Trait>::trait_deprecated_text(&foo);
+        foo.trait_deprecated_unstable();
+        //~^ ERROR use of unstable library feature
+        <Foo>::trait_deprecated_unstable(&foo);
+        //~^ ERROR use of unstable library feature
+        foo.trait_deprecated_unstable_text();
+        //~^ ERROR use of unstable library feature
+        <Foo>::trait_deprecated_unstable_text(&foo);
+        //~^ ERROR use of unstable library feature
+        foo.trait_unstable(); //~ ERROR use of unstable library feature
+        <Foo>::trait_unstable(&foo); //~ ERROR use of unstable library feature
+        foo.trait_unstable_text();
+        //~^ ERROR use of unstable library feature 'test_feature': text
+        <Foo>::trait_unstable_text(&foo);
+        //~^ ERROR use of unstable library feature 'test_feature': text
+        foo.trait_stable();
+        Trait::trait_stable(&foo);
+        <Foo>::trait_stable(&foo);
+        <Foo as Trait>::trait_stable(&foo);
+    }
+
+    fn test_method_object(foo: &Trait) {
+        foo.trait_deprecated();
+        foo.trait_deprecated_text();
+        foo.trait_deprecated_unstable();
+        //~^ ERROR use of unstable library feature
+        foo.trait_deprecated_unstable_text();
+        //~^ ERROR use of unstable library feature
+        foo.trait_unstable(); //~ ERROR use of unstable library feature
+        foo.trait_unstable_text();
+        //~^ ERROR use of unstable library feature 'test_feature': text
+        foo.trait_stable();
+    }
+
+    struct S;
+
+    impl DeprecatedTrait for S {}
+    trait LocalTrait2 : DeprecatedTrait { }
+}
+
+mod this_crate {
+    #[unstable(feature = "test_feature", issue = "0")]
+    #[rustc_deprecated(since = "1.0.0", reason = "text")]
+    pub fn deprecated() {}
+    #[unstable(feature = "test_feature", issue = "0")]
+    #[rustc_deprecated(since = "1.0.0", reason = "text")]
+    pub fn deprecated_text() {}
+
+    #[unstable(feature = "test_feature", issue = "0")]
+    pub fn unstable() {}
+    #[unstable(feature = "test_feature", reason = "text", issue = "0")]
+    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 {
+        #[unstable(feature = "test_feature", issue = "0")]
+        #[rustc_deprecated(since = "1.0.0", reason = "text")]
+        pub fn method_deprecated(&self) {}
+        #[unstable(feature = "test_feature", issue = "0")]
+        #[rustc_deprecated(since = "1.0.0", reason = "text")]
+        pub fn method_deprecated_text(&self) {}
+
+        #[unstable(feature = "test_feature", issue = "0")]
+        pub fn method_unstable(&self) {}
+        #[unstable(feature = "test_feature", reason = "text", issue = "0")]
+        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) {}
+    }
+
+    pub trait Trait {
+        #[unstable(feature = "test_feature", issue = "0")]
+        #[rustc_deprecated(since = "1.0.0", reason = "text")]
+        fn trait_deprecated(&self) {}
+        #[unstable(feature = "test_feature", issue = "0")]
+        #[rustc_deprecated(since = "1.0.0", reason = "text")]
+        fn trait_deprecated_text(&self) {}
+
+        #[unstable(feature = "test_feature", issue = "0")]
+        fn trait_unstable(&self) {}
+        #[unstable(feature = "test_feature", reason = "text", issue = "0")]
+        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) {}
+    }
+
+    impl Trait for MethodTester {}
+
+    #[unstable(feature = "test_feature", issue = "0")]
+    #[rustc_deprecated(since = "1.0.0", reason = "text")]
+    pub struct DeprecatedStruct {
+        #[stable(feature = "test_feature", since = "1.0.0")] i: isize
+    }
+    #[unstable(feature = "test_feature", issue = "0")]
+    pub struct UnstableStruct {
+        #[stable(feature = "test_feature", since = "1.0.0")] i: isize
+    }
+    #[stable(feature = "rust1", since = "1.0.0")]
+    pub struct StableStruct {
+        #[stable(feature = "test_feature", since = "1.0.0")] i: isize
+    }
+
+    #[unstable(feature = "test_feature", issue = "0")]
+    #[rustc_deprecated(since = "1.0.0", reason = "text")]
+    pub struct DeprecatedUnitStruct;
+    #[unstable(feature = "test_feature", issue = "0")]
+    pub struct UnstableUnitStruct;
+    #[stable(feature = "rust1", since = "1.0.0")]
+    pub struct StableUnitStruct;
+
+    pub enum Enum {
+        #[unstable(feature = "test_feature", issue = "0")]
+        #[rustc_deprecated(since = "1.0.0", reason = "text")]
+        DeprecatedVariant,
+        #[unstable(feature = "test_feature", issue = "0")]
+        UnstableVariant,
+
+        #[stable(feature = "rust1", since = "1.0.0")]
+        StableVariant,
+    }
+
+    #[unstable(feature = "test_feature", issue = "0")]
+    #[rustc_deprecated(since = "1.0.0", reason = "text")]
+    pub struct DeprecatedTupleStruct(isize);
+    #[unstable(feature = "test_feature", issue = "0")]
+    pub struct UnstableTupleStruct(isize);
+    #[stable(feature = "rust1", since = "1.0.0")]
+    pub struct StableTupleStruct(isize);
+
+    fn test() {
+        // Only the deprecated cases of the following should generate
+        // errors, because other stability attributes now have meaning
+        // only *across* crates, not within a single crate.
+
+        type Foo = MethodTester;
+        let foo = MethodTester;
+
+        deprecated();
+        foo.method_deprecated();
+        Foo::method_deprecated(&foo);
+        <Foo>::method_deprecated(&foo);
+        foo.trait_deprecated();
+        Trait::trait_deprecated(&foo);
+        <Foo>::trait_deprecated(&foo);
+        <Foo as Trait>::trait_deprecated(&foo);
+
+        deprecated_text();
+        foo.method_deprecated_text();
+        Foo::method_deprecated_text(&foo);
+        <Foo>::method_deprecated_text(&foo);
+        foo.trait_deprecated_text();
+        Trait::trait_deprecated_text(&foo);
+        <Foo>::trait_deprecated_text(&foo);
+        <Foo as Trait>::trait_deprecated_text(&foo);
+
+        unstable();
+        foo.method_unstable();
+        Foo::method_unstable(&foo);
+        <Foo>::method_unstable(&foo);
+        foo.trait_unstable();
+        Trait::trait_unstable(&foo);
+        <Foo>::trait_unstable(&foo);
+        <Foo as Trait>::trait_unstable(&foo);
+
+        unstable_text();
+        foo.method_unstable_text();
+        Foo::method_unstable_text(&foo);
+        <Foo>::method_unstable_text(&foo);
+        foo.trait_unstable_text();
+        Trait::trait_unstable_text(&foo);
+        <Foo>::trait_unstable_text(&foo);
+        <Foo as Trait>::trait_unstable_text(&foo);
+
+        stable();
+        foo.method_stable();
+        Foo::method_stable(&foo);
+        <Foo>::method_stable(&foo);
+        foo.trait_stable();
+        Trait::trait_stable(&foo);
+        <Foo>::trait_stable(&foo);
+        <Foo as Trait>::trait_stable(&foo);
+
+        stable_text();
+        foo.method_stable_text();
+        Foo::method_stable_text(&foo);
+        <Foo>::method_stable_text(&foo);
+        foo.trait_stable_text();
+        Trait::trait_stable_text(&foo);
+        <Foo>::trait_stable_text(&foo);
+        <Foo as Trait>::trait_stable_text(&foo);
+
+        let _ = DeprecatedStruct {
+            i: 0
+        };
+        let _ = UnstableStruct { i: 0 };
+        let _ = StableStruct { i: 0 };
+
+        let _ = DeprecatedUnitStruct;
+        let _ = UnstableUnitStruct;
+        let _ = StableUnitStruct;
+
+        let _ = Enum::DeprecatedVariant;
+        let _ = Enum::UnstableVariant;
+        let _ = Enum::StableVariant;
+
+        let _ = DeprecatedTupleStruct (1);
+        let _ = UnstableTupleStruct (1);
+        let _ = StableTupleStruct (1);
+    }
+
+    fn test_method_param<Foo: Trait>(foo: Foo) {
+        foo.trait_deprecated();
+        Trait::trait_deprecated(&foo);
+        <Foo>::trait_deprecated(&foo);
+        <Foo as Trait>::trait_deprecated(&foo);
+        foo.trait_deprecated_text();
+        Trait::trait_deprecated_text(&foo);
+        <Foo>::trait_deprecated_text(&foo);
+        <Foo as Trait>::trait_deprecated_text(&foo);
+        foo.trait_unstable();
+        Trait::trait_unstable(&foo);
+        <Foo>::trait_unstable(&foo);
+        <Foo as Trait>::trait_unstable(&foo);
+        foo.trait_unstable_text();
+        Trait::trait_unstable_text(&foo);
+        <Foo>::trait_unstable_text(&foo);
+        <Foo as Trait>::trait_unstable_text(&foo);
+        foo.trait_stable();
+        Trait::trait_stable(&foo);
+        <Foo>::trait_stable(&foo);
+        <Foo as Trait>::trait_stable(&foo);
+    }
+
+    fn test_method_object(foo: &Trait) {
+        foo.trait_deprecated();
+        foo.trait_deprecated_text();
+        foo.trait_unstable();
+        foo.trait_unstable_text();
+        foo.trait_stable();
+    }
+
+    #[unstable(feature = "test_feature", issue = "0")]
+    #[rustc_deprecated(since = "1.0.0", reason = "text")]
+    fn test_fn_body() {
+        fn fn_in_body() {}
+        fn_in_body();
+    }
+
+    impl MethodTester {
+        #[unstable(feature = "test_feature", issue = "0")]
+        #[rustc_deprecated(since = "1.0.0", reason = "text")]
+        fn test_method_body(&self) {
+            fn fn_in_body() {}
+            fn_in_body();
+        }
+    }
+
+    #[unstable(feature = "test_feature", issue = "0")]
+    #[rustc_deprecated(since = "1.0.0", reason = "text")]
+    pub trait DeprecatedTrait {
+        fn dummy(&self) { }
+    }
+
+    struct S;
+
+    impl DeprecatedTrait for S { }
+
+    trait LocalTrait : DeprecatedTrait { }
+}
+
+fn main() {}
diff --git a/src/test/compile-fail/lint-stability-deprecated.rs b/src/test/compile-fail/lint-stability-deprecated.rs
new file mode 100644
index 00000000000..d8813b6a610
--- /dev/null
+++ b/src/test/compile-fail/lint-stability-deprecated.rs
@@ -0,0 +1,467 @@
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// aux-build:lint_stability.rs
+// aux-build:inherited_stability.rs
+// aux-build:stability_cfg1.rs
+// aux-build:stability_cfg2.rs
+
+#![deny(deprecated)]
+#![allow(dead_code)]
+#![feature(staged_api, test_feature)]
+
+#![stable(feature = "rust1", since = "1.0.0")]
+
+#[macro_use]
+extern crate lint_stability;
+
+mod cross_crate {
+    extern crate stability_cfg1;
+    extern crate stability_cfg2;
+
+    use lint_stability::*;
+
+    fn test() {
+        type Foo = MethodTester;
+        let foo = MethodTester;
+
+        deprecated(); //~ ERROR use of deprecated item
+        foo.method_deprecated(); //~ ERROR use of deprecated item
+        Foo::method_deprecated(&foo); //~ ERROR use of deprecated item
+        <Foo>::method_deprecated(&foo); //~ ERROR use of deprecated item
+        foo.trait_deprecated(); //~ ERROR use of deprecated item
+        Trait::trait_deprecated(&foo); //~ ERROR use of deprecated item
+        <Foo>::trait_deprecated(&foo); //~ ERROR use of deprecated item
+        <Foo as Trait>::trait_deprecated(&foo); //~ ERROR use of deprecated item
+
+        deprecated_text(); //~ ERROR use of deprecated item: text
+        foo.method_deprecated_text(); //~ ERROR use of deprecated item: text
+        Foo::method_deprecated_text(&foo); //~ ERROR use of deprecated item: text
+        <Foo>::method_deprecated_text(&foo); //~ ERROR use of deprecated item: text
+        foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
+        Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
+        <Foo>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
+        <Foo as Trait>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
+
+        deprecated_unstable(); //~ ERROR use of deprecated item
+        foo.method_deprecated_unstable(); //~ ERROR use of deprecated item
+        Foo::method_deprecated_unstable(&foo); //~ ERROR use of deprecated item
+        <Foo>::method_deprecated_unstable(&foo); //~ ERROR use of deprecated item
+        foo.trait_deprecated_unstable(); //~ ERROR use of deprecated item
+        Trait::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item
+        <Foo>::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item
+        <Foo as Trait>::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item
+
+        deprecated_unstable_text(); //~ ERROR use of deprecated item: text
+        foo.method_deprecated_unstable_text(); //~ ERROR use of deprecated item: text
+        Foo::method_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
+        <Foo>::method_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
+        foo.trait_deprecated_unstable_text(); //~ ERROR use of deprecated item: text
+        Trait::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
+        <Foo>::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
+        <Foo as Trait>::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
+
+        unstable();
+        foo.method_unstable();
+        Foo::method_unstable(&foo);
+        <Foo>::method_unstable(&foo);
+        foo.trait_unstable();
+        Trait::trait_unstable(&foo);
+        <Foo>::trait_unstable(&foo);
+        <Foo as Trait>::trait_unstable(&foo);
+
+        unstable_text();
+        foo.method_unstable_text();
+        Foo::method_unstable_text(&foo);
+        <Foo>::method_unstable_text(&foo);
+        foo.trait_unstable_text();
+        Trait::trait_unstable_text(&foo);
+        <Foo>::trait_unstable_text(&foo);
+        <Foo as Trait>::trait_unstable_text(&foo);
+
+        stable();
+        foo.method_stable();
+        Foo::method_stable(&foo);
+        <Foo>::method_stable(&foo);
+        foo.trait_stable();
+        Trait::trait_stable(&foo);
+        <Foo>::trait_stable(&foo);
+        <Foo as Trait>::trait_stable(&foo);
+
+        stable_text();
+        foo.method_stable_text();
+        Foo::method_stable_text(&foo);
+        <Foo>::method_stable_text(&foo);
+        foo.trait_stable_text();
+        Trait::trait_stable_text(&foo);
+        <Foo>::trait_stable_text(&foo);
+        <Foo as Trait>::trait_stable_text(&foo);
+
+        struct S1<T: TraitWithAssociatedTypes>(T::TypeUnstable);
+        struct S2<T: TraitWithAssociatedTypes>(T::TypeDeprecated);
+        //~^ ERROR use of deprecated item
+
+        let _ = DeprecatedStruct { //~ ERROR use of deprecated item
+            i: 0 //~ ERROR use of deprecated item
+        };
+        let _ = DeprecatedUnstableStruct {
+            //~^ ERROR use of deprecated item
+            i: 0 //~ ERROR use of deprecated item
+        };
+        let _ = UnstableStruct { i: 0 };
+        let _ = StableStruct { i: 0 };
+
+        let _ = DeprecatedUnitStruct; //~ ERROR use of deprecated item
+        let _ = DeprecatedUnstableUnitStruct; //~ ERROR use of deprecated item
+        let _ = UnstableUnitStruct;
+        let _ = StableUnitStruct;
+
+        let _ = Enum::DeprecatedVariant; //~ ERROR use of deprecated item
+        let _ = Enum::DeprecatedUnstableVariant; //~ ERROR use of deprecated item
+        let _ = Enum::UnstableVariant;
+        let _ = Enum::StableVariant;
+
+        let _ = DeprecatedTupleStruct (1); //~ ERROR use of deprecated item
+        let _ = DeprecatedUnstableTupleStruct (1); //~ ERROR use of deprecated item
+        let _ = UnstableTupleStruct (1);
+        let _ = StableTupleStruct (1);
+
+        // At the moment, the lint checker only checks stability in
+        // in the arguments of macros.
+        // Eventually, we will want to lint the contents of the
+        // macro in the module *defining* it. Also, stability levels
+        // on macros themselves are not yet linted.
+        macro_test_arg!(deprecated_text()); //~ ERROR use of deprecated item: text
+        macro_test_arg!(deprecated_unstable_text()); //~ ERROR use of deprecated item: text
+        macro_test_arg!(macro_test_arg!(deprecated_text())); //~ ERROR use of deprecated item: text
+    }
+
+    fn test_method_param<Foo: Trait>(foo: Foo) {
+        foo.trait_deprecated(); //~ ERROR use of deprecated item
+        Trait::trait_deprecated(&foo); //~ ERROR use of deprecated item
+        <Foo>::trait_deprecated(&foo); //~ ERROR use of deprecated item
+        <Foo as Trait>::trait_deprecated(&foo); //~ ERROR use of deprecated item
+        foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
+        Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
+        <Foo>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
+        <Foo as Trait>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
+        foo.trait_deprecated_unstable(); //~ ERROR use of deprecated item
+        Trait::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item
+        <Foo>::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item
+        <Foo as Trait>::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item
+        foo.trait_deprecated_unstable_text(); //~ ERROR use of deprecated item: text
+        Trait::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
+        <Foo>::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
+        <Foo as Trait>::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
+        foo.trait_unstable();
+        Trait::trait_unstable(&foo);
+        <Foo>::trait_unstable(&foo);
+        <Foo as Trait>::trait_unstable(&foo);
+        foo.trait_unstable_text();
+        Trait::trait_unstable_text(&foo);
+        <Foo>::trait_unstable_text(&foo);
+        <Foo as Trait>::trait_unstable_text(&foo);
+        foo.trait_stable();
+        Trait::trait_stable(&foo);
+        <Foo>::trait_stable(&foo);
+        <Foo as Trait>::trait_stable(&foo);
+    }
+
+    fn test_method_object(foo: &Trait) {
+        foo.trait_deprecated(); //~ ERROR use of deprecated item
+        foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
+        foo.trait_deprecated_unstable(); //~ ERROR use of deprecated item
+        foo.trait_deprecated_unstable_text(); //~ ERROR use of deprecated item: text
+        foo.trait_unstable();
+        foo.trait_unstable_text();
+        foo.trait_stable();
+    }
+
+    struct S;
+
+    impl UnstableTrait for S { }
+    impl DeprecatedTrait for S {} //~ ERROR use of deprecated item: text
+    trait LocalTrait : UnstableTrait { }
+    trait LocalTrait2 : DeprecatedTrait { } //~ ERROR use of deprecated item: text
+
+    impl Trait for S {
+        fn trait_stable(&self) {}
+        fn trait_unstable(&self) {}
+    }
+}
+
+mod inheritance {
+    extern crate inherited_stability;
+    use self::inherited_stability::*;
+
+    fn test_inheritance() {
+        unstable();
+        stable();
+
+        stable_mod::unstable();
+        stable_mod::stable();
+
+        unstable_mod::deprecated(); //~ ERROR use of deprecated item
+        unstable_mod::unstable();
+
+        let _ = Unstable::UnstableVariant;
+        let _ = Unstable::StableVariant;
+
+        let x: usize = 0;
+        x.unstable();
+        x.stable();
+    }
+}
+
+mod this_crate {
+    #[unstable(feature = "test_feature", issue = "0")]
+    #[rustc_deprecated(since = "1.0.0", reason = "text")]
+    pub fn deprecated() {}
+    #[unstable(feature = "test_feature", issue = "0")]
+    #[rustc_deprecated(since = "1.0.0", reason = "text")]
+    pub fn deprecated_text() {}
+
+    #[unstable(feature = "test_feature", issue = "0")]
+    pub fn unstable() {}
+    #[unstable(feature = "test_feature", reason = "text", issue = "0")]
+    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 {
+        #[unstable(feature = "test_feature", issue = "0")]
+        #[rustc_deprecated(since = "1.0.0", reason = "text")]
+        pub fn method_deprecated(&self) {}
+        #[unstable(feature = "test_feature", issue = "0")]
+        #[rustc_deprecated(since = "1.0.0", reason = "text")]
+        pub fn method_deprecated_text(&self) {}
+
+        #[unstable(feature = "test_feature", issue = "0")]
+        pub fn method_unstable(&self) {}
+        #[unstable(feature = "test_feature", reason = "text", issue = "0")]
+        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) {}
+    }
+
+    pub trait Trait {
+        #[unstable(feature = "test_feature", issue = "0")]
+        #[rustc_deprecated(since = "1.0.0", reason = "text")]
+        fn trait_deprecated(&self) {}
+        #[unstable(feature = "test_feature", issue = "0")]
+        #[rustc_deprecated(since = "1.0.0", reason = "text")]
+        fn trait_deprecated_text(&self) {}
+
+        #[unstable(feature = "test_feature", issue = "0")]
+        fn trait_unstable(&self) {}
+        #[unstable(feature = "test_feature", reason = "text", issue = "0")]
+        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) {}
+    }
+
+    impl Trait for MethodTester {}
+
+    #[unstable(feature = "test_feature", issue = "0")]
+    #[rustc_deprecated(since = "1.0.0", reason = "text")]
+    pub struct DeprecatedStruct {
+        #[stable(feature = "test_feature", since = "1.0.0")] i: isize
+    }
+    #[unstable(feature = "test_feature", issue = "0")]
+    pub struct UnstableStruct {
+        #[stable(feature = "test_feature", since = "1.0.0")] i: isize
+    }
+    #[stable(feature = "rust1", since = "1.0.0")]
+    pub struct StableStruct {
+        #[stable(feature = "test_feature", since = "1.0.0")] i: isize
+    }
+
+    #[unstable(feature = "test_feature", issue = "0")]
+    #[rustc_deprecated(since = "1.0.0", reason = "text")]
+    pub struct DeprecatedUnitStruct;
+    #[unstable(feature = "test_feature", issue = "0")]
+    pub struct UnstableUnitStruct;
+    #[stable(feature = "rust1", since = "1.0.0")]
+    pub struct StableUnitStruct;
+
+    pub enum Enum {
+        #[unstable(feature = "test_feature", issue = "0")]
+        #[rustc_deprecated(since = "1.0.0", reason = "text")]
+        DeprecatedVariant,
+        #[unstable(feature = "test_feature", issue = "0")]
+        UnstableVariant,
+
+        #[stable(feature = "rust1", since = "1.0.0")]
+        StableVariant,
+    }
+
+    #[unstable(feature = "test_feature", issue = "0")]
+    #[rustc_deprecated(since = "1.0.0", reason = "text")]
+    pub struct DeprecatedTupleStruct(isize);
+    #[unstable(feature = "test_feature", issue = "0")]
+    pub struct UnstableTupleStruct(isize);
+    #[stable(feature = "rust1", since = "1.0.0")]
+    pub struct StableTupleStruct(isize);
+
+    fn test() {
+        // Only the deprecated cases of the following should generate
+        // errors, because other stability attributes now have meaning
+        // only *across* crates, not within a single crate.
+
+        type Foo = MethodTester;
+        let foo = MethodTester;
+
+        deprecated(); //~ ERROR use of deprecated item
+        foo.method_deprecated(); //~ ERROR use of deprecated item
+        Foo::method_deprecated(&foo); //~ ERROR use of deprecated item
+        <Foo>::method_deprecated(&foo); //~ ERROR use of deprecated item
+        foo.trait_deprecated(); //~ ERROR use of deprecated item
+        Trait::trait_deprecated(&foo); //~ ERROR use of deprecated item
+        <Foo>::trait_deprecated(&foo); //~ ERROR use of deprecated item
+        <Foo as Trait>::trait_deprecated(&foo); //~ ERROR use of deprecated item
+
+        deprecated_text(); //~ ERROR use of deprecated item: text
+        foo.method_deprecated_text(); //~ ERROR use of deprecated item: text
+        Foo::method_deprecated_text(&foo); //~ ERROR use of deprecated item: text
+        <Foo>::method_deprecated_text(&foo); //~ ERROR use of deprecated item: text
+        foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
+        Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
+        <Foo>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
+        <Foo as Trait>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
+
+        unstable();
+        foo.method_unstable();
+        Foo::method_unstable(&foo);
+        <Foo>::method_unstable(&foo);
+        foo.trait_unstable();
+        Trait::trait_unstable(&foo);
+        <Foo>::trait_unstable(&foo);
+        <Foo as Trait>::trait_unstable(&foo);
+
+        unstable_text();
+        foo.method_unstable_text();
+        Foo::method_unstable_text(&foo);
+        <Foo>::method_unstable_text(&foo);
+        foo.trait_unstable_text();
+        Trait::trait_unstable_text(&foo);
+        <Foo>::trait_unstable_text(&foo);
+        <Foo as Trait>::trait_unstable_text(&foo);
+
+        stable();
+        foo.method_stable();
+        Foo::method_stable(&foo);
+        <Foo>::method_stable(&foo);
+        foo.trait_stable();
+        Trait::trait_stable(&foo);
+        <Foo>::trait_stable(&foo);
+        <Foo as Trait>::trait_stable(&foo);
+
+        stable_text();
+        foo.method_stable_text();
+        Foo::method_stable_text(&foo);
+        <Foo>::method_stable_text(&foo);
+        foo.trait_stable_text();
+        Trait::trait_stable_text(&foo);
+        <Foo>::trait_stable_text(&foo);
+        <Foo as Trait>::trait_stable_text(&foo);
+
+        let _ = DeprecatedStruct {
+            //~^ ERROR use of deprecated item
+            i: 0 //~ ERROR use of deprecated item
+        };
+        let _ = UnstableStruct { i: 0 };
+        let _ = StableStruct { i: 0 };
+
+        let _ = DeprecatedUnitStruct; //~ ERROR use of deprecated item
+        let _ = UnstableUnitStruct;
+        let _ = StableUnitStruct;
+
+        let _ = Enum::DeprecatedVariant; //~ ERROR use of deprecated item
+        let _ = Enum::UnstableVariant;
+        let _ = Enum::StableVariant;
+
+        let _ = DeprecatedTupleStruct (1); //~ ERROR use of deprecated item
+        let _ = UnstableTupleStruct (1);
+        let _ = StableTupleStruct (1);
+    }
+
+    fn test_method_param<Foo: Trait>(foo: Foo) {
+        foo.trait_deprecated(); //~ ERROR use of deprecated item
+        Trait::trait_deprecated(&foo); //~ ERROR use of deprecated item
+        <Foo>::trait_deprecated(&foo); //~ ERROR use of deprecated item
+        <Foo as Trait>::trait_deprecated(&foo); //~ ERROR use of deprecated item
+        foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
+        Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
+        <Foo>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
+        <Foo as Trait>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
+        foo.trait_unstable();
+        Trait::trait_unstable(&foo);
+        <Foo>::trait_unstable(&foo);
+        <Foo as Trait>::trait_unstable(&foo);
+        foo.trait_unstable_text();
+        Trait::trait_unstable_text(&foo);
+        <Foo>::trait_unstable_text(&foo);
+        <Foo as Trait>::trait_unstable_text(&foo);
+        foo.trait_stable();
+        Trait::trait_stable(&foo);
+        <Foo>::trait_stable(&foo);
+        <Foo as Trait>::trait_stable(&foo);
+    }
+
+    fn test_method_object(foo: &Trait) {
+        foo.trait_deprecated(); //~ ERROR use of deprecated item
+        foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
+        foo.trait_unstable();
+        foo.trait_unstable_text();
+        foo.trait_stable();
+    }
+
+    #[unstable(feature = "test_feature", issue = "0")]
+    #[rustc_deprecated(since = "1.0.0", reason = "text")]
+    fn test_fn_body() {
+        fn fn_in_body() {}
+        fn_in_body(); //~ ERROR use of deprecated item: text
+    }
+
+    impl MethodTester {
+        #[unstable(feature = "test_feature", issue = "0")]
+        #[rustc_deprecated(since = "1.0.0", reason = "text")]
+        fn test_method_body(&self) {
+            fn fn_in_body() {}
+            fn_in_body(); //~ ERROR use of deprecated item: text
+        }
+    }
+
+    #[unstable(feature = "test_feature", issue = "0")]
+    #[rustc_deprecated(since = "1.0.0", reason = "text")]
+    pub trait DeprecatedTrait {
+        fn dummy(&self) { }
+    }
+
+    struct S;
+
+    impl DeprecatedTrait for S { } //~ ERROR use of deprecated item
+
+    trait LocalTrait : DeprecatedTrait { } //~ ERROR use of deprecated item
+}
+
+fn main() {}
diff --git a/src/test/compile-fail/lint-stability-fields-deprecated.rs b/src/test/compile-fail/lint-stability-fields-deprecated.rs
new file mode 100644
index 00000000000..5da3e1a930d
--- /dev/null
+++ b/src/test/compile-fail/lint-stability-fields-deprecated.rs
@@ -0,0 +1,348 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// aux-build:lint_stability_fields.rs
+#![deny(deprecated)]
+#![allow(dead_code)]
+#![feature(staged_api, test_feature)]
+
+#![stable(feature = "rust1", since = "1.0.0")]
+
+mod cross_crate {
+    extern crate lint_stability_fields;
+
+    use self::lint_stability_fields::*;
+
+    pub fn foo() {
+        let x = Stable {
+            inherit: 1,
+            override1: 2,
+            override2: 3,
+            //~^ ERROR use of deprecated item
+        };
+
+        let _ = x.inherit;
+        let _ = x.override1;
+        let _ = x.override2;
+        //~^ ERROR use of deprecated item
+
+        let Stable {
+            inherit: _,
+            override1: _,
+            override2: _
+            //~^ ERROR use of deprecated item
+        } = x;
+        // all fine
+        let Stable { .. } = x;
+
+        let x = Stable2(1, 2, 3);
+
+        let _ = x.0;
+        let _ = x.1;
+        let _ = x.2;
+        //~^ ERROR use of deprecated item
+
+        let Stable2(_,
+                   _,
+                   _)
+            //~^ ERROR use of deprecated item
+            = x;
+        // all fine
+        let Stable2(..) = x;
+
+
+        let x = Unstable {
+            inherit: 1,
+            override1: 2,
+            override2: 3,
+            //~^ ERROR use of deprecated item
+        };
+
+        let _ = x.inherit;
+        let _ = x.override1;
+        let _ = x.override2;
+        //~^ ERROR use of deprecated item
+
+        let Unstable {
+            inherit: _,
+            override1: _,
+            override2: _
+            //~^ ERROR use of deprecated item
+        } = x;
+
+        let Unstable
+            // the patterns are all fine:
+            { .. } = x;
+
+
+        let x = Unstable2(1, 2, 3);
+
+        let _ = x.0;
+        let _ = x.1;
+        let _ = x.2;
+        //~^ ERROR use of deprecated item
+
+        let Unstable2
+            (_,
+             _,
+             _)
+            //~^ ERROR use of deprecated item
+            = x;
+        let Unstable2
+            // the patterns are all fine:
+            (..) = x;
+
+
+        let x = Deprecated {
+            //~^ ERROR use of deprecated item
+            inherit: 1,
+            //~^ ERROR use of deprecated item
+            override1: 2,
+            //~^ ERROR use of deprecated item
+            override2: 3,
+            //~^ ERROR use of deprecated item
+        };
+
+        let _ = x.inherit;
+        //~^ ERROR use of deprecated item
+        let _ = x.override1;
+        //~^ ERROR use of deprecated item
+        let _ = x.override2;
+        //~^ ERROR use of deprecated item
+
+        let Deprecated {
+            //~^ ERROR use of deprecated item
+            inherit: _,
+            //~^ ERROR use of deprecated item
+            override1: _,
+            //~^ ERROR use of deprecated item
+            override2: _
+            //~^ ERROR use of deprecated item
+        } = x;
+
+        let Deprecated
+            //~^ ERROR use of deprecated item
+            // the patterns are all fine:
+            { .. } = x;
+
+        let x = Deprecated2(1, 2, 3);
+        //~^ ERROR use of deprecated item
+
+        let _ = x.0;
+        //~^ ERROR use of deprecated item
+        let _ = x.1;
+        //~^ ERROR use of deprecated item
+        let _ = x.2;
+        //~^ ERROR use of deprecated item
+
+        let Deprecated2
+        //~^ ERROR use of deprecated item
+            (_,
+             //~^ ERROR use of deprecated item
+             _,
+             //~^ ERROR use of deprecated item
+             _)
+             //~^ ERROR use of deprecated item
+            = x;
+        let Deprecated2
+        //~^ ERROR use of deprecated item
+            // the patterns are all fine:
+            (..) = x;
+    }
+}
+
+mod this_crate {
+    #[stable(feature = "rust1", since = "1.0.0")]
+    struct Stable {
+        inherit: u8,
+        #[unstable(feature = "test_feature", issue = "0")]
+        override1: u8,
+        #[rustc_deprecated(since = "1.0.0", reason = "text")]
+        #[unstable(feature = "test_feature", issue = "0")]
+        override2: u8,
+    }
+
+    #[stable(feature = "rust1", since = "1.0.0")]
+    struct Stable2(u8,
+                   #[stable(feature = "rust1", since = "1.0.0")] u8,
+                   #[unstable(feature = "test_feature", issue = "0")]
+                   #[rustc_deprecated(since = "1.0.0", reason = "text")] u8);
+
+    #[unstable(feature = "test_feature", issue = "0")]
+    struct Unstable {
+        inherit: u8,
+        #[stable(feature = "rust1", since = "1.0.0")]
+        override1: u8,
+        #[rustc_deprecated(since = "1.0.0", reason = "text")]
+        #[unstable(feature = "test_feature", issue = "0")]
+        override2: u8,
+    }
+
+    #[unstable(feature = "test_feature", issue = "0")]
+    struct Unstable2(u8,
+                     #[stable(feature = "rust1", since = "1.0.0")] u8,
+                     #[unstable(feature = "test_feature", issue = "0")]
+                     #[rustc_deprecated(since = "1.0.0", reason = "text")] u8);
+
+    #[unstable(feature = "test_feature", issue = "0")]
+    #[rustc_deprecated(since = "1.0.0", reason = "text")]
+    struct Deprecated {
+        inherit: u8,
+        #[stable(feature = "rust1", since = "1.0.0")]
+        override1: u8,
+        #[unstable(feature = "test_feature", issue = "0")]
+        override2: u8,
+    }
+
+    #[unstable(feature = "test_feature", issue = "0")]
+    #[rustc_deprecated(since = "1.0.0", reason = "text")]
+    struct Deprecated2(u8,
+                       #[stable(feature = "rust1", since = "1.0.0")] u8,
+                       #[unstable(feature = "test_feature", issue = "0")] u8);
+
+    pub fn foo() {
+        let x = Stable {
+            inherit: 1,
+            override1: 2,
+            override2: 3,
+            //~^ ERROR use of deprecated item
+        };
+
+        let _ = x.inherit;
+        let _ = x.override1;
+        let _ = x.override2;
+        //~^ ERROR use of deprecated item
+
+        let Stable {
+            inherit: _,
+            override1: _,
+            override2: _
+            //~^ ERROR use of deprecated item
+        } = x;
+        // all fine
+        let Stable { .. } = x;
+
+        let x = Stable2(1, 2, 3);
+
+        let _ = x.0;
+        let _ = x.1;
+        let _ = x.2;
+        //~^ ERROR use of deprecated item
+
+        let Stable2(_,
+                   _,
+                   _)
+            //~^ ERROR use of deprecated item
+            = x;
+        // all fine
+        let Stable2(..) = x;
+
+
+        let x = Unstable {
+            inherit: 1,
+            override1: 2,
+            override2: 3,
+            //~^ ERROR use of deprecated item
+        };
+
+        let _ = x.inherit;
+        let _ = x.override1;
+        let _ = x.override2;
+        //~^ ERROR use of deprecated item
+
+        let Unstable {
+            inherit: _,
+            override1: _,
+            override2: _
+            //~^ ERROR use of deprecated item
+        } = x;
+
+        let Unstable
+            // the patterns are all fine:
+            { .. } = x;
+
+
+        let x = Unstable2(1, 2, 3);
+
+        let _ = x.0;
+        let _ = x.1;
+        let _ = x.2;
+        //~^ ERROR use of deprecated item
+
+        let Unstable2
+            (_,
+             _,
+             _)
+            //~^ ERROR use of deprecated item
+            = x;
+        let Unstable2
+            // the patterns are all fine:
+            (..) = x;
+
+
+        let x = Deprecated {
+            //~^ ERROR use of deprecated item
+            inherit: 1,
+            //~^ ERROR use of deprecated item
+            override1: 2,
+            //~^ ERROR use of deprecated item
+            override2: 3,
+            //~^ ERROR use of deprecated item
+        };
+
+        let _ = x.inherit;
+        //~^ ERROR use of deprecated item
+        let _ = x.override1;
+        //~^ ERROR use of deprecated item
+        let _ = x.override2;
+        //~^ ERROR use of deprecated item
+
+        let Deprecated {
+            //~^ ERROR use of deprecated item
+            inherit: _,
+            //~^ ERROR use of deprecated item
+            override1: _,
+            //~^ ERROR use of deprecated item
+            override2: _
+            //~^ ERROR use of deprecated item
+        } = x;
+
+        let Deprecated
+            //~^ ERROR use of deprecated item
+            // the patterns are all fine:
+            { .. } = x;
+
+        let x = Deprecated2(1, 2, 3);
+        //~^ ERROR use of deprecated item
+
+        let _ = x.0;
+        //~^ ERROR use of deprecated item
+        let _ = x.1;
+        //~^ ERROR use of deprecated item
+        let _ = x.2;
+        //~^ ERROR use of deprecated item
+
+        let Deprecated2
+        //~^ ERROR use of deprecated item
+            (_,
+             //~^ ERROR use of deprecated item
+             _,
+             //~^ ERROR use of deprecated item
+             _)
+            //~^ ERROR use of deprecated item
+            = x;
+        let Deprecated2
+        //~^ ERROR use of deprecated item
+            // the patterns are all fine:
+            (..) = x;
+    }
+}
+
+fn main() {}
diff --git a/src/test/compile-fail/lint-stability-fields.rs b/src/test/compile-fail/lint-stability-fields.rs
index d63e1f901f5..1b605bdb893 100644
--- a/src/test/compile-fail/lint-stability-fields.rs
+++ b/src/test/compile-fail/lint-stability-fields.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // aux-build:lint_stability_fields.rs
-#![deny(deprecated)]
+#![allow(deprecated)]
 #![allow(dead_code)]
 #![feature(staged_api)]
 
@@ -24,23 +24,17 @@ mod cross_crate {
         let x = Stable {
             inherit: 1,
             override1: 2, //~ ERROR use of unstable
-            override2: 3,
-            //~^ ERROR use of deprecated item
-            //~^^ ERROR use of unstable
+            override2: 3, //~ ERROR use of unstable
         };
 
         let _ = x.inherit;
         let _ = x.override1; //~ ERROR use of unstable
-        let _ = x.override2;
-        //~^ ERROR use of deprecated item
-        //~^^ ERROR use of unstable
+        let _ = x.override2; //~ ERROR use of unstable
 
         let Stable {
             inherit: _,
             override1: _, //~ ERROR use of unstable
-            override2: _
-            //~^ ERROR use of deprecated item
-            //~^^ ERROR use of unstable
+            override2: _ //~ ERROR use of unstable
         } = x;
         // all fine
         let Stable { .. } = x;
@@ -49,15 +43,11 @@ mod cross_crate {
 
         let _ = x.0;
         let _ = x.1; //~ ERROR use of unstable
-        let _ = x.2;
-        //~^ ERROR use of deprecated item
-        //~^^ ERROR use of unstable
+        let _ = x.2; //~ ERROR use of unstable
 
         let Stable2(_,
                    _, //~ ERROR use of unstable
-                   _)
-            //~^ ERROR use of deprecated item
-            //~^^ ERROR use of unstable
+                   _) //~ ERROR use of unstable
             = x;
         // all fine
         let Stable2(..) = x;
@@ -66,23 +56,17 @@ mod cross_crate {
         let x = Unstable { //~ ERROR use of unstable
             inherit: 1, //~ ERROR use of unstable
             override1: 2,
-            override2: 3,
-            //~^ ERROR use of deprecated item
-            //~^^ ERROR use of unstable
+            override2: 3, //~ ERROR use of unstable
         };
 
         let _ = x.inherit; //~ ERROR use of unstable
         let _ = x.override1;
-        let _ = x.override2;
-        //~^ ERROR use of deprecated item
-        //~^^ ERROR use of unstable
+        let _ = x.override2; //~ ERROR use of unstable
 
         let Unstable { //~ ERROR use of unstable
             inherit: _, //~ ERROR use of unstable
             override1: _,
-            override2: _
-            //~^ ERROR use of deprecated item
-            //~^^ ERROR use of unstable
+            override2: _ //~ ERROR use of unstable
         } = x;
 
         let Unstable  //~ ERROR use of unstable
@@ -94,91 +78,50 @@ mod cross_crate {
 
         let _ = x.0; //~ ERROR use of unstable
         let _ = x.1;
-        let _ = x.2;
-        //~^ ERROR use of deprecated item
-        //~^^ ERROR use of unstable
+        let _ = x.2; //~ ERROR use of unstable
 
         let Unstable2  //~ ERROR use of unstable
             (_, //~ ERROR use of unstable
              _,
-             _)
-            //~^ ERROR use of deprecated item
-            //~^^ ERROR use of unstable
+             _) //~ ERROR use of unstable
             = x;
         let Unstable2 //~ ERROR use of unstable
             // the patterns are all fine:
             (..) = x;
 
 
-        let x = Deprecated {
-            //~^ ERROR use of deprecated item
-            //~^^ ERROR use of unstable
-            inherit: 1,
-            //~^ ERROR use of deprecated item
-            //~^^ ERROR use of unstable
+        let x = Deprecated { //~ ERROR use of unstable
+            inherit: 1, //~ ERROR use of unstable
             override1: 2,
-            //~^ ERROR use of deprecated item
-            override2: 3,
-            //~^ ERROR use of deprecated item
-            //~^^ ERROR use of unstable
+            override2: 3, //~ ERROR use of unstable
         };
 
-        let _ = x.inherit;
-        //~^ ERROR use of deprecated item
-        //~^^ ERROR use of unstable
+        let _ = x.inherit; //~ ERROR use of unstable
         let _ = x.override1;
-        //~^ ERROR use of deprecated item
-        let _ = x.override2;
-        //~^ ERROR use of deprecated item
-        //~^^ ERROR use of unstable
+        let _ = x.override2; //~ ERROR use of unstable
 
-        let Deprecated {
-            //~^ ERROR use of deprecated item
-            //~^^ ERROR use of unstable
-            inherit: _,
-            //~^ ERROR use of deprecated item
-            //~^^ ERROR use of unstable
+        let Deprecated { //~ ERROR use of unstable
+            inherit: _, //~ ERROR use of unstable
             override1: _,
-            //~^ ERROR use of deprecated item
-            override2: _
-            //~^ ERROR use of unstable
-            //~^^ ERROR use of deprecated item
+            override2: _ //~ ERROR use of unstable
         } = x;
 
-        let Deprecated
-            //~^ ERROR use of deprecated item
-            //~^^ ERROR use of unstable
+        let Deprecated //~ ERROR use of unstable
             // the patterns are all fine:
             { .. } = x;
 
-        let x = Deprecated2(1, 2, 3);
-        //~^ ERROR use of deprecated item
-        //~^^ ERROR use of unstable
+        let x = Deprecated2(1, 2, 3); //~ ERROR use of unstable
 
-        let _ = x.0;
-        //~^ ERROR use of deprecated item
-        //~^^ ERROR use of unstable
+        let _ = x.0; //~ ERROR use of unstable
         let _ = x.1;
-        //~^ ERROR use of deprecated item
-        let _ = x.2;
-        //~^ ERROR use of deprecated item
-        //~^^ ERROR use of unstable
+        let _ = x.2; //~ ERROR use of unstable
 
-        let Deprecated2
-        //~^ ERROR use of deprecated item
-        //~^^ ERROR use of unstable
-            (_,
-             //~^ ERROR use of deprecated item
-             //~^^ ERROR use of unstable
+        let Deprecated2 //~ ERROR use of unstable
+            (_, //~ ERROR use of unstable
              _,
-             //~^ ERROR use of deprecated item
-             _)
-             //~^ ERROR use of deprecated item
-             //~^^ ERROR use of unstable
+             _) //~ ERROR use of unstable
             = x;
-        let Deprecated2
-        //~^ ERROR use of deprecated item
-        //~^^ ERROR use of unstable
+        let Deprecated2 //~ ERROR use of unstable
             // the patterns are all fine:
             (..) = x;
     }
@@ -238,19 +181,16 @@ mod this_crate {
             inherit: 1,
             override1: 2,
             override2: 3,
-            //~^ ERROR use of deprecated item
         };
 
         let _ = x.inherit;
         let _ = x.override1;
         let _ = x.override2;
-        //~^ ERROR use of deprecated item
 
         let Stable {
             inherit: _,
             override1: _,
             override2: _
-            //~^ ERROR use of deprecated item
         } = x;
         // all fine
         let Stable { .. } = x;
@@ -260,12 +200,10 @@ mod this_crate {
         let _ = x.0;
         let _ = x.1;
         let _ = x.2;
-        //~^ ERROR use of deprecated item
 
         let Stable2(_,
                    _,
                    _)
-            //~^ ERROR use of deprecated item
             = x;
         // all fine
         let Stable2(..) = x;
@@ -275,19 +213,16 @@ mod this_crate {
             inherit: 1,
             override1: 2,
             override2: 3,
-            //~^ ERROR use of deprecated item
         };
 
         let _ = x.inherit;
         let _ = x.override1;
         let _ = x.override2;
-        //~^ ERROR use of deprecated item
 
         let Unstable {
             inherit: _,
             override1: _,
             override2: _
-            //~^ ERROR use of deprecated item
         } = x;
 
         let Unstable
@@ -300,13 +235,11 @@ mod this_crate {
         let _ = x.0;
         let _ = x.1;
         let _ = x.2;
-        //~^ ERROR use of deprecated item
 
         let Unstable2
             (_,
              _,
              _)
-            //~^ ERROR use of deprecated item
             = x;
         let Unstable2
             // the patterns are all fine:
@@ -314,58 +247,37 @@ mod this_crate {
 
 
         let x = Deprecated {
-            //~^ ERROR use of deprecated item
             inherit: 1,
-            //~^ ERROR use of deprecated item
             override1: 2,
-            //~^ ERROR use of deprecated item
             override2: 3,
-            //~^ ERROR use of deprecated item
         };
 
         let _ = x.inherit;
-        //~^ ERROR use of deprecated item
         let _ = x.override1;
-        //~^ ERROR use of deprecated item
         let _ = x.override2;
-        //~^ ERROR use of deprecated item
 
         let Deprecated {
-            //~^ ERROR use of deprecated item
             inherit: _,
-            //~^ ERROR use of deprecated item
             override1: _,
-            //~^ ERROR use of deprecated item
             override2: _
-            //~^ ERROR use of deprecated item
         } = x;
 
         let Deprecated
-            //~^ ERROR use of deprecated item
             // the patterns are all fine:
             { .. } = x;
 
         let x = Deprecated2(1, 2, 3);
-        //~^ ERROR use of deprecated item
 
         let _ = x.0;
-        //~^ ERROR use of deprecated item
         let _ = x.1;
-        //~^ ERROR use of deprecated item
         let _ = x.2;
-        //~^ ERROR use of deprecated item
 
         let Deprecated2
-        //~^ ERROR use of deprecated item
             (_,
-             //~^ ERROR use of deprecated item
              _,
-             //~^ ERROR use of deprecated item
              _)
-            //~^ ERROR use of deprecated item
             = x;
         let Deprecated2
-        //~^ ERROR use of deprecated item
             // the patterns are all fine:
             (..) = x;
     }
diff --git a/src/test/compile-fail/lint-stability.rs b/src/test/compile-fail/lint-stability.rs
index 953cd4a2ff5..1ece7a0b8e3 100644
--- a/src/test/compile-fail/lint-stability.rs
+++ b/src/test/compile-fail/lint-stability.rs
@@ -13,7 +13,7 @@
 // aux-build:stability_cfg1.rs
 // aux-build:stability_cfg2.rs
 
-#![deny(deprecated)]
+#![allow(deprecated)]
 #![allow(dead_code)]
 #![feature(staged_api)]
 
@@ -32,81 +32,46 @@ mod cross_crate {
         type Foo = MethodTester;
         let foo = MethodTester;
 
-        deprecated(); //~ ERROR use of deprecated item
-        foo.method_deprecated(); //~ ERROR use of deprecated item
-        Foo::method_deprecated(&foo); //~ ERROR use of deprecated item
-        <Foo>::method_deprecated(&foo); //~ ERROR use of deprecated item
-        foo.trait_deprecated(); //~ ERROR use of deprecated item
-        Trait::trait_deprecated(&foo); //~ ERROR use of deprecated item
-        <Foo>::trait_deprecated(&foo); //~ ERROR use of deprecated item
-        <Foo as Trait>::trait_deprecated(&foo); //~ ERROR use of deprecated item
-
-        deprecated_text(); //~ ERROR use of deprecated item: text
-        foo.method_deprecated_text(); //~ ERROR use of deprecated item: text
-        Foo::method_deprecated_text(&foo); //~ ERROR use of deprecated item: text
-        <Foo>::method_deprecated_text(&foo); //~ ERROR use of deprecated item: text
-        foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
-        Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
-        <Foo>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
-        <Foo as Trait>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
-
-        deprecated_unstable(); //~ ERROR use of deprecated item
+        deprecated();
+        foo.method_deprecated();
+        Foo::method_deprecated(&foo);
+        <Foo>::method_deprecated(&foo);
+        foo.trait_deprecated();
+        Trait::trait_deprecated(&foo);
+        <Foo>::trait_deprecated(&foo);
+        <Foo as Trait>::trait_deprecated(&foo);
+
+        deprecated_text();
+        foo.method_deprecated_text();
+        Foo::method_deprecated_text(&foo);
+        <Foo>::method_deprecated_text(&foo);
+        foo.trait_deprecated_text();
+        Trait::trait_deprecated_text(&foo);
+        <Foo>::trait_deprecated_text(&foo);
+        <Foo as Trait>::trait_deprecated_text(&foo);
+
+        deprecated_unstable();
         //~^ ERROR use of unstable library feature
-        foo.method_deprecated_unstable(); //~ ERROR use of deprecated item
+        Trait::trait_deprecated_unstable(&foo);
         //~^ ERROR use of unstable library feature
-        Foo::method_deprecated_unstable(&foo); //~ ERROR use of deprecated item
-        //~^ ERROR use of unstable library feature
-        <Foo>::method_deprecated_unstable(&foo); //~ ERROR use of deprecated item
-        //~^ ERROR use of unstable library feature
-        foo.trait_deprecated_unstable(); //~ ERROR use of deprecated item
-        //~^ ERROR use of unstable library feature
-        Trait::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item
-        //~^ ERROR use of unstable library feature
-        <Foo>::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item
-        //~^ ERROR use of unstable library feature
-        <Foo as Trait>::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item
+        <Foo as Trait>::trait_deprecated_unstable(&foo);
         //~^ ERROR use of unstable library feature
 
-        deprecated_unstable_text(); //~ ERROR use of deprecated item: text
-        //~^ ERROR use of unstable library feature
-        foo.method_deprecated_unstable_text(); //~ ERROR use of deprecated item: text
-        //~^ ERROR use of unstable library feature
-        Foo::method_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
-        //~^ ERROR use of unstable library feature
-        <Foo>::method_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
-        //~^ ERROR use of unstable library feature
-        foo.trait_deprecated_unstable_text(); //~ ERROR use of deprecated item: text
+        deprecated_unstable_text();
         //~^ ERROR use of unstable library feature
-        Trait::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
+        Trait::trait_deprecated_unstable_text(&foo);
         //~^ ERROR use of unstable library feature
-        <Foo>::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
-        //~^ ERROR use of unstable library feature
-        <Foo as Trait>::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
+        <Foo as Trait>::trait_deprecated_unstable_text(&foo);
         //~^ ERROR use of unstable library feature
 
         unstable(); //~ ERROR use of unstable library feature
-        foo.method_unstable(); //~ ERROR use of unstable library feature
-        Foo::method_unstable(&foo); //~ ERROR use of unstable library feature
-        <Foo>::method_unstable(&foo); //~ ERROR use of unstable library feature
-        foo.trait_unstable(); //~ ERROR use of unstable library feature
         Trait::trait_unstable(&foo); //~ ERROR use of unstable library feature
-        <Foo>::trait_unstable(&foo); //~ ERROR use of unstable library feature
         <Foo as Trait>::trait_unstable(&foo); //~ ERROR use of unstable library feature
 
         unstable_text();
         //~^ ERROR use of unstable library feature 'test_feature': text
-        foo.method_unstable_text();
-        //~^ ERROR use of unstable library feature 'test_feature': text
-        Foo::method_unstable_text(&foo);
-        //~^ ERROR use of unstable library feature 'test_feature': text
-        <Foo>::method_unstable_text(&foo);
-        //~^ ERROR use of unstable library feature 'test_feature': text
-        foo.trait_unstable_text();
-        //~^ ERROR use of unstable library feature 'test_feature': text
         Trait::trait_unstable_text(&foo);
         //~^ ERROR use of unstable library feature 'test_feature': text
-        <Foo>::trait_unstable_text(&foo);
-        //~^ ERROR use of unstable library feature 'test_feature': text
         <Foo as Trait>::trait_unstable_text(&foo);
         //~^ ERROR use of unstable library feature 'test_feature': text
 
@@ -131,33 +96,31 @@ mod cross_crate {
         struct S1<T: TraitWithAssociatedTypes>(T::TypeUnstable);
         //~^ ERROR use of unstable library feature
         struct S2<T: TraitWithAssociatedTypes>(T::TypeDeprecated);
-        //~^ ERROR use of deprecated item
 
-        let _ = DeprecatedStruct { //~ ERROR use of deprecated item
-            i: 0 //~ ERROR use of deprecated item
+        let _ = DeprecatedStruct {
+            i: 0
         };
         let _ = DeprecatedUnstableStruct {
-            //~^ ERROR use of deprecated item
-            //~^^ ERROR use of unstable library feature
-            i: 0 //~ ERROR use of deprecated item
+            //~^ ERROR use of unstable library feature
+            i: 0
         };
         let _ = UnstableStruct { i: 0 }; //~ ERROR use of unstable library feature
         let _ = StableStruct { i: 0 };
 
-        let _ = DeprecatedUnitStruct; //~ ERROR use of deprecated item
-        let _ = DeprecatedUnstableUnitStruct; //~ ERROR use of deprecated item
+        let _ = DeprecatedUnitStruct;
+        let _ = DeprecatedUnstableUnitStruct;
         //~^ ERROR use of unstable library feature
         let _ = UnstableUnitStruct; //~ ERROR use of unstable library feature
         let _ = StableUnitStruct;
 
-        let _ = Enum::DeprecatedVariant; //~ ERROR use of deprecated item
-        let _ = Enum::DeprecatedUnstableVariant; //~ ERROR use of deprecated item
+        let _ = Enum::DeprecatedVariant;
+        let _ = Enum::DeprecatedUnstableVariant;
         //~^ ERROR use of unstable library feature
         let _ = Enum::UnstableVariant; //~ ERROR use of unstable library feature
         let _ = Enum::StableVariant;
 
-        let _ = DeprecatedTupleStruct (1); //~ ERROR use of deprecated item
-        let _ = DeprecatedUnstableTupleStruct (1); //~ ERROR use of deprecated item
+        let _ = DeprecatedTupleStruct (1);
+        let _ = DeprecatedUnstableTupleStruct (1);
         //~^ ERROR use of unstable library feature
         let _ = UnstableTupleStruct (1); //~ ERROR use of unstable library feature
         let _ = StableTupleStruct (1);
@@ -167,47 +130,33 @@ mod cross_crate {
         // Eventually, we will want to lint the contents of the
         // macro in the module *defining* it. Also, stability levels
         // on macros themselves are not yet linted.
-        macro_test_arg!(deprecated_text()); //~ ERROR use of deprecated item: text
-        macro_test_arg!(deprecated_unstable_text()); //~ ERROR use of deprecated item: text
+        macro_test_arg!(deprecated_text());
+        macro_test_arg!(deprecated_unstable_text());
         //~^ ERROR use of unstable library feature
-        macro_test_arg!(macro_test_arg!(deprecated_text())); //~ ERROR use of deprecated item: text
+        macro_test_arg!(macro_test_arg!(deprecated_text()));
     }
 
     fn test_method_param<Foo: Trait>(foo: Foo) {
-        foo.trait_deprecated(); //~ ERROR use of deprecated item
-        Trait::trait_deprecated(&foo); //~ ERROR use of deprecated item
-        <Foo>::trait_deprecated(&foo); //~ ERROR use of deprecated item
-        <Foo as Trait>::trait_deprecated(&foo); //~ ERROR use of deprecated item
-        foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
-        Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
-        <Foo>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
-        <Foo as Trait>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
-        foo.trait_deprecated_unstable(); //~ ERROR use of deprecated item
-        //~^ ERROR use of unstable library feature
-        Trait::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item
-        //~^ ERROR use of unstable library feature
-        <Foo>::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item
-        //~^ ERROR use of unstable library feature
-        <Foo as Trait>::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item
-        //~^ ERROR use of unstable library feature
-        foo.trait_deprecated_unstable_text(); //~ ERROR use of deprecated item: text
+        foo.trait_deprecated();
+        Trait::trait_deprecated(&foo);
+        <Foo>::trait_deprecated(&foo);
+        <Foo as Trait>::trait_deprecated(&foo);
+        foo.trait_deprecated_text();
+        Trait::trait_deprecated_text(&foo);
+        <Foo>::trait_deprecated_text(&foo);
+        <Foo as Trait>::trait_deprecated_text(&foo);
+        Trait::trait_deprecated_unstable(&foo);
         //~^ ERROR use of unstable library feature
-        Trait::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
+        <Foo as Trait>::trait_deprecated_unstable(&foo);
         //~^ ERROR use of unstable library feature
-        <Foo>::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
+        Trait::trait_deprecated_unstable_text(&foo);
         //~^ ERROR use of unstable library feature
-        <Foo as Trait>::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
+        <Foo as Trait>::trait_deprecated_unstable_text(&foo);
         //~^ ERROR use of unstable library feature
-        foo.trait_unstable(); //~ ERROR use of unstable library feature
         Trait::trait_unstable(&foo); //~ ERROR use of unstable library feature
-        <Foo>::trait_unstable(&foo); //~ ERROR use of unstable library feature
         <Foo as Trait>::trait_unstable(&foo); //~ ERROR use of unstable library feature
-        foo.trait_unstable_text();
-        //~^ ERROR use of unstable library feature 'test_feature': text
         Trait::trait_unstable_text(&foo);
         //~^ ERROR use of unstable library feature 'test_feature': text
-        <Foo>::trait_unstable_text(&foo);
-        //~^ ERROR use of unstable library feature 'test_feature': text
         <Foo as Trait>::trait_unstable_text(&foo);
         //~^ ERROR use of unstable library feature 'test_feature': text
         foo.trait_stable();
@@ -217,24 +166,17 @@ mod cross_crate {
     }
 
     fn test_method_object(foo: &Trait) {
-        foo.trait_deprecated(); //~ ERROR use of deprecated item
-        foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
-        foo.trait_deprecated_unstable(); //~ ERROR use of deprecated item
-        //~^ ERROR use of unstable library feature
-        foo.trait_deprecated_unstable_text(); //~ ERROR use of deprecated item: text
-        //~^ ERROR use of unstable library feature
-        foo.trait_unstable(); //~ ERROR use of unstable library feature
-        foo.trait_unstable_text();
-        //~^ ERROR use of unstable library feature 'test_feature': text
+        foo.trait_deprecated();
+        foo.trait_deprecated_text();
         foo.trait_stable();
     }
 
     struct S;
 
     impl UnstableTrait for S { } //~ ERROR use of unstable library feature
-    impl DeprecatedTrait for S {} //~ ERROR use of deprecated item: text
+    impl DeprecatedTrait for S {}
     trait LocalTrait : UnstableTrait { } //~ ERROR use of unstable library feature
-    trait LocalTrait2 : DeprecatedTrait { } //~ ERROR use of deprecated item: text
+    trait LocalTrait2 : DeprecatedTrait { }
 
     impl Trait for S {
         fn trait_stable(&self) {}
@@ -253,14 +195,13 @@ mod inheritance {
         stable_mod::unstable(); //~ ERROR use of unstable library feature
         stable_mod::stable();
 
-        unstable_mod::deprecated(); //~ ERROR use of deprecated item
+        unstable_mod::deprecated();
         unstable_mod::unstable(); //~ ERROR use of unstable library feature
 
         let _ = Unstable::UnstableVariant; //~ ERROR use of unstable library feature
         let _ = Unstable::StableVariant;
 
         let x: usize = 0;
-        x.unstable(); //~ ERROR use of unstable library feature
         x.stable();
     }
 }
@@ -375,23 +316,23 @@ mod this_crate {
         type Foo = MethodTester;
         let foo = MethodTester;
 
-        deprecated(); //~ ERROR use of deprecated item
-        foo.method_deprecated(); //~ ERROR use of deprecated item
-        Foo::method_deprecated(&foo); //~ ERROR use of deprecated item
-        <Foo>::method_deprecated(&foo); //~ ERROR use of deprecated item
-        foo.trait_deprecated(); //~ ERROR use of deprecated item
-        Trait::trait_deprecated(&foo); //~ ERROR use of deprecated item
-        <Foo>::trait_deprecated(&foo); //~ ERROR use of deprecated item
-        <Foo as Trait>::trait_deprecated(&foo); //~ ERROR use of deprecated item
-
-        deprecated_text(); //~ ERROR use of deprecated item: text
-        foo.method_deprecated_text(); //~ ERROR use of deprecated item: text
-        Foo::method_deprecated_text(&foo); //~ ERROR use of deprecated item: text
-        <Foo>::method_deprecated_text(&foo); //~ ERROR use of deprecated item: text
-        foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
-        Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
-        <Foo>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
-        <Foo as Trait>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
+        deprecated();
+        foo.method_deprecated();
+        Foo::method_deprecated(&foo);
+        <Foo>::method_deprecated(&foo);
+        foo.trait_deprecated();
+        Trait::trait_deprecated(&foo);
+        <Foo>::trait_deprecated(&foo);
+        <Foo as Trait>::trait_deprecated(&foo);
+
+        deprecated_text();
+        foo.method_deprecated_text();
+        Foo::method_deprecated_text(&foo);
+        <Foo>::method_deprecated_text(&foo);
+        foo.trait_deprecated_text();
+        Trait::trait_deprecated_text(&foo);
+        <Foo>::trait_deprecated_text(&foo);
+        <Foo as Trait>::trait_deprecated_text(&foo);
 
         unstable();
         foo.method_unstable();
@@ -430,34 +371,33 @@ mod this_crate {
         <Foo as Trait>::trait_stable_text(&foo);
 
         let _ = DeprecatedStruct {
-            //~^ ERROR use of deprecated item
-            i: 0 //~ ERROR use of deprecated item
+            i: 0
         };
         let _ = UnstableStruct { i: 0 };
         let _ = StableStruct { i: 0 };
 
-        let _ = DeprecatedUnitStruct; //~ ERROR use of deprecated item
+        let _ = DeprecatedUnitStruct;
         let _ = UnstableUnitStruct;
         let _ = StableUnitStruct;
 
-        let _ = Enum::DeprecatedVariant; //~ ERROR use of deprecated item
+        let _ = Enum::DeprecatedVariant;
         let _ = Enum::UnstableVariant;
         let _ = Enum::StableVariant;
 
-        let _ = DeprecatedTupleStruct (1); //~ ERROR use of deprecated item
+        let _ = DeprecatedTupleStruct (1);
         let _ = UnstableTupleStruct (1);
         let _ = StableTupleStruct (1);
     }
 
     fn test_method_param<Foo: Trait>(foo: Foo) {
-        foo.trait_deprecated(); //~ ERROR use of deprecated item
-        Trait::trait_deprecated(&foo); //~ ERROR use of deprecated item
-        <Foo>::trait_deprecated(&foo); //~ ERROR use of deprecated item
-        <Foo as Trait>::trait_deprecated(&foo); //~ ERROR use of deprecated item
-        foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
-        Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
-        <Foo>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
-        <Foo as Trait>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
+        foo.trait_deprecated();
+        Trait::trait_deprecated(&foo);
+        <Foo>::trait_deprecated(&foo);
+        <Foo as Trait>::trait_deprecated(&foo);
+        foo.trait_deprecated_text();
+        Trait::trait_deprecated_text(&foo);
+        <Foo>::trait_deprecated_text(&foo);
+        <Foo as Trait>::trait_deprecated_text(&foo);
         foo.trait_unstable();
         Trait::trait_unstable(&foo);
         <Foo>::trait_unstable(&foo);
@@ -473,8 +413,8 @@ mod this_crate {
     }
 
     fn test_method_object(foo: &Trait) {
-        foo.trait_deprecated(); //~ ERROR use of deprecated item
-        foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
+        foo.trait_deprecated();
+        foo.trait_deprecated_text();
         foo.trait_unstable();
         foo.trait_unstable_text();
         foo.trait_stable();
@@ -484,7 +424,7 @@ mod this_crate {
     #[rustc_deprecated(since = "1.0.0", reason = "text")]
     fn test_fn_body() {
         fn fn_in_body() {}
-        fn_in_body(); //~ ERROR use of deprecated item: text
+        fn_in_body();
     }
 
     impl MethodTester {
@@ -492,7 +432,7 @@ mod this_crate {
         #[rustc_deprecated(since = "1.0.0", reason = "text")]
         fn test_method_body(&self) {
             fn fn_in_body() {}
-            fn_in_body(); //~ ERROR use of deprecated item: text
+            fn_in_body();
         }
     }
 
@@ -504,9 +444,9 @@ mod this_crate {
 
     struct S;
 
-    impl DeprecatedTrait for S { } //~ ERROR use of deprecated item
+    impl DeprecatedTrait for S { }
 
-    trait LocalTrait : DeprecatedTrait { } //~ ERROR use of deprecated item
+    trait LocalTrait : DeprecatedTrait { }
 }
 
 fn main() {}
diff --git a/src/test/compile-fail/map-types.rs b/src/test/compile-fail/map-types.rs
index a419c6480e6..e24441c5497 100644
--- a/src/test/compile-fail/map-types.rs
+++ b/src/test/compile-fail/map-types.rs
@@ -10,8 +10,6 @@
 
 #![feature(box_syntax)]
 
-extern crate collections;
-
 use std::collections::HashMap;
 
 trait Map<K, V>
diff --git a/src/test/compile-fail/mir-dataflow/def-inits-1.rs b/src/test/compile-fail/mir-dataflow/def-inits-1.rs
index 1ba1bb35bb5..f3c9f29821e 100644
--- a/src/test/compile-fail/mir-dataflow/def-inits-1.rs
+++ b/src/test/compile-fail/mir-dataflow/def-inits-1.rs
@@ -10,7 +10,7 @@
 
 // General test of maybe_uninits state computed by MIR dataflow.
 
-#![feature(rustc_attrs)]
+#![feature(core_intrinsics, rustc_attrs)]
 
 use std::intrinsics::rustc_peek;
 use std::mem::{drop, replace};
diff --git a/src/test/compile-fail/mir-dataflow/inits-1.rs b/src/test/compile-fail/mir-dataflow/inits-1.rs
index c8cf44adb97..8a5ab6e420a 100644
--- a/src/test/compile-fail/mir-dataflow/inits-1.rs
+++ b/src/test/compile-fail/mir-dataflow/inits-1.rs
@@ -10,7 +10,7 @@
 
 // General test of maybe_inits state computed by MIR dataflow.
 
-#![feature(rustc_attrs)]
+#![feature(core_intrinsics, rustc_attrs)]
 
 use std::intrinsics::rustc_peek;
 use std::mem::{drop, replace};
diff --git a/src/test/compile-fail/mir-dataflow/uninits-1.rs b/src/test/compile-fail/mir-dataflow/uninits-1.rs
index a82bfc89698..8df66ea815c 100644
--- a/src/test/compile-fail/mir-dataflow/uninits-1.rs
+++ b/src/test/compile-fail/mir-dataflow/uninits-1.rs
@@ -10,7 +10,7 @@
 
 // General test of maybe_uninits state computed by MIR dataflow.
 
-#![feature(rustc_attrs)]
+#![feature(core_intrinsics, rustc_attrs)]
 
 use std::intrinsics::rustc_peek;
 use std::mem::{drop, replace};
diff --git a/src/test/compile-fail/mir-dataflow/uninits-2.rs b/src/test/compile-fail/mir-dataflow/uninits-2.rs
index 8cfdae50662..2edd275e786 100644
--- a/src/test/compile-fail/mir-dataflow/uninits-2.rs
+++ b/src/test/compile-fail/mir-dataflow/uninits-2.rs
@@ -10,7 +10,7 @@
 
 // General test of maybe_uninits state computed by MIR dataflow.
 
-#![feature(rustc_attrs)]
+#![feature(core_intrinsics, rustc_attrs)]
 
 use std::intrinsics::rustc_peek;
 use std::mem::{drop, replace};
diff --git a/src/test/compile-fail/non-copyable-void.rs b/src/test/compile-fail/non-copyable-void.rs
index 6067b71280c..4383f3ede0d 100644
--- a/src/test/compile-fail/non-copyable-void.rs
+++ b/src/test/compile-fail/non-copyable-void.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(libc)]
+
 extern crate libc;
 
 fn main() {
diff --git a/src/test/compile-fail/overloaded-calls-bad.rs b/src/test/compile-fail/overloaded-calls-bad.rs
index 0aa9af3c8da..1b8284debb4 100644
--- a/src/test/compile-fail/overloaded-calls-bad.rs
+++ b/src/test/compile-fail/overloaded-calls-bad.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(unboxed_closures)]
+#![feature(fn_traits, unboxed_closures)]
 
 use std::ops::FnMut;
 
diff --git a/src/test/compile-fail/overloaded-calls-nontuple.rs b/src/test/compile-fail/overloaded-calls-nontuple.rs
index ea47d676412..7113224664b 100644
--- a/src/test/compile-fail/overloaded-calls-nontuple.rs
+++ b/src/test/compile-fail/overloaded-calls-nontuple.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(unboxed_closures)]
+#![feature(fn_traits, unboxed_closures)]
 
 use std::ops::FnMut;
 
diff --git a/src/test/compile-fail/range_inclusive_gate.rs b/src/test/compile-fail/range_inclusive_gate.rs
index deac152ec85..1d1153e951b 100644
--- a/src/test/compile-fail/range_inclusive_gate.rs
+++ b/src/test/compile-fail/range_inclusive_gate.rs
@@ -16,10 +16,8 @@
 pub fn main() {
     let _: std::ops::RangeInclusive<_> = { use std::intrinsics; 1 } ... { use std::intrinsics; 2 };
     //~^ ERROR use of unstable library feature 'inclusive_range'
-    //~^^ ERROR core_intrinsics
-    //~^^^ ERROR core_intrinsics
-    //~^^^^ WARN unused_imports
-    //~^^^^^ WARN unused_imports
+    //~| ERROR core_intrinsics
+    //~| ERROR core_intrinsics
 }
 
 
diff --git a/src/test/compile-fail/reflect-assoc.rs b/src/test/compile-fail/reflect-assoc.rs
index 7cac3f41d54..47da97daaff 100644
--- a/src/test/compile-fail/reflect-assoc.rs
+++ b/src/test/compile-fail/reflect-assoc.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(reflect_marker)]
+
 // Test that types that appear in assoc bindings in an object
 // type are subject to the reflect check.
 
diff --git a/src/test/compile-fail/reflect-object-param.rs b/src/test/compile-fail/reflect-object-param.rs
index 476b498ae64..be0dbd801b7 100644
--- a/src/test/compile-fail/reflect-object-param.rs
+++ b/src/test/compile-fail/reflect-object-param.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(reflect_marker)]
+
 // Test that types that appear in input types in an object type are
 // subject to the reflect check.
 
diff --git a/src/test/compile-fail/reflect.rs b/src/test/compile-fail/reflect.rs
index fdd569e2c1b..28ff7c82c2e 100644
--- a/src/test/compile-fail/reflect.rs
+++ b/src/test/compile-fail/reflect.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(reflect_marker)]
+
 // Test that there is no way to get a generic type `T` to be
 // considered as `Reflect` (or accessible via something that is
 // considered `Reflect`) without a reflect bound, but that any
diff --git a/src/test/compile-fail/regions-steal-closure.rs b/src/test/compile-fail/regions-steal-closure.rs
index 8ade8b239b3..59fe1ce3af1 100644
--- a/src/test/compile-fail/regions-steal-closure.rs
+++ b/src/test/compile-fail/regions-steal-closure.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(fn_traits)]
+
 struct closure_box<'a> {
     cl: Box<FnMut() + 'a>,
 }
diff --git a/src/test/compile-fail/resolve_self_super_hint.rs b/src/test/compile-fail/resolve_self_super_hint.rs
index a23ac80fca6..530dc873f75 100644
--- a/src/test/compile-fail/resolve_self_super_hint.rs
+++ b/src/test/compile-fail/resolve_self_super_hint.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(collections)]
+
 mod a {
     extern crate collections;
     use collections::HashMap;
diff --git a/src/test/compile-fail/stability-attribute-sanity-2.rs b/src/test/compile-fail/stability-attribute-sanity-2.rs
index d978d4ce0ea..0ddc3a8dceb 100644
--- a/src/test/compile-fail/stability-attribute-sanity-2.rs
+++ b/src/test/compile-fail/stability-attribute-sanity-2.rs
@@ -23,9 +23,4 @@ fn f2() { }
 #[unstable(feature = "a", issue = "no")] //~ ERROR incorrect 'issue'
 fn f3() { }
 
-#[macro_export]
-macro_rules! mac { //~ ERROR This node does not have a stability attribute
-    () => ()
-}
-
 fn main() { }
diff --git a/src/test/compile-fail/stability-attribute-sanity-3.rs b/src/test/compile-fail/stability-attribute-sanity-3.rs
new file mode 100644
index 00000000000..ddefd24b92f
--- /dev/null
+++ b/src/test/compile-fail/stability-attribute-sanity-3.rs
@@ -0,0 +1,22 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// More checks that stability attributes are used correctly
+
+#![feature(staged_api)]
+
+#![stable(feature = "test_feature", since = "1.0.0")]
+
+#[macro_export]
+macro_rules! mac { //~ ERROR This node does not have a stability attribute
+    () => ()
+}
+
+fn main() { }
diff --git a/src/test/compile-fail/static-mut-foreign-requires-unsafe.rs b/src/test/compile-fail/static-mut-foreign-requires-unsafe.rs
index 0e44af19a7f..f52b128e7e5 100644
--- a/src/test/compile-fail/static-mut-foreign-requires-unsafe.rs
+++ b/src/test/compile-fail/static-mut-foreign-requires-unsafe.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(libc)]
+
 extern crate libc;
 
 extern {
diff --git a/src/test/compile-fail/task-rng-isnt-sendable.rs b/src/test/compile-fail/task-rng-isnt-sendable.rs
index c987d9f2f4e..d85717f8ce5 100644
--- a/src/test/compile-fail/task-rng-isnt-sendable.rs
+++ b/src/test/compile-fail/task-rng-isnt-sendable.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(rand)]
+
 // ensure that the ThreadRng isn't/doesn't become accidentally sendable.
 
 use std::__rand::ThreadRng;
diff --git a/src/test/compile-fail/unboxed-closures-fnmut-as-fn.rs b/src/test/compile-fail/unboxed-closures-fnmut-as-fn.rs
index b25b3318806..2e865b2aac8 100644
--- a/src/test/compile-fail/unboxed-closures-fnmut-as-fn.rs
+++ b/src/test/compile-fail/unboxed-closures-fnmut-as-fn.rs
@@ -11,7 +11,7 @@
 // Checks that the Fn trait hierarchy rules do not permit
 // Fn to be used where FnMut is implemented.
 
-#![feature(unboxed_closures)]
+#![feature(fn_traits, unboxed_closures)]
 #![feature(overloaded_calls)]
 
 use std::ops::{Fn,FnMut,FnOnce};
diff --git a/src/test/compile-fail/unboxed-closures-infer-argument-types-two-region-pointers.rs b/src/test/compile-fail/unboxed-closures-infer-argument-types-two-region-pointers.rs
index 5436a855ee7..bfb24c58722 100644
--- a/src/test/compile-fail/unboxed-closures-infer-argument-types-two-region-pointers.rs
+++ b/src/test/compile-fail/unboxed-closures-infer-argument-types-two-region-pointers.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(fn_traits)]
+
 // That a closure whose expected argument types include two distinct
 // bound regions.
 
diff --git a/src/test/compile-fail/unboxed-closures-recursive-fn-using-fn-mut.rs b/src/test/compile-fail/unboxed-closures-recursive-fn-using-fn-mut.rs
index 23306823c72..433c0c839c5 100644
--- a/src/test/compile-fail/unboxed-closures-recursive-fn-using-fn-mut.rs
+++ b/src/test/compile-fail/unboxed-closures-recursive-fn-using-fn-mut.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(core,unboxed_closures)]
+#![feature(core, fn_traits, unboxed_closures)]
 
 use std::marker::PhantomData;
 
diff --git a/src/test/ui/span/issue-23827.rs b/src/test/ui/span/issue-23827.rs
index a5ab443597b..01269714c16 100644
--- a/src/test/ui/span/issue-23827.rs
+++ b/src/test/ui/span/issue-23827.rs
@@ -10,7 +10,7 @@
 
 // Regression test for #23827
 
-#![feature(core, unboxed_closures)]
+#![feature(core, fn_traits, unboxed_closures)]
 
 pub struct Prototype {
     pub target: u32