Skip to content
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

Merged
merged 1 commit into from
Nov 17, 2024

Conversation

RalfJung
Copy link
Member

@RalfJung RalfJung commented Nov 1, 2024

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

@rustbot
Copy link
Collaborator

rustbot commented Nov 1, 2024

r? @ibraheemdev

rustbot has assigned @ibraheemdev.
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-libs Relevant to the library team, which will review and decide on the PR/issue. labels Nov 1, 2024
@RalfJung RalfJung added the I-lang-easy-decision Issue: The decision needed by the team is conjectured to be easy. label Nov 1, 2024
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@traviscross
Copy link
Contributor

@rustbot labels +I-lang-nominated

Purported easy items must still be nominated to make it onto our agenda.

@rustbot rustbot added the I-lang-nominated Nominated for discussion during a lang team meeting. label Nov 2, 2024
@@ -2802,7 +2802,6 @@ where
/// In other words, the following code has *Undefined Behavior*:
Copy link
Contributor

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?

Copy link
Contributor

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...?

Copy link
Contributor

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

Copy link
Member Author

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.

@traviscross
Copy link
Contributor

@rfcbot fcp merge

Thanks @RalfJung for working to clean this sort of thing up.

@traviscross traviscross added T-lang Relevant to the language team, which will review and decide on the PR/issue. and removed T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Nov 6, 2024
@traviscross
Copy link
Contributor

@rfcbot fcp merge

@rfcbot
Copy link

rfcbot commented Nov 6, 2024

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.
See this document for info about what commands tagged team members can give me.

@rfcbot rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. and removed proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. labels Nov 6, 2024
@rfcbot
Copy link

rfcbot commented Nov 6, 2024

🔔 This is now entering its final comment period, as per the review above. 🔔

@nikomatsakis
Copy link
Contributor

@rfcbot reviewed

@compiler-errors
Copy link
Member

r=me after fcp

@RalfJung
Copy link
Member Author

RalfJung commented Nov 6, 2024

@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. :)

@RalfJung
Copy link
Member Author

RalfJung commented Nov 6, 2024

Thanks for working to clean this sort of thing up.

I went over all the rustc_allow_const_fn_unstable and this was the last one, so we're all cleaned up there now. :)
Same for rustc_const_unstable, those are all either in FCP or still very fresh (except for HashMap::with_hasher, I am working on that one). So we are ready for the next wave of unstable experimentation, with const traits. :)

@traviscross traviscross removed the I-lang-nominated Nominated for discussion during a lang team meeting. label Nov 6, 2024
@bors
Copy link
Contributor

bors commented Nov 8, 2024

☔ The latest upstream changes (presumably #132756) made this pull request unmergeable. Please resolve the merge conflicts.

@rustbot
Copy link
Collaborator

rustbot commented Nov 8, 2024

Some changes occurred to the intrinsics. Make sure the CTFE / Miri interpreter
gets adapted for the changes, if necessary.

cc @rust-lang/miri, @rust-lang/wg-const-eval

@RalfJung RalfJung added S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 10, 2024
@rfcbot rfcbot added finished-final-comment-period The final comment period is finished for this PR / Issue. to-announce Announce this issue on triage meeting and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Nov 16, 2024
@rfcbot
Copy link

rfcbot commented Nov 16, 2024

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.

@RalfJung
Copy link
Member Author

@bors r=compiler-errors

@bors
Copy link
Contributor

bors commented Nov 16, 2024

📌 Commit 7651fc6 has been approved by compiler-errors

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Nov 16, 2024

🌲 The tree is currently closed for pull requests below priority 100. This pull request will be tested once the tree is reopened.

@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-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). labels Nov 16, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 16, 2024
…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
jhpratt added a commit to jhpratt/rust that referenced this pull request Nov 17, 2024
…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``
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 17, 2024
…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
@bors bors merged commit fb5bd7f into rust-lang:master Nov 17, 2024
6 checks passed
@rustbot rustbot added this to the 1.84.0 milestone Nov 17, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Nov 17, 2024
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`
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 17, 2024
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
@RalfJung RalfJung deleted the is_val_statically_known branch November 18, 2024 06:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. I-lang-easy-decision Issue: The decision needed by the team is conjectured to be easy. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-lang Relevant to the language team, which will review and decide on the PR/issue. to-announce Announce this issue on triage meeting
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants