forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#131567 - CastilloDel:reject-unstable-with-accepted-features, r=jieyouxu Emit an error for unstable attributes that reference already stable features Closes rust-lang#129814
- Loading branch information
Showing
5 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
tests/ui/feature-gates/unstable-attribute-rejects-already-stable-features.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
//! Ensure #[unstable] doesn't accept already stable features | ||
|
||
#![feature(staged_api)] | ||
#![stable(feature = "rust_test", since = "1.0.0")] | ||
|
||
#[unstable(feature = "arbitrary_enum_discriminant", issue = "42")] //~ ERROR can't mark as unstable using an already stable feature | ||
#[rustc_const_unstable(feature = "arbitrary_enum_discriminant", issue = "42")] //~ ERROR can't mark as unstable using an already stable feature | ||
const fn my_fun() {} | ||
|
||
fn main() {} |
31 changes: 31 additions & 0 deletions
31
tests/ui/feature-gates/unstable-attribute-rejects-already-stable-features.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
error: can't mark as unstable using an already stable feature | ||
--> $DIR/unstable-attribute-rejects-already-stable-features.rs:6:1 | ||
| | ||
LL | #[unstable(feature = "arbitrary_enum_discriminant", issue = "42")] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this feature is already stable | ||
LL | #[rustc_const_unstable(feature = "arbitrary_enum_discriminant", issue = "42")] | ||
LL | const fn my_fun() {} | ||
| -------------------- the stability attribute annotates this item | ||
| | ||
help: consider removing the attribute | ||
--> $DIR/unstable-attribute-rejects-already-stable-features.rs:6:1 | ||
| | ||
LL | #[unstable(feature = "arbitrary_enum_discriminant", issue = "42")] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: can't mark as unstable using an already stable feature | ||
--> $DIR/unstable-attribute-rejects-already-stable-features.rs:7:1 | ||
| | ||
LL | #[rustc_const_unstable(feature = "arbitrary_enum_discriminant", issue = "42")] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this feature is already stable | ||
LL | const fn my_fun() {} | ||
| -------------------- the stability attribute annotates this item | ||
| | ||
help: consider removing the attribute | ||
--> $DIR/unstable-attribute-rejects-already-stable-features.rs:7:1 | ||
| | ||
LL | #[rustc_const_unstable(feature = "arbitrary_enum_discriminant", issue = "42")] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 2 previous errors | ||
|