about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/doc/reference.md4
-rw-r--r--src/liballoc/lib.rs2
-rw-r--r--src/liballoc_jemalloc/lib.rs2
-rw-r--r--src/liballoc_system/lib.rs2
-rw-r--r--src/libarena/lib.rs2
-rw-r--r--src/libcollections/lib.rs2
-rw-r--r--src/libcore/lib.rs2
-rw-r--r--src/libflate/lib.rs2
-rw-r--r--src/libfmt_macros/lib.rs2
-rw-r--r--src/libgetopts/lib.rs2
-rw-r--r--src/libgraphviz/lib.rs2
m---------src/liblibc0
-rw-r--r--src/liblog/lib.rs2
-rw-r--r--src/librand/lib.rs2
-rw-r--r--src/librbml/lib.rs2
-rw-r--r--src/librustc/lib.rs2
-rw-r--r--src/librustc/metadata/creader.rs7
-rw-r--r--src/librustc/middle/stability.rs14
-rw-r--r--src/librustc_back/lib.rs2
-rw-r--r--src/librustc_bitflags/lib.rs2
-rw-r--r--src/librustc_borrowck/lib.rs2
-rw-r--r--src/librustc_data_structures/lib.rs2
-rw-r--r--src/librustc_driver/lib.rs2
-rw-r--r--src/librustc_front/lib.rs2
-rw-r--r--src/librustc_lint/lib.rs2
-rw-r--r--src/librustc_llvm/lib.rs2
-rw-r--r--src/librustc_platform_intrinsics/lib.rs2
-rw-r--r--src/librustc_privacy/lib.rs2
-rw-r--r--src/librustc_resolve/lib.rs2
-rw-r--r--src/librustc_trans/lib.rs2
-rw-r--r--src/librustc_typeck/lib.rs2
-rw-r--r--src/librustc_unicode/lib.rs2
-rw-r--r--src/librustdoc/lib.rs2
-rw-r--r--src/libserialize/lib.rs2
-rw-r--r--src/libstd/lib.rs2
-rw-r--r--src/libsyntax/feature_gate.rs5
-rw-r--r--src/libsyntax/lib.rs2
-rw-r--r--src/libterm/lib.rs2
-rw-r--r--src/libtest/lib.rs2
-rw-r--r--src/test/auxiliary/inherited_stability.rs1
-rw-r--r--src/test/auxiliary/internal_unstable.rs1
-rw-r--r--src/test/auxiliary/lint_output_format.rs1
-rw-r--r--src/test/auxiliary/lint_stability.rs1
-rw-r--r--src/test/auxiliary/lint_stability_fields.rs1
-rw-r--r--src/test/auxiliary/stability_attribute_issue.rs1
-rw-r--r--src/test/auxiliary/stability_cfg1.rs1
-rw-r--r--src/test/auxiliary/stability_cfg2.rs1
-rw-r--r--src/test/compile-fail/issue-17337.rs1
-rw-r--r--src/test/compile-fail/lint-forbid-cmdline.rs1
-rw-r--r--src/test/compile-fail/lint-stability-fields.rs1
-rw-r--r--src/test/compile-fail/lint-stability.rs1
-rw-r--r--src/test/compile-fail/missing-stability.rs1
-rw-r--r--src/test/compile-fail/stability-attribute-sanity-2.rs1
-rw-r--r--src/test/compile-fail/stability-attribute-sanity.rs1
-rw-r--r--src/test/compile-fail/staged_api.rs13
-rw-r--r--src/test/run-make/allow-warnings-cmdline-stability/bar.rs1
-rw-r--r--src/test/rustdoc/issue-18199.rs1
-rw-r--r--src/test/rustdoc/issue-27759.rs1
58 files changed, 46 insertions, 83 deletions
diff --git a/src/doc/reference.md b/src/doc/reference.md
index 949ffb9a5f0..80194ea27bf 100644
--- a/src/doc/reference.md
+++ b/src/doc/reference.md
@@ -2325,10 +2325,6 @@ The currently implemented features of the reference compiler are:
 * `simd_ffi` - Allows use of SIMD vectors in signatures for foreign functions.
                The SIMD interface is subject to change.
 
-* `staged_api` - Allows usage of stability markers and `#![staged_api]` in a
-                 crate. Stability markers are also attributes: `#[stable]`,
-                 `#[unstable]`, and `#[rustc_deprecated]` are the three levels.
-
 * `start` - Allows use of the `#[start]` attribute, which changes the entry point
             into a Rust program. This capability, especially the signature for the
             annotated function, is subject to change.
diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs
index 3e87b7ebea8..5d31385462c 100644
--- a/src/liballoc/lib.rs
+++ b/src/liballoc/lib.rs
@@ -60,7 +60,7 @@
 #![cfg_attr(stage0, feature(custom_attribute))]
 #![crate_name = "alloc"]
 #![crate_type = "rlib"]
-#![staged_api]
+#![cfg_attr(stage0, staged_api)]
 #![allow(unused_attributes)]
 #![unstable(feature = "alloc",
             reason = "this library is unlikely to be stabilized in its current \
diff --git a/src/liballoc_jemalloc/lib.rs b/src/liballoc_jemalloc/lib.rs
index f53bc404b88..3db6d7f1a7b 100644
--- a/src/liballoc_jemalloc/lib.rs
+++ b/src/liballoc_jemalloc/lib.rs
@@ -11,7 +11,7 @@
 #![cfg_attr(stage0, feature(custom_attribute))]
 #![crate_name = "alloc_jemalloc"]
 #![crate_type = "rlib"]
-#![staged_api]
+#![cfg_attr(stage0, staged_api)]
 #![no_std]
 #![cfg_attr(not(stage0), allocator)]
 #![cfg_attr(stage0, allow(improper_ctypes))]
diff --git a/src/liballoc_system/lib.rs b/src/liballoc_system/lib.rs
index 1befbd61d6d..a0c0d7d0e94 100644
--- a/src/liballoc_system/lib.rs
+++ b/src/liballoc_system/lib.rs
@@ -11,7 +11,7 @@
 #![cfg_attr(stage0, feature(custom_attribute))]
 #![crate_name = "alloc_system"]
 #![crate_type = "rlib"]
-#![staged_api]
+#![cfg_attr(stage0, staged_api)]
 #![no_std]
 #![cfg_attr(not(stage0), allocator)]
 #![cfg_attr(stage0, allow(improper_ctypes))]
diff --git a/src/libarena/lib.rs b/src/libarena/lib.rs
index abc15df804d..7871135e9c2 100644
--- a/src/libarena/lib.rs
+++ b/src/libarena/lib.rs
@@ -23,7 +23,7 @@
 #![cfg_attr(stage0, feature(custom_attribute))]
 #![crate_name = "arena"]
 #![unstable(feature = "rustc_private", issue = "27812")]
-#![staged_api]
+#![cfg_attr(stage0, staged_api)]
 #![crate_type = "rlib"]
 #![crate_type = "dylib"]
 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
diff --git a/src/libcollections/lib.rs b/src/libcollections/lib.rs
index 18cfb5b76fe..b39c3cd4485 100644
--- a/src/libcollections/lib.rs
+++ b/src/libcollections/lib.rs
@@ -16,7 +16,7 @@
 // Do not remove on snapshot creation. Needed for bootstrap. (Issue #22364)
 #![cfg_attr(stage0, feature(custom_attribute))]
 #![crate_name = "collections"]
-#![staged_api]
+#![cfg_attr(stage0, staged_api)]
 #![crate_type = "rlib"]
 #![unstable(feature = "collections",
             reason = "library is unlikely to be stabilized with the current \
diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs
index 3ebf9d6be63..f8bda4b6b2b 100644
--- a/src/libcore/lib.rs
+++ b/src/libcore/lib.rs
@@ -56,7 +56,7 @@
             reason = "the libcore library has not yet been scrutinized for \
                       stabilization in terms of structure and naming",
             issue = "27701")]
-#![staged_api]
+#![cfg_attr(stage0, staged_api)]
 #![crate_type = "rlib"]
 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
        html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
diff --git a/src/libflate/lib.rs b/src/libflate/lib.rs
index c5f0800e71f..02810bf668a 100644
--- a/src/libflate/lib.rs
+++ b/src/libflate/lib.rs
@@ -18,7 +18,7 @@
 #![cfg_attr(stage0, feature(custom_attribute))]
 #![crate_name = "flate"]
 #![unstable(feature = "rustc_private", issue = "27812")]
-#![staged_api]
+#![cfg_attr(stage0, staged_api)]
 #![crate_type = "rlib"]
 #![crate_type = "dylib"]
 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
diff --git a/src/libfmt_macros/lib.rs b/src/libfmt_macros/lib.rs
index 2cd046dc38a..6e185c674a6 100644
--- a/src/libfmt_macros/lib.rs
+++ b/src/libfmt_macros/lib.rs
@@ -18,7 +18,7 @@
 #![cfg_attr(stage0, feature(custom_attribute))]
 #![crate_name = "fmt_macros"]
 #![unstable(feature = "rustc_private", issue = "27812")]
-#![staged_api]
+#![cfg_attr(stage0, staged_api)]
 #![crate_type = "rlib"]
 #![crate_type = "dylib"]
 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
diff --git a/src/libgetopts/lib.rs b/src/libgetopts/lib.rs
index c744121f843..f7544e3f5ea 100644
--- a/src/libgetopts/lib.rs
+++ b/src/libgetopts/lib.rs
@@ -84,7 +84,7 @@
 #![unstable(feature = "rustc_private",
             reason = "use the crates.io `getopts` library instead",
             issue = "27812")]
-#![staged_api]
+#![cfg_attr(stage0, staged_api)]
 #![crate_type = "rlib"]
 #![crate_type = "dylib"]
 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
diff --git a/src/libgraphviz/lib.rs b/src/libgraphviz/lib.rs
index 14a8d78c0b2..c1bd188d3a2 100644
--- a/src/libgraphviz/lib.rs
+++ b/src/libgraphviz/lib.rs
@@ -276,7 +276,7 @@
 #![crate_name = "graphviz"]
 #![unstable(feature = "rustc_private", issue = "27812")]
 #![feature(staged_api)]
-#![staged_api]
+#![cfg_attr(stage0, staged_api)]
 #![crate_type = "rlib"]
 #![crate_type = "dylib"]
 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
diff --git a/src/liblibc b/src/liblibc
-Subproject c27f4167a7706baba1ddbb0a9ab320ec18d097d
+Subproject e6714f3c7032eeff38e0f5bba21e71c551efb97
diff --git a/src/liblog/lib.rs b/src/liblog/lib.rs
index 850c5511dd5..7c71e51ec43 100644
--- a/src/liblog/lib.rs
+++ b/src/liblog/lib.rs
@@ -162,7 +162,7 @@
 #![unstable(feature = "rustc_private",
             reason = "use the crates.io `log` library instead",
             issue = "27812")]
-#![staged_api]
+#![cfg_attr(stage0, staged_api)]
 #![crate_type = "rlib"]
 #![crate_type = "dylib"]
 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
diff --git a/src/librand/lib.rs b/src/librand/lib.rs
index 247dcd03b5d..4d0f5e9f160 100644
--- a/src/librand/lib.rs
+++ b/src/librand/lib.rs
@@ -26,7 +26,7 @@
        html_playground_url = "https://play.rust-lang.org/",
        test(attr(deny(warnings))))]
 #![no_std]
-#![staged_api]
+#![cfg_attr(stage0, staged_api)]
 #![unstable(feature = "rand",
             reason = "use `rand` from crates.io",
             issue = "27703")]
diff --git a/src/librbml/lib.rs b/src/librbml/lib.rs
index a1b15cd9e6f..d51280a187c 100644
--- a/src/librbml/lib.rs
+++ b/src/librbml/lib.rs
@@ -115,7 +115,7 @@
 #![cfg_attr(stage0, feature(custom_attribute))]
 #![crate_name = "rbml"]
 #![unstable(feature = "rustc_private", issue = "27812")]
-#![staged_api]
+#![cfg_attr(stage0, staged_api)]
 #![crate_type = "rlib"]
 #![crate_type = "dylib"]
 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs
index 393329b4214..a81ecd38638 100644
--- a/src/librustc/lib.rs
+++ b/src/librustc/lib.rs
@@ -18,7 +18,7 @@
 #![cfg_attr(stage0, feature(custom_attribute))]
 #![crate_name = "rustc"]
 #![unstable(feature = "rustc_private", issue = "27812")]
-#![staged_api]
+#![cfg_attr(stage0, staged_api)]
 #![crate_type = "dylib"]
 #![crate_type = "rlib"]
 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
diff --git a/src/librustc/metadata/creader.rs b/src/librustc/metadata/creader.rs
index 6ce5d1117a6..4a28872b1b8 100644
--- a/src/librustc/metadata/creader.rs
+++ b/src/librustc/metadata/creader.rs
@@ -350,12 +350,11 @@ impl<'a> CrateReader<'a> {
     fn is_staged_api(&self, data: &[u8]) -> bool {
         let attrs = decoder::get_crate_attributes(data);
         for attr in &attrs {
-            if &attr.name()[..] == "staged_api" {
-                match attr.node.value.node { ast::MetaWord(_) => return true, _ => (/*pass*/) }
+            if attr.name() == "stable" || attr.name() == "unstable" {
+                return true
             }
         }
-
-        return false;
+        false
     }
 
     fn resolve_crate(&mut self,
diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs
index b5ba219f495..9ba49633f2b 100644
--- a/src/librustc/middle/stability.rs
+++ b/src/librustc/middle/stability.rs
@@ -85,7 +85,7 @@ impl<'a, 'tcx: 'a> Annotator<'a, 'tcx> {
                    item_sp: Span, kind: AnnotationKind, visit_children: F)
         where F: FnOnce(&mut Annotator)
     {
-        if self.index.staged_api[&LOCAL_CRATE] {
+        if self.index.staged_api[&LOCAL_CRATE] && self.tcx.sess.features.borrow().staged_api {
             debug!("annotate(id = {:?}, attrs = {:?})", id, attrs);
             if let Some(mut stab) = attr::find_stability(self.tcx.sess.diagnostic(),
                                                          attrs, item_sp) {
@@ -279,17 +279,15 @@ impl<'tcx> Index<'tcx> {
                            |v| intravisit::walk_crate(v, krate));
     }
 
-    pub fn new(krate: &Crate) -> Index {
+    pub fn new(krate: &Crate) -> Index<'tcx> {
         let mut is_staged_api = false;
         for attr in &krate.attrs {
-            if attr.name() == "staged_api" {
-                if let ast::MetaWord(_) = attr.node.value.node {
-                    attr::mark_used(attr);
-                    is_staged_api = true;
-                    break
-                }
+            if attr.name() == "stable" || attr.name() == "unstable" {
+                is_staged_api = true;
+                break
             }
         }
+
         let mut staged_api = FnvHashMap();
         staged_api.insert(LOCAL_CRATE, is_staged_api);
         Index {
diff --git a/src/librustc_back/lib.rs b/src/librustc_back/lib.rs
index 14fb064b7aa..593e1c2a726 100644
--- a/src/librustc_back/lib.rs
+++ b/src/librustc_back/lib.rs
@@ -25,7 +25,7 @@
 #![cfg_attr(stage0, feature(custom_attribute))]
 #![crate_name = "rustc_back"]
 #![unstable(feature = "rustc_private", issue = "27812")]
-#![staged_api]
+#![cfg_attr(stage0, staged_api)]
 #![crate_type = "dylib"]
 #![crate_type = "rlib"]
 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
diff --git a/src/librustc_bitflags/lib.rs b/src/librustc_bitflags/lib.rs
index 16f586cf5e0..3ea5cfcaff0 100644
--- a/src/librustc_bitflags/lib.rs
+++ b/src/librustc_bitflags/lib.rs
@@ -14,7 +14,7 @@
 #![crate_name = "rustc_bitflags"]
 #![feature(associated_consts)]
 #![feature(staged_api)]
-#![staged_api]
+#![cfg_attr(stage0, staged_api)]
 #![crate_type = "rlib"]
 #![feature(no_std)]
 #![no_std]
diff --git a/src/librustc_borrowck/lib.rs b/src/librustc_borrowck/lib.rs
index d7e1bab46da..93cea9479a5 100644
--- a/src/librustc_borrowck/lib.rs
+++ b/src/librustc_borrowck/lib.rs
@@ -12,7 +12,7 @@
 #![cfg_attr(stage0, feature(custom_attribute))]
 #![crate_name = "rustc_borrowck"]
 #![unstable(feature = "rustc_private", issue = "27812")]
-#![staged_api]
+#![cfg_attr(stage0, staged_api)]
 #![crate_type = "dylib"]
 #![crate_type = "rlib"]
 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
diff --git a/src/librustc_data_structures/lib.rs b/src/librustc_data_structures/lib.rs
index 4688742a4ab..39b3842791f 100644
--- a/src/librustc_data_structures/lib.rs
+++ b/src/librustc_data_structures/lib.rs
@@ -22,7 +22,7 @@
 #![unstable(feature = "rustc_private", issue = "27812")]
 #![crate_type = "dylib"]
 #![crate_type = "rlib"]
-#![staged_api]
+#![cfg_attr(stage0, staged_api)]
 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
       html_favicon_url = "https://www.rust-lang.org/favicon.ico",
       html_root_url = "https://doc.rust-lang.org/nightly/")]
diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs
index 6cbba235ff7..649834d4e95 100644
--- a/src/librustc_driver/lib.rs
+++ b/src/librustc_driver/lib.rs
@@ -18,7 +18,7 @@
 #![cfg_attr(stage0, feature(custom_attribute))]
 #![crate_name = "rustc_driver"]
 #![unstable(feature = "rustc_private", issue = "27812")]
-#![staged_api]
+#![cfg_attr(stage0, staged_api)]
 #![crate_type = "dylib"]
 #![crate_type = "rlib"]
 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
diff --git a/src/librustc_front/lib.rs b/src/librustc_front/lib.rs
index bafda3086fd..09ff7c8e58e 100644
--- a/src/librustc_front/lib.rs
+++ b/src/librustc_front/lib.rs
@@ -18,7 +18,7 @@
 #![cfg_attr(stage0, feature(custom_attribute))]
 #![crate_name = "rustc_front"]
 #![unstable(feature = "rustc_private", issue = "27812")]
-#![staged_api]
+#![cfg_attr(stage0, staged_api)]
 #![crate_type = "dylib"]
 #![crate_type = "rlib"]
 #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs
index 2613115d805..06e54141d7a 100644
--- a/src/librustc_lint/lib.rs
+++ b/src/librustc_lint/lib.rs
@@ -23,7 +23,7 @@
 #![cfg_attr(stage0, feature(custom_attribute))]
 #![crate_name = "rustc_lint"]
 #![unstable(feature = "rustc_private", issue = "27812")]
-#![staged_api]
+#![cfg_attr(stage0, staged_api)]
 #![crate_type = "dylib"]
 #![crate_type = "rlib"]
 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
diff --git a/src/librustc_llvm/lib.rs b/src/librustc_llvm/lib.rs
index 0cb0869db86..26187ade464 100644
--- a/src/librustc_llvm/lib.rs
+++ b/src/librustc_llvm/lib.rs
@@ -20,7 +20,7 @@
 
 #![crate_name = "rustc_llvm"]
 #![unstable(feature = "rustc_private", issue = "27812")]
-#![staged_api]
+#![cfg_attr(stage0, staged_api)]
 #![crate_type = "dylib"]
 #![crate_type = "rlib"]
 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
diff --git a/src/librustc_platform_intrinsics/lib.rs b/src/librustc_platform_intrinsics/lib.rs
index 9aee15b05df..3de6863652a 100644
--- a/src/librustc_platform_intrinsics/lib.rs
+++ b/src/librustc_platform_intrinsics/lib.rs
@@ -11,7 +11,7 @@
 #![cfg_attr(stage0, feature(custom_attribute))]
 #![crate_name = "rustc_platform_intrinsics"]
 #![unstable(feature = "rustc_private", issue = "27812")]
-#![staged_api]
+#![cfg_attr(stage0, staged_api)]
 #![crate_type = "dylib"]
 #![crate_type = "rlib"]
 #![feature(staged_api, rustc_private)]
diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs
index fdd5add68f2..9f70598198e 100644
--- a/src/librustc_privacy/lib.rs
+++ b/src/librustc_privacy/lib.rs
@@ -12,7 +12,7 @@
 #![cfg_attr(stage0, feature(custom_attribute))]
 #![crate_name = "rustc_privacy"]
 #![unstable(feature = "rustc_private", issue = "27812")]
-#![staged_api]
+#![cfg_attr(stage0, staged_api)]
 #![crate_type = "dylib"]
 #![crate_type = "rlib"]
 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs
index 51d7ceb946d..0e5384d19f5 100644
--- a/src/librustc_resolve/lib.rs
+++ b/src/librustc_resolve/lib.rs
@@ -12,7 +12,7 @@
 #![cfg_attr(stage0, feature(custom_attribute))]
 #![crate_name = "rustc_resolve"]
 #![unstable(feature = "rustc_private", issue = "27812")]
-#![staged_api]
+#![cfg_attr(stage0, staged_api)]
 #![crate_type = "dylib"]
 #![crate_type = "rlib"]
 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
diff --git a/src/librustc_trans/lib.rs b/src/librustc_trans/lib.rs
index 6b465cf28f3..58949a63ebe 100644
--- a/src/librustc_trans/lib.rs
+++ b/src/librustc_trans/lib.rs
@@ -18,7 +18,7 @@
 #![cfg_attr(stage0, feature(custom_attribute))]
 #![crate_name = "rustc_trans"]
 #![unstable(feature = "rustc_private", issue = "27812")]
-#![staged_api]
+#![cfg_attr(stage0, staged_api)]
 #![crate_type = "dylib"]
 #![crate_type = "rlib"]
 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs
index 1a52df31f39..1b59aaa4c32 100644
--- a/src/librustc_typeck/lib.rs
+++ b/src/librustc_typeck/lib.rs
@@ -66,7 +66,7 @@ This API is completely unstable and subject to change.
 #![cfg_attr(stage0, feature(custom_attribute))]
 #![crate_name = "rustc_typeck"]
 #![unstable(feature = "rustc_private", issue = "27812")]
-#![staged_api]
+#![cfg_attr(stage0, staged_api)]
 #![crate_type = "dylib"]
 #![crate_type = "rlib"]
 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
diff --git a/src/librustc_unicode/lib.rs b/src/librustc_unicode/lib.rs
index af92e96fcdf..f51770fd653 100644
--- a/src/librustc_unicode/lib.rs
+++ b/src/librustc_unicode/lib.rs
@@ -24,7 +24,7 @@
 #![cfg_attr(stage0, feature(custom_attribute))]
 #![crate_name = "rustc_unicode"]
 #![unstable(feature = "unicode", issue = "27783")]
-#![staged_api]
+#![cfg_attr(stage0, staged_api)]
 #![crate_type = "rlib"]
 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
        html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs
index db0da3764ba..9afe573936d 100644
--- a/src/librustdoc/lib.rs
+++ b/src/librustdoc/lib.rs
@@ -12,7 +12,7 @@
 #![cfg_attr(stage0, feature(custom_attribute))]
 #![crate_name = "rustdoc"]
 #![unstable(feature = "rustdoc", issue = "27812")]
-#![staged_api]
+#![cfg_attr(stage0, staged_api)]
 #![crate_type = "dylib"]
 #![crate_type = "rlib"]
 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
diff --git a/src/libserialize/lib.rs b/src/libserialize/lib.rs
index 4a766f14531..c919c335640 100644
--- a/src/libserialize/lib.rs
+++ b/src/libserialize/lib.rs
@@ -20,7 +20,7 @@ Core encoding and decoding interfaces.
 #![unstable(feature = "rustc_private",
             reason = "deprecated in favor of rustc-serialize on crates.io",
             issue = "27812")]
-#![staged_api]
+#![cfg_attr(stage0, staged_api)]
 #![crate_type = "rlib"]
 #![crate_type = "dylib"]
 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs
index 9700e95ed0f..37a58fdeda4 100644
--- a/src/libstd/lib.rs
+++ b/src/libstd/lib.rs
@@ -202,7 +202,7 @@
 #![cfg_attr(stage0, feature(custom_attribute))]
 #![crate_name = "std"]
 #![stable(feature = "rust1", since = "1.0.0")]
-#![staged_api]
+#![cfg_attr(stage0, staged_api)]
 #![crate_type = "rlib"]
 #![crate_type = "dylib"]
 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index 1663bdca51f..b450331d440 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -277,8 +277,6 @@ pub const KNOWN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeGat
     // Not used any more, but we can't feature gate it
     ("no_stack_check", Normal, Ungated),
 
-    ("staged_api", CrateLevel, Gated("staged_api",
-                                     "staged_api is for use by rustc only")),
     ("plugin", CrateLevel, Gated("plugin",
                                  "compiler plugins are experimental \
                                   and possibly buggy")),
@@ -501,6 +499,7 @@ pub struct Features {
     pub cfg_target_vendor: bool,
     pub augmented_assignments: bool,
     pub braced_empty_structs: bool,
+    pub staged_api: bool,
 }
 
 impl Features {
@@ -532,6 +531,7 @@ impl Features {
             cfg_target_vendor: false,
             augmented_assignments: false,
             braced_empty_structs: false,
+            staged_api: false,
         }
     }
 }
@@ -1104,6 +1104,7 @@ fn check_crate_inner<F>(cm: &CodeMap, span_handler: &SpanHandler,
         cfg_target_vendor: cx.has_feature("cfg_target_vendor"),
         augmented_assignments: cx.has_feature("augmented_assignments"),
         braced_empty_structs: cx.has_feature("braced_empty_structs"),
+        staged_api: cx.has_feature("staged_api"),
     }
 }
 
diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs
index 59cc380b0ec..475408472ee 100644
--- a/src/libsyntax/lib.rs
+++ b/src/libsyntax/lib.rs
@@ -18,7 +18,7 @@
 #![cfg_attr(stage0, feature(custom_attribute))]
 #![crate_name = "syntax"]
 #![unstable(feature = "rustc_private", issue = "27812")]
-#![staged_api]
+#![cfg_attr(stage0, staged_api)]
 #![crate_type = "dylib"]
 #![crate_type = "rlib"]
 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
diff --git a/src/libterm/lib.rs b/src/libterm/lib.rs
index f33530f93d1..478b0b846ed 100644
--- a/src/libterm/lib.rs
+++ b/src/libterm/lib.rs
@@ -47,7 +47,7 @@
 #![unstable(feature = "rustc_private",
             reason = "use the crates.io `term` library instead",
             issue = "27812")]
-#![staged_api]
+#![cfg_attr(stage0, staged_api)]
 #![crate_type = "rlib"]
 #![crate_type = "dylib"]
 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs
index 89442fe1096..125677dc932 100644
--- a/src/libtest/lib.rs
+++ b/src/libtest/lib.rs
@@ -27,7 +27,7 @@
 #![cfg_attr(stage0, feature(custom_attribute))]
 #![crate_name = "test"]
 #![unstable(feature = "test", issue = "27812")]
-#![staged_api]
+#![cfg_attr(stage0, staged_api)]
 #![crate_type = "rlib"]
 #![crate_type = "dylib"]
 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
diff --git a/src/test/auxiliary/inherited_stability.rs b/src/test/auxiliary/inherited_stability.rs
index 82c63a6c208..0b1aee68f44 100644
--- a/src/test/auxiliary/inherited_stability.rs
+++ b/src/test/auxiliary/inherited_stability.rs
@@ -11,7 +11,6 @@
 #![crate_type = "lib"]
 #![unstable(feature = "test_feature", issue = "0")]
 #![feature(staged_api)]
-#![staged_api]
 
 pub fn unstable() {}
 
diff --git a/src/test/auxiliary/internal_unstable.rs b/src/test/auxiliary/internal_unstable.rs
index 20eb99fe91c..a4cd487eb65 100644
--- a/src/test/auxiliary/internal_unstable.rs
+++ b/src/test/auxiliary/internal_unstable.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 #![feature(staged_api, allow_internal_unstable)]
-#![staged_api]
 #![stable(feature = "stable", since = "1.0.0")]
 
 #[unstable(feature = "function", issue = "0")]
diff --git a/src/test/auxiliary/lint_output_format.rs b/src/test/auxiliary/lint_output_format.rs
index 4116c230497..0553b4a49b7 100644
--- a/src/test/auxiliary/lint_output_format.rs
+++ b/src/test/auxiliary/lint_output_format.rs
@@ -11,7 +11,6 @@
 #![crate_name="lint_output_format"]
 #![crate_type = "lib"]
 #![feature(staged_api)]
-#![staged_api]
 #![unstable(feature = "test_feature", issue = "0")]
 
 #[stable(feature = "test_feature", since = "1.0.0")]
diff --git a/src/test/auxiliary/lint_stability.rs b/src/test/auxiliary/lint_stability.rs
index 555e88c3489..09d8302095f 100644
--- a/src/test/auxiliary/lint_stability.rs
+++ b/src/test/auxiliary/lint_stability.rs
@@ -10,7 +10,6 @@
 #![crate_name="lint_stability"]
 #![crate_type = "lib"]
 #![feature(staged_api)]
-#![staged_api]
 #![stable(feature = "lint_stability", since = "1.0.0")]
 
 #[stable(feature = "test_feature", since = "1.0.0")]
diff --git a/src/test/auxiliary/lint_stability_fields.rs b/src/test/auxiliary/lint_stability_fields.rs
index c4a53d8477a..8c6b98ab510 100644
--- a/src/test/auxiliary/lint_stability_fields.rs
+++ b/src/test/auxiliary/lint_stability_fields.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 #![feature(staged_api)]
-#![staged_api]
 #![stable(feature = "rust1", since = "1.0.0")]
 
 #[stable(feature = "rust1", since = "1.0.0")]
diff --git a/src/test/auxiliary/stability_attribute_issue.rs b/src/test/auxiliary/stability_attribute_issue.rs
index 69560d15b5f..22c13f69af9 100644
--- a/src/test/auxiliary/stability_attribute_issue.rs
+++ b/src/test/auxiliary/stability_attribute_issue.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 #![feature(staged_api)]
-#![staged_api]
 #![stable(feature = "foo", since = "1.2.0")]
 
 
diff --git a/src/test/auxiliary/stability_cfg1.rs b/src/test/auxiliary/stability_cfg1.rs
index 3a92cf59611..c839993b047 100644
--- a/src/test/auxiliary/stability_cfg1.rs
+++ b/src/test/auxiliary/stability_cfg1.rs
@@ -11,4 +11,3 @@
 #![cfg_attr(foo, experimental)]
 #![cfg_attr(not(foo), stable(feature = "test_feature", since = "1.0.0"))]
 #![feature(staged_api)]
-#![staged_api]
diff --git a/src/test/auxiliary/stability_cfg2.rs b/src/test/auxiliary/stability_cfg2.rs
index 8277280f069..c1e2b1d1bfe 100644
--- a/src/test/auxiliary/stability_cfg2.rs
+++ b/src/test/auxiliary/stability_cfg2.rs
@@ -13,4 +13,3 @@
 #![cfg_attr(foo, unstable(feature = "test_feature", issue = "0"))]
 #![cfg_attr(not(foo), stable(feature = "test_feature", since = "1.0.0"))]
 #![feature(staged_api)]
-#![staged_api]
diff --git a/src/test/compile-fail/issue-17337.rs b/src/test/compile-fail/issue-17337.rs
index a4756cd964d..1208321b529 100644
--- a/src/test/compile-fail/issue-17337.rs
+++ b/src/test/compile-fail/issue-17337.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 #![feature(staged_api)]
-#![staged_api]
 #![deny(deprecated)]
 
 #![unstable(feature = "test_feature", issue = "0")]
diff --git a/src/test/compile-fail/lint-forbid-cmdline.rs b/src/test/compile-fail/lint-forbid-cmdline.rs
index be927297be7..dfa6866f66e 100644
--- a/src/test/compile-fail/lint-forbid-cmdline.rs
+++ b/src/test/compile-fail/lint-forbid-cmdline.rs
@@ -11,7 +11,6 @@
 // compile-flags: -F deprecated
 
 #![feature(staged_api)]
-#![staged_api]
 #[allow(deprecated)] //~ ERROR allow(deprecated) overruled by outer forbid(deprecated)
 fn main() {
 }
diff --git a/src/test/compile-fail/lint-stability-fields.rs b/src/test/compile-fail/lint-stability-fields.rs
index 3a86bcc0246..d63e1f901f5 100644
--- a/src/test/compile-fail/lint-stability-fields.rs
+++ b/src/test/compile-fail/lint-stability-fields.rs
@@ -12,7 +12,6 @@
 #![deny(deprecated)]
 #![allow(dead_code)]
 #![feature(staged_api)]
-#![staged_api]
 
 #![stable(feature = "rust1", since = "1.0.0")]
 
diff --git a/src/test/compile-fail/lint-stability.rs b/src/test/compile-fail/lint-stability.rs
index 30d84786ede..f32d7db244b 100644
--- a/src/test/compile-fail/lint-stability.rs
+++ b/src/test/compile-fail/lint-stability.rs
@@ -16,7 +16,6 @@
 #![deny(deprecated)]
 #![allow(dead_code)]
 #![feature(staged_api)]
-#![staged_api]
 
 #![stable(feature = "rust1", since = "1.0.0")]
 
diff --git a/src/test/compile-fail/missing-stability.rs b/src/test/compile-fail/missing-stability.rs
index 83ba9d95daf..a727ecc76b7 100644
--- a/src/test/compile-fail/missing-stability.rs
+++ b/src/test/compile-fail/missing-stability.rs
@@ -12,7 +12,6 @@
 
 #![crate_type="lib"]
 #![feature(staged_api)]
-#![staged_api]
 
 #![stable(feature = "test_feature", since = "1.0.0")]
 
diff --git a/src/test/compile-fail/stability-attribute-sanity-2.rs b/src/test/compile-fail/stability-attribute-sanity-2.rs
index 82627daf7ff..d978d4ce0ea 100644
--- a/src/test/compile-fail/stability-attribute-sanity-2.rs
+++ b/src/test/compile-fail/stability-attribute-sanity-2.rs
@@ -11,7 +11,6 @@
 // More checks that stability attributes are used correctly
 
 #![feature(staged_api)]
-#![staged_api]
 
 #![stable(feature = "test_feature", since = "1.0.0")]
 
diff --git a/src/test/compile-fail/stability-attribute-sanity.rs b/src/test/compile-fail/stability-attribute-sanity.rs
index 038d6a8ec07..8c7c0c275db 100644
--- a/src/test/compile-fail/stability-attribute-sanity.rs
+++ b/src/test/compile-fail/stability-attribute-sanity.rs
@@ -11,7 +11,6 @@
 // Various checks that stability attributes are used correctly, per RFC 507
 
 #![feature(staged_api)]
-#![staged_api]
 
 #![stable(feature = "rust1", since = "1.0.0")]
 
diff --git a/src/test/compile-fail/staged_api.rs b/src/test/compile-fail/staged_api.rs
deleted file mode 100644
index 53d687b5cfe..00000000000
--- a/src/test/compile-fail/staged_api.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-// 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.
-
-#![staged_api] //~ ERROR staged_api is for use by rustc only
-
-fn main() { }
diff --git a/src/test/run-make/allow-warnings-cmdline-stability/bar.rs b/src/test/run-make/allow-warnings-cmdline-stability/bar.rs
index 9c24694951a..fed1405b7f4 100644
--- a/src/test/run-make/allow-warnings-cmdline-stability/bar.rs
+++ b/src/test/run-make/allow-warnings-cmdline-stability/bar.rs
@@ -10,7 +10,6 @@
 
 #![crate_type = "lib"]
 #![feature(staged_api)]
-#![staged_api]
 #![unstable(feature = "test_feature", issue = "0")]
 
 pub fn baz() { }
diff --git a/src/test/rustdoc/issue-18199.rs b/src/test/rustdoc/issue-18199.rs
index 27e6e17a79c..275947a18a5 100644
--- a/src/test/rustdoc/issue-18199.rs
+++ b/src/test/rustdoc/issue-18199.rs
@@ -13,7 +13,6 @@
 #![doc(test(attr(feature(staged_api))))]
 
 /// ```
-/// #![staged_api]
 /// #![unstable(feature="test", issue="18199")]
 /// fn main() {}
 /// ```
diff --git a/src/test/rustdoc/issue-27759.rs b/src/test/rustdoc/issue-27759.rs
index dbe12b80b3e..fe40ce2bd7d 100644
--- a/src/test/rustdoc/issue-27759.rs
+++ b/src/test/rustdoc/issue-27759.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 #![feature(staged_api)]
-#![staged_api]
 #![doc(issue_tracker_base_url = "http://issue_url/")]
 
 #![unstable(feature="test", issue="27759")]