-
Notifications
You must be signed in to change notification settings - Fork 13k
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 #77203 - ecstatic-morse:const-stability-attr-checks, …
…r=oli-obk Check for missing const-stability attributes in `rustc_passes` Currently, this happens as a side effect of `is_min_const_fn`, which is non-obvious. Also adds a test for this case, since we didn't seem to have one before.
- Loading branch information
Showing
5 changed files
with
52 additions
and
11 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
12 changes: 12 additions & 0 deletions
12
src/test/ui/stability-attribute/missing-const-stability.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,12 @@ | ||
#![feature(staged_api)] | ||
|
||
#![stable(feature = "rust1", since = "1.0.0")] | ||
|
||
#[stable(feature = "foo", since = "1.0.0")] | ||
pub const fn foo() {} | ||
//~^ ERROR rustc_const_stable | ||
|
||
#[unstable(feature = "bar", issue = "none")] | ||
pub const fn bar() {} // ok | ||
|
||
fn main() {} |
8 changes: 8 additions & 0 deletions
8
src/test/ui/stability-attribute/missing-const-stability.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,8 @@ | ||
error: `#[stable]` const functions must also be either `#[rustc_const_stable]` or `#[rustc_const_unstable]` | ||
--> $DIR/missing-const-stability.rs:6:1 | ||
| | ||
LL | pub const fn foo() {} | ||
| ^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|