Skip to content

Commit 1511df2

Browse files
committed
Add a test for feature attribute consistency
Note that this doesn't test consistency of some properties, like `reason`.
1 parent 372e128 commit 1511df2

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#![stable(feature = "stable_test_feature", since = "1.0.0")]
12+
13+
#![feature(staged_api)]
14+
15+
#[stable(feature = "foo", since = "1.0.0")]
16+
fn foo_stable_1_0_0() {}
17+
18+
#[stable(feature = "foo", since = "1.29.0")]
19+
//~^ ERROR feature `foo` is declared stable since 1.29.0
20+
fn foo_stable_1_29_0() {}
21+
22+
#[unstable(feature = "foo", issue = "0")]
23+
//~^ ERROR feature `foo` is declared unstable
24+
fn foo_unstable() {}
25+
26+
fn main() {}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error[E0711]: feature `foo` is declared stable since 1.29.0, but was previously declared stable since 1.0.0
2+
--> $DIR/stability-attribute-consistency.rs:18:1
3+
|
4+
LL | #[stable(feature = "foo", since = "1.29.0")]
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
7+
error[E0711]: feature `foo` is declared unstable, but was previously declared stable
8+
--> $DIR/stability-attribute-consistency.rs:22:1
9+
|
10+
LL | #[unstable(feature = "foo", issue = "0")]
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12+
13+
error: aborting due to 2 previous errors
14+
15+
For more information about this error, try `rustc --explain E0711`.

0 commit comments

Comments
 (0)