-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
mark is_val_statically_known intrinsic as stably const-callable #132449
Conversation
r? @ibraheemdev rustbot has assigned @ibraheemdev. Use |
This comment has been minimized.
This comment has been minimized.
ce42076
to
a63f6bd
Compare
This comment has been minimized.
This comment has been minimized.
a63f6bd
to
5cb9be1
Compare
@rustbot labels +I-lang-nominated Purported easy items must still be nominated to make it onto our agenda. |
library/core/src/intrinsics.rs
Outdated
@@ -2802,7 +2802,6 @@ where | |||
/// In other words, the following code has *Undefined Behavior*: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this intrinsic be unsafe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pub const fn is_val_statically_known<T: Copy>(_arg: T) -> bool {
it doesn't appear to be...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, discussed a bit in the meeting, I see that the unsafe thing is the use of unreachable, but it still feels like the user has a kind of obligation to use the result of this value to produce an "equivalent" results (i.e., it's intended for "performance specialization"). I suppose that we no longer guarantee deterministic results so maybe that's par for the course and not unsafe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, we made const_eval_select
safe with the same reasoning -- it's not UB-inducing, just undesired.
@rfcbot fcp merge |
Team member @traviscross has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! cc @rust-lang/lang-advisors: FCP proposed for lang, please feel free to register concerns. |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
@rfcbot reviewed |
r=me after fcp |
@rust-lang/lang I heard questions about the new stability attributes came up in the meeting today. If you are curious you can read the docs at https://rustc-dev-guide.rust-lang.org/stability.html#rustc_const_unstable. :) |
I went over all the rustc_allow_const_fn_unstable and this was the last one, so we're all cleaned up there now. :) |
☔ The latest upstream changes (presumably #132756) made this pull request unmergeable. Please resolve the merge conflicts. |
5cb9be1
to
7651fc6
Compare
Some changes occurred to the intrinsics. Make sure the CTFE / Miri interpreter cc @rust-lang/miri, @rust-lang/wg-const-eval |
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. This will be merged soon. |
@bors r=compiler-errors |
🌲 The tree is currently closed for pull requests below priority 100. This pull request will be tested once the tree is reopened. |
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#131717 (Stabilize `const_atomic_from_ptr`) - rust-lang#132134 (Remove `ResultsVisitable`) - rust-lang#132449 (mark is_val_statically_known intrinsic as stably const-callable) - rust-lang#132569 (rustdoc search: allow queries to end in an empty path segment) - rust-lang#132787 (Unify FnKind between AST visitors and make WalkItemKind more straight forward) - rust-lang#132832 (Deny capturing late-bound ty/const params in nested opaques) - rust-lang#133097 (Opt out TaKO8Ki from review rotation for now) r? `@ghost` `@rustbot` modify labels: rollup
…r=compiler-errors mark is_val_statically_known intrinsic as stably const-callable The intrinsic doesn't actually "do" anything in terms of language semantics, and we are already using it in stable const fn. So let's just properly mark it as stably const-callable to avoid needing `rustc_allow_const_fn_unstable` (and thus reducing noise and keeping the remaining `rustc_allow_const_fn_unstable` as a more clear signal). Cc ``@rust-lang/lang`` usually you have to approve exposing intrinsics in const, but this intrinsic is basically just a compiler implementation detail. So FCP doesn't seem necessary. Cc ``@rust-lang/wg-const-eval``
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#131717 (Stabilize `const_atomic_from_ptr`) - rust-lang#132134 (Remove `ResultsVisitable`) - rust-lang#132449 (mark is_val_statically_known intrinsic as stably const-callable) - rust-lang#132569 (rustdoc search: allow queries to end in an empty path segment) - rust-lang#132787 (Unify FnKind between AST visitors and make WalkItemKind more straight forward) - rust-lang#132832 (Deny capturing late-bound ty/const params in nested opaques) - rust-lang#133097 (Opt out TaKO8Ki from review rotation for now) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#132449 - RalfJung:is_val_statically_known, r=compiler-errors mark is_val_statically_known intrinsic as stably const-callable The intrinsic doesn't actually "do" anything in terms of language semantics, and we are already using it in stable const fn. So let's just properly mark it as stably const-callable to avoid needing `rustc_allow_const_fn_unstable` (and thus reducing noise and keeping the remaining `rustc_allow_const_fn_unstable` as a more clear signal). Cc `@rust-lang/lang` usually you have to approve exposing intrinsics in const, but this intrinsic is basically just a compiler implementation detail. So FCP doesn't seem necessary. Cc `@rust-lang/wg-const-eval`
Rollup of 8 pull requests Successful merges: - rust-lang#131717 (Stabilize `const_atomic_from_ptr`) - rust-lang#132449 (mark is_val_statically_known intrinsic as stably const-callable) - rust-lang#132569 (rustdoc search: allow queries to end in an empty path segment) - rust-lang#133029 (ABI checks: add support for some tier3 arches, warn on others.) - rust-lang#133093 (Let chains tests) - rust-lang#133097 (Opt out TaKO8Ki from review rotation for now) - rust-lang#133116 (stabilize const_ptr_is_null) - rust-lang#133126 (alloc: fix `String`'s doc) r? `@ghost` `@rustbot` modify labels: rollup
The intrinsic doesn't actually "do" anything in terms of language semantics, and we are already using it in stable const fn. So let's just properly mark it as stably const-callable to avoid needing
rustc_allow_const_fn_unstable
(and thus reducing noise and keeping the remainingrustc_allow_const_fn_unstable
as a more clear signal).Cc @rust-lang/lang usually you have to approve exposing intrinsics in const, but this intrinsic is basically just a compiler implementation detail. So FCP doesn't seem necessary.
Cc @rust-lang/wg-const-eval