stabilize const_extern_fn by folkertdev · Pull Request #129753 · rust-lang/rust (original) (raw)

Conversation

This file contains hidden or 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

[ Show hidden characters]({{ revealButtonHref }})

folkertdev

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

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

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.

RalfJung

@rust-log-analyzer

This comment has been minimized.

@traviscross

@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

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

folkertdev

Comment on lines 20 to 22

1,81,0 { LINT_REASONS_STABILIZATION }
1,82,0 { CONST_EXTERN_FN }
1,81,0 { LINT_REASONS_STABILIZATION }

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

@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

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

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

@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

@rfcbot fcp merge

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

@rfcbot

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.

@nikomatsakis

@rfcbot

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

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

RalfJung

@RalfJung

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.

@folkertdev

@RalfJung

@bors

📌 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

@bors

@rust-timer

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%)

wip-sync pushed a commit to NetBSD/pkgsrc-wip that referenced this pull request

Nov 30, 2024

@he32

Pkgsrc changes compared to rust182:

TODO:

Upstream changes:

Version 1.83.0 (2024-11-28)

Language

Compiler

Refer to Rust's [platform support page][platform-support-doc] for more information on Rust's tiered platform support.

Libraries

Stabilized APIs

These APIs are now stable in const contexts:

Cargo

Rustdoc

Compatibility Notes

tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request

Dec 5, 2024

@tmeijn

This MR contains the following updates:

Package Update Change
rust minor 1.82.0 -> 1.83.0

MR created with the help of el-capitano/tools/renovate-bot.

Proposed changes to behavior should be submitted there as MRs.


Release Notes

rust-lang/rust (rust)

v1.83.0

Compare Source

==========================

Language

Compiler

Refer to Rust's [platform support page][platform-support-doc] for more information on Rust's tiered platform support.

Libraries

Stabilized APIs

These APIs are now stable in const contexts:

Cargo

Rustdoc

Compatibility Notes


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this MR and you won't be reminded about this update again.



This MR has been generated by Renovate Bot.

Veykril added a commit to rust-lang/fls that referenced this pull request

Dec 9, 2024

@Veykril

Veykril added a commit to rust-lang/fls that referenced this pull request

Dec 9, 2024

@Veykril

Veykril added a commit to rust-lang/fls that referenced this pull request

Dec 10, 2024

@Veykril

tshepang pushed a commit to ferrocene/ferrocene that referenced this pull request

Dec 18, 2024

@Veykril @tshepang

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request

Feb 24, 2025

@he32

Pkgsrc changes:

Upstream changes:

Version 1.83.0 (2024-11-28)

Language

Compiler

Refer to Rust's [platform support page][platform-support-doc] for more information on Rust's tiered platform support.

Libraries

Stabilized APIs

These APIs are now stable in const contexts:

Cargo

Rustdoc

Compatibility Notes

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.

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.