Skip to content

Commit 7ca06ea

Browse files
committed
Feature gate attributes starting with rustc_. This can be considered a downpayment on RFC #572.
1 parent df54632 commit 7ca06ea

16 files changed

+35
-0
lines changed

src/libcore/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
#![feature(simd, unsafe_destructor, slicing_syntax)]
6868
#![feature(staged_api)]
6969
#![feature(unboxed_closures)]
70+
#![feature(rustc_attrs)]
7071

7172
#[macro_use]
7273
mod macros;

src/libsyntax/feature_gate.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ static KNOWN_FEATURES: &'static [(&'static str, &'static str, Status)] = &[
9191
("start", "1.0.0", Active),
9292
("main", "1.0.0", Active),
9393

94+
("rustc_attrs", "1.0.0", Active),
95+
9496
// A temporary feature gate used to enable parser extensions needed
9597
// to bootstrap fix for #5723.
9698
("issue_5723_bootstrap", "1.0.0", Accepted),
@@ -287,6 +289,10 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
287289
self.gate_feature("on_unimplemented", i.span,
288290
"the `#[rustc_on_unimplemented]` attribute \
289291
is an experimental feature")
292+
} else if attr.name().starts_with("rustc_") {
293+
self.gate_feature("rustc_attrs", i.span,
294+
"unless otherwise specified, attributes with the prefix `rustc_` \
295+
are reserved for internal compiler diagnostics")
290296
}
291297
}
292298
match i.node {

src/test/compile-fail/move-fragments-1.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
// These are all fairly trivial cases: unused variables or direct
1919
// drops of substructure.
2020

21+
#![feature(rustc_attrs)]
22+
2123
pub struct D { d: isize }
2224
impl Drop for D { fn drop(&mut self) { } }
2325

src/test/compile-fail/move-fragments-2.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
// These are checking that enums are tracked; note that their output
1919
// paths include "downcasts" of the path to a particular enum.
2020

21+
#![feature(rustc_attrs)]
22+
2123
use self::Lonely::{Zero, One, Two};
2224

2325
pub struct D { d: isize }

src/test/compile-fail/move-fragments-3.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
// This checks the handling of `_` within variants, especially when mixed
1919
// with bindings.
2020

21+
#![feature(rustc_attrs)]
22+
2123
use self::Lonely::{Zero, One, Two};
2224

2325
pub struct D { d: isize }

src/test/compile-fail/move-fragments-4.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
// early draft of the code did not properly traverse up through all of
2020
// the parents of the leaf fragment.)
2121

22+
#![feature(rustc_attrs)]
23+
2224
pub struct D { d: isize }
2325
impl Drop for D { fn drop(&mut self) { } }
2426

src/test/compile-fail/move-fragments-5.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
// This is the first test that checks moving into local variables.
1919

20+
#![feature(rustc_attrs)]
21+
2022
pub struct D { d: isize }
2123
impl Drop for D { fn drop(&mut self) { } }
2224

src/test/compile-fail/move-fragments-6.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
// Test that moving into a field (i.e. overwriting it) fragments the
1919
// receiver.
2020

21+
#![feature(rustc_attrs)]
22+
2123
use std::mem::drop;
2224

2325
pub struct Pair<X,Y> { x: X, y: Y }

src/test/compile-fail/move-fragments-7.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
// both moving out of the structure (i.e. reading `*p.x`) and writing
2020
// into the container (i.e. writing `*p.x`).
2121

22+
#![feature(rustc_attrs)]
23+
2224
pub struct D { d: isize }
2325
impl Drop for D { fn drop(&mut self) { } }
2426

src/test/compile-fail/move-fragments-8.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
// also that in this case we cannot do a move out of `&T`, so we only
2323
// test writing `*p.x` here.
2424

25+
#![feature(rustc_attrs)]
26+
2527
pub struct D { d: isize }
2628
impl Drop for D { fn drop(&mut self) { } }
2729

0 commit comments

Comments
 (0)