Skip to content

Commit bb407b1

Browse files
committed
Make stability attributes an error. #22830
1 parent f46c4e1 commit bb407b1

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

src/librustc/middle/stability.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ impl<'a> Annotator<'a> {
9595
let tag = attr.name();
9696
if tag == "unstable" || tag == "stable" || tag == "deprecated" {
9797
attr::mark_used(attr);
98-
self.sess.span_warn(attr.span(),
99-
"stability attributes are deprecated \
100-
and will soon become errors");
98+
self.sess.span_err(attr.span(),
99+
"stability attributes may not be used outside \
100+
of the standard library");
101101
}
102102
}
103103
f(self);

src/librustc_data_structures/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@
2222
#![unstable(feature = "rustc_private")]
2323
#![crate_type = "dylib"]
2424
#![crate_type = "rlib"]
25+
#![staged_api]
2526
#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
2627
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
2728
html_root_url = "http://doc.rust-lang.org/nightly/")]
2829

29-
#![feature(rustc_private)]
30+
#![feature(rustc_private, staged_api)]
3031
#![cfg_attr(test, feature(test))]
3132

3233
#[macro_use] extern crate log;

src/test/compile-fail/stability-attribute-non-staged.rs

+3-7
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// These two generate an error to satisfy the compile-fail test
12-
#![deny(warnings)]
13-
#![feature(blah)] //~ ERROR
14-
15-
#[unstable] //~ WARNING: stability attributes are deprecated
16-
#[stable] //~ WARNING: stability attributes are deprecated
17-
#[deprecated] //~ WARNING: stability attributes are deprecated
11+
#[unstable] //~ ERROR: stability attributes may not be used
12+
#[stable] //~ ERROR: stability attributes may not be used
13+
#[deprecated] //~ ERROR: stability attributes may not be used
1814
fn main() { }

0 commit comments

Comments
 (0)