Skip to content

Commit 5127d24

Browse files
committed
Remove #[staged_api]
1 parent 1b9a13e commit 5127d24

File tree

7 files changed

+18
-37
lines changed

7 files changed

+18
-37
lines changed

src/doc/reference.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2325,10 +2325,6 @@ The currently implemented features of the reference compiler are:
23252325
* `simd_ffi` - Allows use of SIMD vectors in signatures for foreign functions.
23262326
The SIMD interface is subject to change.
23272327

2328-
* `staged_api` - Allows usage of stability markers and `#![staged_api]` in a
2329-
crate. Stability markers are also attributes: `#[stable]`,
2330-
`#[unstable]`, and `#[rustc_deprecated]` are the three levels.
2331-
23322328
* `start` - Allows use of the `#[start]` attribute, which changes the entry point
23332329
into a Rust program. This capability, especially the signature for the
23342330
annotated function, is subject to change.

src/librustc/metadata/creader.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,12 +350,19 @@ impl<'a> CrateReader<'a> {
350350
fn is_staged_api(&self, data: &[u8]) -> bool {
351351
let attrs = decoder::get_crate_attributes(data);
352352
for attr in &attrs {
353-
if &attr.name()[..] == "staged_api" {
354-
match attr.node.value.node { ast::MetaWord(_) => return true, _ => (/*pass*/) }
353+
if attr.name() == "feature" {
354+
if let Some(metas) = attr.meta_item_list() {
355+
for meta in metas {
356+
if let ast::MetaWord(ref name) = meta.node {
357+
if &name[..] == "staged_api" {
358+
return true
359+
}
360+
}
361+
}
362+
}
355363
}
356364
}
357-
358-
return false;
365+
false
359366
}
360367

361368
fn resolve_crate(&mut self,

src/librustc/middle/stability.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -279,19 +279,9 @@ impl<'tcx> Index<'tcx> {
279279
|v| intravisit::walk_crate(v, krate));
280280
}
281281

282-
pub fn new(krate: &Crate) -> Index {
283-
let mut is_staged_api = false;
284-
for attr in &krate.attrs {
285-
if attr.name() == "staged_api" {
286-
if let ast::MetaWord(_) = attr.node.value.node {
287-
attr::mark_used(attr);
288-
is_staged_api = true;
289-
break
290-
}
291-
}
292-
}
282+
pub fn new(sess: &Session) -> Index<'tcx> {
293283
let mut staged_api = FnvHashMap();
294-
staged_api.insert(LOCAL_CRATE, is_staged_api);
284+
staged_api.insert(LOCAL_CRATE, sess.features.borrow().staged_api);
295285
Index {
296286
staged_api: staged_api,
297287
map: DefIdMap(),

src/librustc_driver/driver.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
738738
freevars,
739739
region_map,
740740
lang_items,
741-
stability::Index::new(krate),
741+
stability::Index::new(sess),
742742
|tcx| {
743743
// passes are timed inside typeck
744744
typeck::check_crate(tcx, trait_map);

src/librustc_driver/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ fn test_env<F>(source_string: &str,
136136
freevars,
137137
region_map,
138138
lang_items,
139-
stability::Index::new(krate),
139+
stability::Index::new(&sess),
140140
|tcx| {
141141
let infcx = infer::new_infer_ctxt(tcx, &tcx.tables, None, false);
142142
body(Env { infcx: &infcx });

src/libsyntax/feature_gate.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,6 @@ pub const KNOWN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeGat
277277
// Not used any more, but we can't feature gate it
278278
("no_stack_check", Normal, Ungated),
279279

280-
("staged_api", CrateLevel, Gated("staged_api",
281-
"staged_api is for use by rustc only")),
282280
("plugin", CrateLevel, Gated("plugin",
283281
"compiler plugins are experimental \
284282
and possibly buggy")),
@@ -501,6 +499,7 @@ pub struct Features {
501499
pub cfg_target_vendor: bool,
502500
pub augmented_assignments: bool,
503501
pub braced_empty_structs: bool,
502+
pub staged_api: bool,
504503
}
505504

506505
impl Features {
@@ -532,6 +531,7 @@ impl Features {
532531
cfg_target_vendor: false,
533532
augmented_assignments: false,
534533
braced_empty_structs: false,
534+
staged_api: false,
535535
}
536536
}
537537
}
@@ -1104,6 +1104,7 @@ fn check_crate_inner<F>(cm: &CodeMap, span_handler: &SpanHandler,
11041104
cfg_target_vendor: cx.has_feature("cfg_target_vendor"),
11051105
augmented_assignments: cx.has_feature("augmented_assignments"),
11061106
braced_empty_structs: cx.has_feature("braced_empty_structs"),
1107+
staged_api: cx.has_feature("staged_api"),
11071108
}
11081109
}
11091110

src/test/compile-fail/staged_api.rs

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)