Auto merge of - petrochenkov:staged, r=brson

Closes https://github.com/rust-lang/rust/issues/30008

`#[stable]`, `#[unstable]` and `#[rustc_deprecated]` are now guarded by `#[feature(staged_api)]`

r? @brson
This commit is contained in:
bors 2015-11-26 10:22:37 +00:00
commit 6d88afe477
58 changed files with 47 additions and 84 deletions
src
doc
liballoc
liballoc_jemalloc
liballoc_system
libarena
libcollections
libcore
libflate
libfmt_macros
libgetopts
libgraphviz
liblibc
liblog
librand
librbml
librustc
librustc_back
librustc_bitflags
librustc_borrowck
librustc_data_structures
librustc_driver
librustc_front
librustc_lint
librustc_llvm
librustc_platform_intrinsics
librustc_privacy
librustc_resolve
librustc_trans
librustc_typeck
librustc_unicode
librustdoc
libserialize
libstd
libsyntax
libterm
libtest
test

@ -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.

@ -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 \

@ -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))]

@ -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))]

@ -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",

@ -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 \

@ -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",

@ -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",

@ -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",

@ -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",

@ -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",

@ -1 +1 @@
Subproject commit c27f4167a7706baba1ddbb0a9ab320ec18d097db
Subproject commit e6714f3c7032eeff38e0f5bba21e71c551efb97b

@ -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",

@ -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")]

@ -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",

@ -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",

@ -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,

@ -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 {

@ -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",

@ -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]

@ -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",

@ -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/")]

@ -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",

@ -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",

@ -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",

@ -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",

@ -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)]

@ -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",

@ -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",

@ -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",

@ -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",

@ -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",

@ -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",

@ -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",

@ -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",

@ -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"),
}
}

@ -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",

@ -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",

@ -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",

@ -11,7 +11,6 @@
#![crate_type = "lib"]
#![unstable(feature = "test_feature", issue = "0")]
#![feature(staged_api)]
#![staged_api]
pub fn unstable() {}

@ -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")]

@ -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")]

@ -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")]

@ -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")]

@ -9,7 +9,6 @@
// except according to those terms.
#![feature(staged_api)]
#![staged_api]
#![stable(feature = "foo", since = "1.2.0")]

@ -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]

@ -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]

@ -9,7 +9,6 @@
// except according to those terms.
#![feature(staged_api)]
#![staged_api]
#![deny(deprecated)]
#![unstable(feature = "test_feature", issue = "0")]

@ -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() {
}

@ -12,7 +12,6 @@
#![deny(deprecated)]
#![allow(dead_code)]
#![feature(staged_api)]
#![staged_api]
#![stable(feature = "rust1", since = "1.0.0")]

@ -16,7 +16,6 @@
#![deny(deprecated)]
#![allow(dead_code)]
#![feature(staged_api)]
#![staged_api]
#![stable(feature = "rust1", since = "1.0.0")]

@ -12,7 +12,6 @@
#![crate_type="lib"]
#![feature(staged_api)]
#![staged_api]
#![stable(feature = "test_feature", since = "1.0.0")]

@ -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")]

@ -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")]

@ -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() { }

@ -10,7 +10,6 @@
#![crate_type = "lib"]
#![feature(staged_api)]
#![staged_api]
#![unstable(feature = "test_feature", issue = "0")]
pub fn baz() { }

@ -13,7 +13,6 @@
#![doc(test(attr(feature(staged_api))))]
/// ```
/// #![staged_api]
/// #![unstable(feature="test", issue="18199")]
/// fn main() {}
/// ```

@ -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")]