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

+1
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

+6
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

+2
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

+2
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

+2
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

+2
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

+2
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

+2
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

+2
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

+2
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

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

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
// Note also that the `test_move_array_then_overwrite` tests represent
1515
// cases that we probably should make illegal.
1616

17+
#![feature(rustc_attrs)]
18+
1719
pub struct D { d: isize }
1820
impl Drop for D { fn drop(&mut self) { } }
1921

src/test/compile-fail/variance-associated-types.rs

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
// Test that the variance computation considers types/regions that
1212
// appear in projections to be invariant.
1313

14+
#![feature(rustc_attrs)]
15+
1416
trait Trait<'a> {
1517
type Type;
1618

src/test/compile-fail/variance-object-types.rs

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
// Test that Cell is considered invariant with respect to its
1212
// type.
1313

14+
#![feature(rustc_attrs)]
15+
1416
use std::cell::Cell;
1517

1618
// For better or worse, associated types are invariant, and hence we

src/test/compile-fail/variance-regions-direct.rs

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
// Regions that just appear in normal spots are contravariant:
1515

16+
#![feature(rustc_attrs)]
17+
1618
#[rustc_variance]
1719
struct Test2<'a, 'b, 'c> { //~ ERROR regions=[[-, -, -];[];[]]
1820
x: &'a isize,

src/test/compile-fail/variance-regions-indirect.rs

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
// case that involve multiple intricate types.
1313
// Try enums too.
1414

15+
#![feature(rustc_attrs)]
16+
1517
#[rustc_variance]
1618
enum Base<'a, 'b, 'c:'b, 'd> { //~ ERROR regions=[[+, -, o, *];[];[]]
1719
Test8A(extern "Rust" fn(&'a isize)),

src/test/compile-fail/variance-trait-object-bound.rs

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
//
1515
// Issue #18262.
1616

17+
#![feature(rustc_attrs)]
18+
1719
use std::mem;
1820

1921
trait T { fn foo(); }

0 commit comments

Comments
 (0)