Skip to content

const-check: stop recommending the use of rustc_allow_const_fn_unstable #141559

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 26, 2025

Conversation

RalfJung
Copy link
Member

@RalfJung RalfJung commented May 25, 2025

I have seen way too many people see the compiler suggest this attribute and then just apply it without a second thought. This is bad. So let's just stop recommending it; for the rare case where someone needs it, they'll eventually ask us and that way we can be sure that it is truly needed. The dev-guide still also explains rustc_allow_const_fn_unstable.

Cc @rust-lang/wg-const-eval

@rustbot
Copy link
Collaborator

rustbot commented May 25, 2025

r? @fee1-dead

rustbot has assigned @fee1-dead.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 25, 2025
@rustbot
Copy link
Collaborator

rustbot commented May 25, 2025

Some changes occurred to the CTFE machinery

cc @RalfJung, @oli-obk, @lcnr

Copy link
Member

@compiler-errors compiler-errors left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me with or without

@@ -424,8 +424,7 @@ const_eval_unstable_in_stable_exposed =
.unstable_sugg = if the {$is_function_call2 ->
[true] caller
*[false] function
} is not (yet) meant to be exposed to stable, add `#[rustc_const_unstable]` (this is what you probably want to do)
.bypass_sugg = otherwise, as a last resort `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks (this requires team approval)
} is not (yet) meant to be exposed to stable const contexts, add `#[rustc_const_unstable]` (this is what you probably want to do)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the parenthetical necessary now, since there's no longer two alternatives?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wondered the same thing and thought it could still be useful... but OTOH when there's only one suggestion, then I guess "obviously" this is what one wants to do?

@RalfJung RalfJung force-pushed the less-rustc_allow_const_fn_unstable branch from a263cb1 to cf9ac0e Compare May 25, 2025 20:47
@RalfJung
Copy link
Member Author

@bors r=compiler-errors rollup

@bors
Copy link
Collaborator

bors commented May 25, 2025

📌 Commit cf9ac0e has been approved by compiler-errors

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 25, 2025
jhpratt added a commit to jhpratt/rust that referenced this pull request May 25, 2025
…_unstable, r=compiler-errors

const-check: stop recommending the use of rustc_allow_const_fn_unstable

I have seen way too many people see the compiler suggest this attribute and then just apply it without a second thought. This is bad. So let's just stop recommending it; for the rare case where someone needs it, they'll eventually ask us and that way we can be sure that it is truly needed. The dev-guide still also explains `rustc_allow_const_fn_unstable`.

Cc `@rust-lang/wg-const-eval`
bors added a commit that referenced this pull request May 26, 2025
Rollup of 9 pull requests

Successful merges:

 - #134696 (Implement `normalize_lexically`)
 - #138744 (Add methods to TCP and UDP sockets to modify hop limit (refresh of #94678))
 - #140539 (Simplify `attribute_groups`)
 - #140863 ([rustdoc] Unify type aliases rendering with other ADT)
 - #140936 (Clarify WTF-8 safety docs)
 - #140952 (Specify that split_ascii_whitespace uses the same definition as is_ascii_whitespace)
 - #141472 (Attempt to improve the `std::fs::create_dir_all` docs related to atomicity)
 - #141502 (ci: move PR job x86_64-gnu-tools to codebuild)
 - #141559 (const-check: stop recommending the use of rustc_allow_const_fn_unstable)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request May 26, 2025
Rollup of 8 pull requests

Successful merges:

 - #134696 (Implement `normalize_lexically`)
 - #140539 (Simplify `attribute_groups`)
 - #140863 ([rustdoc] Unify type aliases rendering with other ADT)
 - #140936 (Clarify WTF-8 safety docs)
 - #140952 (Specify that split_ascii_whitespace uses the same definition as is_ascii_whitespace)
 - #141472 (Attempt to improve the `std::fs::create_dir_all` docs related to atomicity)
 - #141502 (ci: move PR job x86_64-gnu-tools to codebuild)
 - #141559 (const-check: stop recommending the use of rustc_allow_const_fn_unstable)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 5a8cb6f into rust-lang:master May 26, 2025
6 checks passed
rust-timer added a commit that referenced this pull request May 26, 2025
Rollup merge of #141559 - RalfJung:less-rustc_allow_const_fn_unstable, r=compiler-errors

const-check: stop recommending the use of rustc_allow_const_fn_unstable

I have seen way too many people see the compiler suggest this attribute and then just apply it without a second thought. This is bad. So let's just stop recommending it; for the rare case where someone needs it, they'll eventually ask us and that way we can be sure that it is truly needed. The dev-guide still also explains `rustc_allow_const_fn_unstable`.

Cc ``@rust-lang/wg-const-eval``
@ehuss ehuss added this to the 1.89.0 milestone May 26, 2025
@RalfJung RalfJung deleted the less-rustc_allow_const_fn_unstable branch May 27, 2025 06:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants