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

stabilize const_extern_fn #129753

Merged
merged 1 commit into from
Sep 15, 2024
Merged

Conversation

folkertdev
Copy link
Contributor

@folkertdev folkertdev commented Aug 29, 2024

closes #64926

tracking issue: #64926
reference PR: rust-lang/reference#1596

Stabilizaton Report

Summary

Using const extern "Rust" and const extern "C" was already stabilized (since version 1.62.0, see #95346). This PR stabilizes the other calling conventions: it is now possible to write const unsafe extern "calling-convention" fn and const extern "calling-convention" fn for any supported calling convention:

const extern "C-unwind" fn foo1(val: u8) -> u8 { val + 1}
const extern "stdcall" fn foo2(val: u8) -> u8 { val + 1}
const unsafe extern "C-unwind" fn bar1(val: bool) -> bool { !val }
const unsafe extern "stdcall" fn bar2(val: bool) -> bool { !val }

This can be used to const-ify an extern fn, or conversely, to make a const fn callable from external code.

r? T-lang

cc @RalfJung

@rustbot
Copy link
Collaborator

rustbot commented Aug 29, 2024

Failed to set assignee to t-lang: invalid assignee

Note: Only org members with at least the repository "read" role, users with write permissions, or people who have commented on the PR may be assigned.

@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. T-lang Relevant to the language team, which will review and decide on the PR/issue. labels Aug 29, 2024
@RalfJung RalfJung added the I-lang-nominated Nominated for discussion during a lang team meeting. label Aug 29, 2024
@RalfJung
Copy link
Member

The unstable book is auto-generated, AFAIK.

Cc @rust-lang/wg-const-eval
As already mentioned in #64926, I see no reason why other ABIs would somehow behave differently here.

@rust-log-analyzer

This comment has been minimized.

@traviscross
Copy link
Contributor

@folkertdev: Perhaps you're working on it in parallel, but you'll want to add more in the way of a stabilization report to the PR description here (see e.g. the recent stabilizations from RalfJ for some examples).

@rustbot
Copy link
Collaborator

rustbot commented Aug 29, 2024

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

Comment on lines 20 to 22
1,81,0 { LINT_REASONS_STABILIZATION }
1,82,0 { CONST_EXTERN_FN }
1,81,0 { LINT_REASONS_STABILIZATION }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

if anyone from clippy is following along, is there some equivalent of CURRENT_RUSTC_VERSION here? In any case given that we're close to a rust release this may or may not be accurate when merged

@folkertdev
Copy link
Contributor Author

@traviscross allright I copied and slightly updated some text from the tracking issue. Let me know if there's something else that should be included.

@traviscross
Copy link
Contributor

traviscross commented Aug 30, 2024

Why hadn't we stabilized this any sooner? I.e., are there any tricky questions here, open questions that have recently been answered, or recent implementation work done to make this ready?

(Or has this been in good shape for a long time and was just waiting on a stabilization PR?)

@RalfJung
Copy link
Member

I have no idea why #95346 only stabilized "Rust" and "C". Maybe @Aaron1011 remembers?

@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. and removed 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. labels Sep 4, 2024
@traviscross traviscross removed the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Sep 4, 2024
@traviscross
Copy link
Contributor

@rfcbot fcp merge

We talked about this in triage, and this sounded good to us all.

@rfcbot
Copy link

rfcbot commented Sep 4, 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. labels Sep 4, 2024
@rust-lang rust-lang deleted a comment from rfcbot Sep 4, 2024
@rust-lang rust-lang deleted a comment from rfcbot Sep 4, 2024
@nikomatsakis
Copy link
Contributor

@rfcbot reviewed

@rfcbot rfcbot added 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 Sep 4, 2024
@rfcbot
Copy link

rfcbot commented Sep 4, 2024

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

@bors
Copy link
Contributor

bors commented Sep 13, 2024

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

@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 Sep 14, 2024
@rfcbot
Copy link

rfcbot commented Sep 14, 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.

@folkertdev
Copy link
Contributor Author

cool, just fixed a merge conflict and squashed all commits into one

@RalfJung
Copy link
Member

r=me for the rustc side. The clippy side seems reasonably simple but I think the test can be merged with another test file now.

@RalfJung
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Sep 14, 2024

📌 Commit a528f4e has been approved by RalfJung

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 Sep 14, 2024
@bors
Copy link
Contributor

bors commented Sep 14, 2024

⌛ Testing commit a528f4e with merge 4f1be92...

@bors
Copy link
Contributor

bors commented Sep 15, 2024

☀️ Test successful - checks-actions
Approved by: RalfJung
Pushing 4f1be92 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 15, 2024
@bors bors merged commit 4f1be92 into rust-lang:master Sep 15, 2024
7 checks passed
@rustbot rustbot added this to the 1.83.0 milestone Sep 15, 2024
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (4f1be92): comparison URL.

Overall result: ❌ regressions - no action needed

@rustbot label: -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.4% [2.4%, 2.4%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary 2.4%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
2.4% [1.8%, 3.0%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.4% [1.8%, 3.0%] 2

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 758.697s -> 760.09s (0.18%)
Artifact size: 340.54 MiB -> 340.51 MiB (-0.01%)

@apiraino apiraino removed the to-announce Announce this issue on triage meeting label Sep 26, 2024
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-nominated Nominated for discussion during a lang team meeting. merged-by-bors This PR was explicitly merged by bors. 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tracking issue for const extern fn and const unsafe extern fn
10 participants