提交 5127d24a 编写于 作者: V Vadim Petrochenkov

Remove `#[staged_api]`

上级 1b9a13e6
......@@ -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.
......
......@@ -350,12 +350,19 @@ fn register_crate(&mut self,
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,
......
......@@ -279,19 +279,9 @@ pub fn build(&mut self, tcx: &ty::ctxt<'tcx>, krate: &Crate, access_levels: &Acc
|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(),
......
......@@ -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);
......
......@@ -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 });
......
......@@ -277,8 +277,6 @@ enum Status {
// 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 @@ pub fn new() -> 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"),
}
}
......
// 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() { }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册