Skip to content

Commit 6d88afe

Browse files
committed
Auto merge of #30015 - petrochenkov:staged, r=brson
Closes #30008 `#[stable]`, `#[unstable]` and `#[rustc_deprecated]` are now guarded by `#[feature(staged_api)]` r? @brson
2 parents 1805bba + 4b80784 commit 6d88afe

File tree

58 files changed

+47
-84
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+47
-84
lines changed

src/doc/reference.md

-4
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/liballoc/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
#![cfg_attr(stage0, feature(custom_attribute))]
6161
#![crate_name = "alloc"]
6262
#![crate_type = "rlib"]
63-
#![staged_api]
63+
#![cfg_attr(stage0, staged_api)]
6464
#![allow(unused_attributes)]
6565
#![unstable(feature = "alloc",
6666
reason = "this library is unlikely to be stabilized in its current \

src/liballoc_jemalloc/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#![cfg_attr(stage0, feature(custom_attribute))]
1212
#![crate_name = "alloc_jemalloc"]
1313
#![crate_type = "rlib"]
14-
#![staged_api]
14+
#![cfg_attr(stage0, staged_api)]
1515
#![no_std]
1616
#![cfg_attr(not(stage0), allocator)]
1717
#![cfg_attr(stage0, allow(improper_ctypes))]

src/liballoc_system/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#![cfg_attr(stage0, feature(custom_attribute))]
1212
#![crate_name = "alloc_system"]
1313
#![crate_type = "rlib"]
14-
#![staged_api]
14+
#![cfg_attr(stage0, staged_api)]
1515
#![no_std]
1616
#![cfg_attr(not(stage0), allocator)]
1717
#![cfg_attr(stage0, allow(improper_ctypes))]

src/libarena/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#![cfg_attr(stage0, feature(custom_attribute))]
2424
#![crate_name = "arena"]
2525
#![unstable(feature = "rustc_private", issue = "27812")]
26-
#![staged_api]
26+
#![cfg_attr(stage0, staged_api)]
2727
#![crate_type = "rlib"]
2828
#![crate_type = "dylib"]
2929
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",

src/libcollections/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
// Do not remove on snapshot creation. Needed for bootstrap. (Issue #22364)
1717
#![cfg_attr(stage0, feature(custom_attribute))]
1818
#![crate_name = "collections"]
19-
#![staged_api]
19+
#![cfg_attr(stage0, staged_api)]
2020
#![crate_type = "rlib"]
2121
#![unstable(feature = "collections",
2222
reason = "library is unlikely to be stabilized with the current \

src/libcore/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
reason = "the libcore library has not yet been scrutinized for \
5757
stabilization in terms of structure and naming",
5858
issue = "27701")]
59-
#![staged_api]
59+
#![cfg_attr(stage0, staged_api)]
6060
#![crate_type = "rlib"]
6161
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
6262
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",

src/libflate/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#![cfg_attr(stage0, feature(custom_attribute))]
1919
#![crate_name = "flate"]
2020
#![unstable(feature = "rustc_private", issue = "27812")]
21-
#![staged_api]
21+
#![cfg_attr(stage0, staged_api)]
2222
#![crate_type = "rlib"]
2323
#![crate_type = "dylib"]
2424
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",

src/libfmt_macros/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#![cfg_attr(stage0, feature(custom_attribute))]
1919
#![crate_name = "fmt_macros"]
2020
#![unstable(feature = "rustc_private", issue = "27812")]
21-
#![staged_api]
21+
#![cfg_attr(stage0, staged_api)]
2222
#![crate_type = "rlib"]
2323
#![crate_type = "dylib"]
2424
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",

src/libgetopts/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
#![unstable(feature = "rustc_private",
8585
reason = "use the crates.io `getopts` library instead",
8686
issue = "27812")]
87-
#![staged_api]
87+
#![cfg_attr(stage0, staged_api)]
8888
#![crate_type = "rlib"]
8989
#![crate_type = "dylib"]
9090
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",

src/libgraphviz/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@
276276
#![crate_name = "graphviz"]
277277
#![unstable(feature = "rustc_private", issue = "27812")]
278278
#![feature(staged_api)]
279-
#![staged_api]
279+
#![cfg_attr(stage0, staged_api)]
280280
#![crate_type = "rlib"]
281281
#![crate_type = "dylib"]
282282
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",

src/liblibc

Submodule liblibc updated 1 file

src/liblog/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@
162162
#![unstable(feature = "rustc_private",
163163
reason = "use the crates.io `log` library instead",
164164
issue = "27812")]
165-
#![staged_api]
165+
#![cfg_attr(stage0, staged_api)]
166166
#![crate_type = "rlib"]
167167
#![crate_type = "dylib"]
168168
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",

src/librand/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
html_playground_url = "https://play.rust-lang.org/",
2727
test(attr(deny(warnings))))]
2828
#![no_std]
29-
#![staged_api]
29+
#![cfg_attr(stage0, staged_api)]
3030
#![unstable(feature = "rand",
3131
reason = "use `rand` from crates.io",
3232
issue = "27703")]

src/librbml/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@
115115
#![cfg_attr(stage0, feature(custom_attribute))]
116116
#![crate_name = "rbml"]
117117
#![unstable(feature = "rustc_private", issue = "27812")]
118-
#![staged_api]
118+
#![cfg_attr(stage0, staged_api)]
119119
#![crate_type = "rlib"]
120120
#![crate_type = "dylib"]
121121
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",

src/librustc/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#![cfg_attr(stage0, feature(custom_attribute))]
1919
#![crate_name = "rustc"]
2020
#![unstable(feature = "rustc_private", issue = "27812")]
21-
#![staged_api]
21+
#![cfg_attr(stage0, staged_api)]
2222
#![crate_type = "dylib"]
2323
#![crate_type = "rlib"]
2424
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",

src/librustc/metadata/creader.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -350,12 +350,11 @@ 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() == "stable" || attr.name() == "unstable" {
354+
return true
355355
}
356356
}
357-
358-
return false;
357+
false
359358
}
360359

361360
fn resolve_crate(&mut self,

src/librustc/middle/stability.rs

+6-8
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ impl<'a, 'tcx: 'a> Annotator<'a, 'tcx> {
8585
item_sp: Span, kind: AnnotationKind, visit_children: F)
8686
where F: FnOnce(&mut Annotator)
8787
{
88-
if self.index.staged_api[&LOCAL_CRATE] {
88+
if self.index.staged_api[&LOCAL_CRATE] && self.tcx.sess.features.borrow().staged_api {
8989
debug!("annotate(id = {:?}, attrs = {:?})", id, attrs);
9090
if let Some(mut stab) = attr::find_stability(self.tcx.sess.diagnostic(),
9191
attrs, item_sp) {
@@ -279,17 +279,15 @@ impl<'tcx> Index<'tcx> {
279279
|v| intravisit::walk_crate(v, krate));
280280
}
281281

282-
pub fn new(krate: &Crate) -> Index {
282+
pub fn new(krate: &Crate) -> Index<'tcx> {
283283
let mut is_staged_api = false;
284284
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-
}
285+
if attr.name() == "stable" || attr.name() == "unstable" {
286+
is_staged_api = true;
287+
break
291288
}
292289
}
290+
293291
let mut staged_api = FnvHashMap();
294292
staged_api.insert(LOCAL_CRATE, is_staged_api);
295293
Index {

src/librustc_back/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#![cfg_attr(stage0, feature(custom_attribute))]
2626
#![crate_name = "rustc_back"]
2727
#![unstable(feature = "rustc_private", issue = "27812")]
28-
#![staged_api]
28+
#![cfg_attr(stage0, staged_api)]
2929
#![crate_type = "dylib"]
3030
#![crate_type = "rlib"]
3131
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",

src/librustc_bitflags/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#![crate_name = "rustc_bitflags"]
1515
#![feature(associated_consts)]
1616
#![feature(staged_api)]
17-
#![staged_api]
17+
#![cfg_attr(stage0, staged_api)]
1818
#![crate_type = "rlib"]
1919
#![feature(no_std)]
2020
#![no_std]

src/librustc_borrowck/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#![cfg_attr(stage0, feature(custom_attribute))]
1313
#![crate_name = "rustc_borrowck"]
1414
#![unstable(feature = "rustc_private", issue = "27812")]
15-
#![staged_api]
15+
#![cfg_attr(stage0, staged_api)]
1616
#![crate_type = "dylib"]
1717
#![crate_type = "rlib"]
1818
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",

src/librustc_data_structures/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#![unstable(feature = "rustc_private", issue = "27812")]
2323
#![crate_type = "dylib"]
2424
#![crate_type = "rlib"]
25-
#![staged_api]
25+
#![cfg_attr(stage0, staged_api)]
2626
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
2727
html_favicon_url = "https://www.rust-lang.org/favicon.ico",
2828
html_root_url = "https://doc.rust-lang.org/nightly/")]

src/librustc_driver/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#![cfg_attr(stage0, feature(custom_attribute))]
1919
#![crate_name = "rustc_driver"]
2020
#![unstable(feature = "rustc_private", issue = "27812")]
21-
#![staged_api]
21+
#![cfg_attr(stage0, staged_api)]
2222
#![crate_type = "dylib"]
2323
#![crate_type = "rlib"]
2424
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",

src/librustc_front/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#![cfg_attr(stage0, feature(custom_attribute))]
1919
#![crate_name = "rustc_front"]
2020
#![unstable(feature = "rustc_private", issue = "27812")]
21-
#![staged_api]
21+
#![cfg_attr(stage0, staged_api)]
2222
#![crate_type = "dylib"]
2323
#![crate_type = "rlib"]
2424
#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",

src/librustc_lint/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#![cfg_attr(stage0, feature(custom_attribute))]
2424
#![crate_name = "rustc_lint"]
2525
#![unstable(feature = "rustc_private", issue = "27812")]
26-
#![staged_api]
26+
#![cfg_attr(stage0, staged_api)]
2727
#![crate_type = "dylib"]
2828
#![crate_type = "rlib"]
2929
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",

src/librustc_llvm/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
#![crate_name = "rustc_llvm"]
2222
#![unstable(feature = "rustc_private", issue = "27812")]
23-
#![staged_api]
23+
#![cfg_attr(stage0, staged_api)]
2424
#![crate_type = "dylib"]
2525
#![crate_type = "rlib"]
2626
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",

src/librustc_platform_intrinsics/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#![cfg_attr(stage0, feature(custom_attribute))]
1212
#![crate_name = "rustc_platform_intrinsics"]
1313
#![unstable(feature = "rustc_private", issue = "27812")]
14-
#![staged_api]
14+
#![cfg_attr(stage0, staged_api)]
1515
#![crate_type = "dylib"]
1616
#![crate_type = "rlib"]
1717
#![feature(staged_api, rustc_private)]

src/librustc_privacy/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#![cfg_attr(stage0, feature(custom_attribute))]
1313
#![crate_name = "rustc_privacy"]
1414
#![unstable(feature = "rustc_private", issue = "27812")]
15-
#![staged_api]
15+
#![cfg_attr(stage0, staged_api)]
1616
#![crate_type = "dylib"]
1717
#![crate_type = "rlib"]
1818
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",

src/librustc_resolve/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#![cfg_attr(stage0, feature(custom_attribute))]
1313
#![crate_name = "rustc_resolve"]
1414
#![unstable(feature = "rustc_private", issue = "27812")]
15-
#![staged_api]
15+
#![cfg_attr(stage0, staged_api)]
1616
#![crate_type = "dylib"]
1717
#![crate_type = "rlib"]
1818
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",

src/librustc_trans/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#![cfg_attr(stage0, feature(custom_attribute))]
1919
#![crate_name = "rustc_trans"]
2020
#![unstable(feature = "rustc_private", issue = "27812")]
21-
#![staged_api]
21+
#![cfg_attr(stage0, staged_api)]
2222
#![crate_type = "dylib"]
2323
#![crate_type = "rlib"]
2424
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",

src/librustc_typeck/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ This API is completely unstable and subject to change.
6666
#![cfg_attr(stage0, feature(custom_attribute))]
6767
#![crate_name = "rustc_typeck"]
6868
#![unstable(feature = "rustc_private", issue = "27812")]
69-
#![staged_api]
69+
#![cfg_attr(stage0, staged_api)]
7070
#![crate_type = "dylib"]
7171
#![crate_type = "rlib"]
7272
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",

src/librustc_unicode/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#![cfg_attr(stage0, feature(custom_attribute))]
2525
#![crate_name = "rustc_unicode"]
2626
#![unstable(feature = "unicode", issue = "27783")]
27-
#![staged_api]
27+
#![cfg_attr(stage0, staged_api)]
2828
#![crate_type = "rlib"]
2929
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
3030
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",

src/librustdoc/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#![cfg_attr(stage0, feature(custom_attribute))]
1313
#![crate_name = "rustdoc"]
1414
#![unstable(feature = "rustdoc", issue = "27812")]
15-
#![staged_api]
15+
#![cfg_attr(stage0, staged_api)]
1616
#![crate_type = "dylib"]
1717
#![crate_type = "rlib"]
1818
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",

src/libserialize/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Core encoding and decoding interfaces.
2020
#![unstable(feature = "rustc_private",
2121
reason = "deprecated in favor of rustc-serialize on crates.io",
2222
issue = "27812")]
23-
#![staged_api]
23+
#![cfg_attr(stage0, staged_api)]
2424
#![crate_type = "rlib"]
2525
#![crate_type = "dylib"]
2626
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",

src/libstd/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@
202202
#![cfg_attr(stage0, feature(custom_attribute))]
203203
#![crate_name = "std"]
204204
#![stable(feature = "rust1", since = "1.0.0")]
205-
#![staged_api]
205+
#![cfg_attr(stage0, staged_api)]
206206
#![crate_type = "rlib"]
207207
#![crate_type = "dylib"]
208208
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",

src/libsyntax/feature_gate.rs

+3-2
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/libsyntax/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#![cfg_attr(stage0, feature(custom_attribute))]
1919
#![crate_name = "syntax"]
2020
#![unstable(feature = "rustc_private", issue = "27812")]
21-
#![staged_api]
21+
#![cfg_attr(stage0, staged_api)]
2222
#![crate_type = "dylib"]
2323
#![crate_type = "rlib"]
2424
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",

src/libterm/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
#![unstable(feature = "rustc_private",
4848
reason = "use the crates.io `term` library instead",
4949
issue = "27812")]
50-
#![staged_api]
50+
#![cfg_attr(stage0, staged_api)]
5151
#![crate_type = "rlib"]
5252
#![crate_type = "dylib"]
5353
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",

0 commit comments

Comments
 (0)