From d3c0bb416e78cb878182dc6f4fd4a09922db87c1 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Wed, 21 Jan 2015 18:21:14 -0800 Subject: [PATCH] Put #[staged_api] behind the 'staged_api' gate --- src/liballoc/lib.rs | 1 + src/libarena/lib.rs | 1 + src/libcollections/lib.rs | 1 + src/libcore/lib.rs | 1 + src/libflate/lib.rs | 1 + src/libfmt_macros/lib.rs | 1 + src/libgetopts/lib.rs | 1 + src/libgraphviz/lib.rs | 1 + src/liblibc/lib.rs | 1 + src/liblog/lib.rs | 1 + src/librand/lib.rs | 1 + src/librbml/lib.rs | 1 + src/libregex/lib.rs | 1 + src/librustc/lib.rs | 1 + src/librustc/middle/stability.rs | 2 +- src/librustc_back/lib.rs | 1 + src/librustc_bitflags/lib.rs | 2 ++ src/librustc_borrowck/lib.rs | 1 + src/librustc_driver/lib.rs | 1 + src/librustc_llvm/lib.rs | 1 + src/librustc_privacy/lib.rs | 1 + src/librustc_resolve/lib.rs | 1 + src/librustc_trans/lib.rs | 1 + src/librustc_typeck/lib.rs | 1 + src/librustdoc/lib.rs | 1 + src/libserialize/lib.rs | 1 + src/libstd/lib.rs | 1 + src/libsyntax/feature_gate.rs | 8 ++++++++ src/libsyntax/lib.rs | 1 + src/libterm/lib.rs | 1 + src/libtest/lib.rs | 1 + src/libunicode/lib.rs | 1 + src/test/auxiliary/inherited_stability.rs | 1 + src/test/auxiliary/lint_output_format.rs | 1 + src/test/auxiliary/lint_stability.rs | 1 + src/test/auxiliary/stability_cfg1.rs | 1 + src/test/auxiliary/stability_cfg2.rs | 1 + src/test/compile-fail/issue-17337.rs | 1 + src/test/compile-fail/lint-forbid-cmdline.rs | 1 + src/test/compile-fail/lint-stability.rs | 1 + src/test/compile-fail/staged_api.rs | 13 +++++++++++++ 41 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 src/test/compile-fail/staged_api.rs diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index db4ef263722e..c30bd280c8f3 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -58,6 +58,7 @@ #![crate_name = "alloc"] #![unstable(feature = "unnamed_feature")] +#![feature(staged_api)] #![staged_api] #![crate_type = "rlib"] #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", diff --git a/src/libarena/lib.rs b/src/libarena/lib.rs index c0889bad3a53..79025e639c81 100644 --- a/src/libarena/lib.rs +++ b/src/libarena/lib.rs @@ -21,6 +21,7 @@ #![crate_name = "arena"] #![unstable(feature = "unnamed_feature")] +#![feature(staged_api)] #![staged_api] #![crate_type = "rlib"] #![crate_type = "dylib"] diff --git a/src/libcollections/lib.rs b/src/libcollections/lib.rs index 3459806e29c7..c8b5b82d0a5c 100644 --- a/src/libcollections/lib.rs +++ b/src/libcollections/lib.rs @@ -15,6 +15,7 @@ #![crate_name = "collections"] #![unstable(feature = "unnamed_feature")] +#![feature(staged_api)] #![staged_api] #![crate_type = "rlib"] #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index ff7f8fc28156..17460c0d52b2 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -49,6 +49,7 @@ #![crate_name = "core"] #![unstable(feature = "unnamed_feature")] +#![feature(staged_api)] #![staged_api] #![crate_type = "rlib"] #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", diff --git a/src/libflate/lib.rs b/src/libflate/lib.rs index 98c149300b17..9c67748f9c57 100644 --- a/src/libflate/lib.rs +++ b/src/libflate/lib.rs @@ -16,6 +16,7 @@ #![crate_name = "flate"] #![unstable(feature = "unnamed_feature")] +#![feature(staged_api)] #![staged_api] #![allow(unknown_features)] #![feature(int_uint)] #![feature(unnamed_feature)] diff --git a/src/libfmt_macros/lib.rs b/src/libfmt_macros/lib.rs index 24e4fc20b758..874bce88082a 100644 --- a/src/libfmt_macros/lib.rs +++ b/src/libfmt_macros/lib.rs @@ -16,6 +16,7 @@ #![crate_name = "fmt_macros"] #![unstable(feature = "unnamed_feature")] +#![feature(staged_api)] #![staged_api] #![crate_type = "rlib"] #![crate_type = "dylib"] diff --git a/src/libgetopts/lib.rs b/src/libgetopts/lib.rs index 52ffd86acc63..be1a343b169d 100644 --- a/src/libgetopts/lib.rs +++ b/src/libgetopts/lib.rs @@ -80,6 +80,7 @@ #![crate_name = "getopts"] #![unstable(feature = "unnamed_feature", reason = "use the crates.io `getopts` library instead")] +#![feature(staged_api)] #![staged_api] #![crate_type = "rlib"] #![crate_type = "dylib"] diff --git a/src/libgraphviz/lib.rs b/src/libgraphviz/lib.rs index cdad49441130..2a8a5bcf2164 100644 --- a/src/libgraphviz/lib.rs +++ b/src/libgraphviz/lib.rs @@ -266,6 +266,7 @@ #![crate_name = "graphviz"] #![unstable(feature = "unnamed_feature")] +#![feature(staged_api)] #![staged_api] #![crate_type = "rlib"] #![crate_type = "dylib"] diff --git a/src/liblibc/lib.rs b/src/liblibc/lib.rs index 9f6ffb4005b3..73a4214788d3 100644 --- a/src/liblibc/lib.rs +++ b/src/liblibc/lib.rs @@ -12,6 +12,7 @@ #![crate_type = "rlib"] #![cfg_attr(not(feature = "cargo-build"), unstable(feature = "unnamed_feature"))] +#![cfg_attr(not(feature = "cargo-build"), feature(staged_api))] #![cfg_attr(not(feature = "cargo-build"), staged_api)] #![cfg_attr(not(feature = "cargo-build"), feature(unnamed_feature))] #![allow(unknown_features)] #![feature(int_uint)] diff --git a/src/liblog/lib.rs b/src/liblog/lib.rs index d398406b2cb1..217eb8d0d3e9 100644 --- a/src/liblog/lib.rs +++ b/src/liblog/lib.rs @@ -158,6 +158,7 @@ #![crate_name = "log"] #![unstable(feature = "unnamed_feature", reason = "use the crates.io `log` library instead")] +#![feature(staged_api)] #![staged_api] #![crate_type = "rlib"] #![crate_type = "dylib"] diff --git a/src/librand/lib.rs b/src/librand/lib.rs index 3abb22ec34cb..947e13046a87 100644 --- a/src/librand/lib.rs +++ b/src/librand/lib.rs @@ -26,6 +26,7 @@ #![allow(unknown_features)] #![feature(int_uint)] #![no_std] #![unstable(feature = "unnamed_feature")] +#![feature(staged_api)] #![staged_api] #[macro_use] diff --git a/src/librbml/lib.rs b/src/librbml/lib.rs index e621f6f2b1bc..f667c6b258d1 100644 --- a/src/librbml/lib.rs +++ b/src/librbml/lib.rs @@ -17,6 +17,7 @@ #![crate_name = "rbml"] #![unstable(feature = "unnamed_feature")] +#![feature(staged_api)] #![staged_api] #![crate_type = "rlib"] #![crate_type = "dylib"] diff --git a/src/libregex/lib.rs b/src/libregex/lib.rs index 6c9ef4949590..3e80bc78d023 100644 --- a/src/libregex/lib.rs +++ b/src/libregex/lib.rs @@ -18,6 +18,7 @@ #![crate_type = "dylib"] #![unstable(feature = "unnamed_feature", reason = "use the crates.io `regex` library instead")] +#![feature(staged_api)] #![staged_api] #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "http://www.rust-lang.org/favicon.ico", diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index 507e093ed639..80714dd5e936 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -16,6 +16,7 @@ #![crate_name = "rustc"] #![unstable(feature = "unnamed_feature")] +#![feature(staged_api)] #![staged_api] #![crate_type = "dylib"] #![crate_type = "rlib"] diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs index e91571a270f2..cf8f479b5bd0 100644 --- a/src/librustc/middle/stability.rs +++ b/src/librustc/middle/stability.rs @@ -33,7 +33,7 @@ use std::mem::replace; /// A stability index, giving the stability level for items and methods. pub struct Index { - // Indicates whether this crate has #![staged_api] + // Indicates whether this crate has #![feature(staged_api)] staged_api: bool, // stability for crate-local items; unmarked stability == no entry local: NodeMap, diff --git a/src/librustc_back/lib.rs b/src/librustc_back/lib.rs index 0cb64a05c454..21cfb4ab1808 100644 --- a/src/librustc_back/lib.rs +++ b/src/librustc_back/lib.rs @@ -23,6 +23,7 @@ #![crate_name = "rustc_back"] #![unstable(feature = "unnamed_feature")] +#![feature(staged_api)] #![staged_api] #![crate_type = "dylib"] #![crate_type = "rlib"] diff --git a/src/librustc_bitflags/lib.rs b/src/librustc_bitflags/lib.rs index 0ef9d8a2e728..6b7976f765b4 100644 --- a/src/librustc_bitflags/lib.rs +++ b/src/librustc_bitflags/lib.rs @@ -9,6 +9,8 @@ // except according to those terms. #![crate_name = "rustc_bitflags"] +#![allow(unknown_features)] +#![feature(staged_api)] #![staged_api] #![crate_type = "rlib"] #![no_std] diff --git a/src/librustc_borrowck/lib.rs b/src/librustc_borrowck/lib.rs index 573d752cdafa..7800a09f1acb 100644 --- a/src/librustc_borrowck/lib.rs +++ b/src/librustc_borrowck/lib.rs @@ -10,6 +10,7 @@ #![crate_name = "rustc_borrowck"] #![unstable(feature = "unnamed_feature")] +#![feature(staged_api)] #![staged_api] #![crate_type = "dylib"] #![crate_type = "rlib"] diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index 7a17d1865240..9d359a23c957 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -16,6 +16,7 @@ #![crate_name = "rustc_driver"] #![unstable(feature = "unnamed_feature")] +#![feature(staged_api)] #![staged_api] #![crate_type = "dylib"] #![crate_type = "rlib"] diff --git a/src/librustc_llvm/lib.rs b/src/librustc_llvm/lib.rs index 5d4b4dfe335b..8bb794d289f8 100644 --- a/src/librustc_llvm/lib.rs +++ b/src/librustc_llvm/lib.rs @@ -15,6 +15,7 @@ #![crate_name = "rustc_llvm"] #![unstable(feature = "unnamed_feature")] +#![feature(staged_api)] #![staged_api] #![crate_type = "dylib"] #![crate_type = "rlib"] diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index 6edfe04b9f76..a24a7f40f0e3 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -10,6 +10,7 @@ #![crate_name = "rustc_privacy"] #![unstable(feature = "unnamed_feature")] +#![feature(staged_api)] #![staged_api] #![crate_type = "dylib"] #![crate_type = "rlib"] diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index c15995edbed8..e31170855ffb 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -10,6 +10,7 @@ #![crate_name = "rustc_resolve"] #![unstable(feature = "unnamed_feature")] +#![feature(staged_api)] #![staged_api] #![crate_type = "dylib"] #![crate_type = "rlib"] diff --git a/src/librustc_trans/lib.rs b/src/librustc_trans/lib.rs index bf345fd4fecc..0b1434176683 100644 --- a/src/librustc_trans/lib.rs +++ b/src/librustc_trans/lib.rs @@ -16,6 +16,7 @@ #![crate_name = "rustc_trans"] #![unstable(feature = "unnamed_feature")] +#![feature(staged_api)] #![staged_api] #![crate_type = "dylib"] #![crate_type = "rlib"] diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index 71bfacaf5a50..e2cf87673d22 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -65,6 +65,7 @@ This API is completely unstable and subject to change. #![crate_name = "rustc_typeck"] #![unstable(feature = "unnamed_feature")] +#![feature(staged_api)] #![staged_api] #![crate_type = "dylib"] #![crate_type = "rlib"] diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index b8704177314d..4d2eaa778cd0 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -10,6 +10,7 @@ #![crate_name = "rustdoc"] #![unstable(feature = "unnamed_feature")] +#![feature(staged_api)] #![staged_api] #![crate_type = "dylib"] #![crate_type = "rlib"] diff --git a/src/libserialize/lib.rs b/src/libserialize/lib.rs index a2db8b48a514..4fe3c56b5c9c 100644 --- a/src/libserialize/lib.rs +++ b/src/libserialize/lib.rs @@ -17,6 +17,7 @@ Core encoding and decoding interfaces. #![crate_name = "serialize"] #![unstable(feature = "unnamed_feature", reason = "deprecated in favor of rustc-serialize on crates.io")] +#![feature(staged_api)] #![staged_api] #![crate_type = "rlib"] #![crate_type = "dylib"] diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 6760640d33a0..5ad90a76ef87 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -96,6 +96,7 @@ #![crate_name = "std"] #![stable(feature = "grandfathered", since = "1.0.0")] +#![feature(staged_api)] #![staged_api] #![crate_type = "rlib"] #![crate_type = "dylib"] diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 43af53aa2d2e..989126cd8d64 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -113,6 +113,9 @@ static KNOWN_FEATURES: &'static [(&'static str, &'static str, Status)] = &[ // mean anything ("test_accepted_feature", "1.0.0", Accepted), ("test_removed_feature", "1.0.0", Removed), + + // Allows use of #[staged_api] + ("staged_api", "1.0.0", Active), ]; enum Status { @@ -444,6 +447,11 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> { } fn visit_attribute(&mut self, attr: &ast::Attribute) { + if attr.check_name("staged_api") { + self.gate_feature("staged_api", attr.span, + "staged_api is for use by rustc only"); + } + if attr::contains_name(slice::ref_slice(attr), "lang") { self.gate_feature("lang_items", attr.span, diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index 975c714b3b45..a37a9a146943 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -16,6 +16,7 @@ #![crate_name = "syntax"] #![unstable(feature = "unnamed_feature")] +#![feature(staged_api)] #![staged_api] #![crate_type = "dylib"] #![crate_type = "rlib"] diff --git a/src/libterm/lib.rs b/src/libterm/lib.rs index dccbe6051c6b..b834af60591b 100644 --- a/src/libterm/lib.rs +++ b/src/libterm/lib.rs @@ -41,6 +41,7 @@ #![crate_name = "term"] #![unstable(feature = "unnamed_feature", reason = "use the crates.io `term` library instead")] +#![feature(staged_api)] #![staged_api] #![crate_type = "rlib"] #![crate_type = "dylib"] diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index 68949d562567..3749d17e2db9 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -25,6 +25,7 @@ #![crate_name = "test"] #![unstable(feature = "unnamed_feature")] +#![feature(staged_api)] #![staged_api] #![crate_type = "rlib"] #![crate_type = "dylib"] diff --git a/src/libunicode/lib.rs b/src/libunicode/lib.rs index 5b8a5d8d07a8..4e642e8a5c01 100644 --- a/src/libunicode/lib.rs +++ b/src/libunicode/lib.rs @@ -22,6 +22,7 @@ #![crate_name = "unicode"] #![unstable(feature = "unnamed_feature")] +#![feature(staged_api)] #![staged_api] #![crate_type = "rlib"] #![doc(html_logo_url = "http://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 cfe201a87b33..3c79d40e45c4 100644 --- a/src/test/auxiliary/inherited_stability.rs +++ b/src/test/auxiliary/inherited_stability.rs @@ -10,6 +10,7 @@ #![crate_name="inherited_stability"] #![crate_type = "lib"] #![unstable(feature = "unnamed_feature")] +#![feature(staged_api)] #![staged_api] pub fn unstable() {} diff --git a/src/test/auxiliary/lint_output_format.rs b/src/test/auxiliary/lint_output_format.rs index 2962ff88b21e..9a797c197fb9 100755 --- a/src/test/auxiliary/lint_output_format.rs +++ b/src/test/auxiliary/lint_output_format.rs @@ -10,6 +10,7 @@ #![crate_name="lint_output_format"] #![crate_type = "lib"] +#![feature(staged_api)] #![staged_api] #![unstable(feature = "unnamed_feature")] diff --git a/src/test/auxiliary/lint_stability.rs b/src/test/auxiliary/lint_stability.rs index 915fe661ee5a..d6c09cd78e87 100644 --- a/src/test/auxiliary/lint_stability.rs +++ b/src/test/auxiliary/lint_stability.rs @@ -9,6 +9,7 @@ // except according to those terms. #![crate_name="lint_stability"] #![crate_type = "lib"] +#![feature(staged_api)] #![staged_api] #[deprecated(feature = "oldstuff", since = "1.0.0")] diff --git a/src/test/auxiliary/stability_cfg1.rs b/src/test/auxiliary/stability_cfg1.rs index 68503f15bd88..59f4d0ae9d9f 100644 --- a/src/test/auxiliary/stability_cfg1.rs +++ b/src/test/auxiliary/stability_cfg1.rs @@ -10,4 +10,5 @@ #![cfg_attr(foo, experimental)] #![cfg_attr(not(foo), stable(feature = "unnamed_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 d694f2154c6f..33407293e59d 100644 --- a/src/test/auxiliary/stability_cfg2.rs +++ b/src/test/auxiliary/stability_cfg2.rs @@ -12,4 +12,5 @@ #![cfg_attr(foo, unstable(feature = "unnamed_feature"))] #![cfg_attr(not(foo), stable(feature = "unnamed_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 200888ff2f8a..92a35ef48c59 100644 --- a/src/test/compile-fail/issue-17337.rs +++ b/src/test/compile-fail/issue-17337.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(staged_api)] #![staged_api] #![deny(deprecated)] diff --git a/src/test/compile-fail/lint-forbid-cmdline.rs b/src/test/compile-fail/lint-forbid-cmdline.rs index 53575192965b..be927297be7b 100644 --- a/src/test/compile-fail/lint-forbid-cmdline.rs +++ b/src/test/compile-fail/lint-forbid-cmdline.rs @@ -10,6 +10,7 @@ // 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.rs b/src/test/compile-fail/lint-stability.rs index dd3b27544196..ed474b6ef98a 100644 --- a/src/test/compile-fail/lint-stability.rs +++ b/src/test/compile-fail/lint-stability.rs @@ -16,6 +16,7 @@ #![deny(deprecated)] #![allow(dead_code)] +#![feature(staged_api)] #![staged_api] #[macro_use] diff --git a/src/test/compile-fail/staged_api.rs b/src/test/compile-fail/staged_api.rs new file mode 100644 index 000000000000..53d687b5cfef --- /dev/null +++ b/src/test/compile-fail/staged_api.rs @@ -0,0 +1,13 @@ +// 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 or the MIT license +// , 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() { }