Remove #[staged_api]

This commit is contained in:
Vadim Petrochenkov 2015-11-24 01:51:58 +03:00
parent 1b9a13e6ba
commit 5127d24a3e
7 changed files with 18 additions and 37 deletions

View File

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

View File

@ -350,12 +350,19 @@ 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() == "feature" {
if let Some(metas) = attr.meta_item_list() {
for meta in metas {
if let ast::MetaWord(ref name) = meta.node {
if &name[..] == "staged_api" {
return true
}
}
}
}
}
}
return false;
false
}
fn resolve_crate(&mut self,

View File

@ -279,19 +279,9 @@ impl<'tcx> Index<'tcx> {
|v| intravisit::walk_crate(v, krate));
}
pub fn new(krate: &Crate) -> Index {
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
}
}
}
pub fn new(sess: &Session) -> Index<'tcx> {
let mut staged_api = FnvHashMap();
staged_api.insert(LOCAL_CRATE, is_staged_api);
staged_api.insert(LOCAL_CRATE, sess.features.borrow().staged_api);
Index {
staged_api: staged_api,
map: DefIdMap(),

View File

@ -738,7 +738,7 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
freevars,
region_map,
lang_items,
stability::Index::new(krate),
stability::Index::new(sess),
|tcx| {
// passes are timed inside typeck
typeck::check_crate(tcx, trait_map);

View File

@ -136,7 +136,7 @@ fn test_env<F>(source_string: &str,
freevars,
region_map,
lang_items,
stability::Index::new(krate),
stability::Index::new(&sess),
|tcx| {
let infcx = infer::new_infer_ctxt(tcx, &tcx.tables, None, false);
body(Env { infcx: &infcx });

View File

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

View File

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