-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Tracking issue for const extern fn and const unsafe extern fn #64926
Copy link
Copy link
Closed
Labels
A-FFIArea: Foreign function interface (FFI)Area: Foreign function interface (FFI)A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)B-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCF-const_extern_fn`#![feature(const_extern_fn)]``#![feature(const_extern_fn)]`S-tracking-ready-to-stabilizeStatus: This is ready to stabilize; it may need a stabilization report and a PRStatus: This is ready to stabilize; it may need a stabilization report and a PRT-langRelevant to the language teamRelevant to the language team
Metadata
Metadata
Assignees
Labels
A-FFIArea: Foreign function interface (FFI)Area: Foreign function interface (FFI)A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)B-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCF-const_extern_fn`#![feature(const_extern_fn)]``#![feature(const_extern_fn)]`S-tracking-ready-to-stabilizeStatus: This is ready to stabilize; it may need a stabilization report and a PRStatus: This is ready to stabilize; it may need a stabilization report and a PRT-langRelevant to the language teamRelevant to the language team
Type
Fields
Give feedbackNo fields configured for issues without a type.
This is a tracking issue for implementing and stabilizing defining a
const extern fnandconst unsafe extern fnconst unsafe? extern fn#64906 (comment) (added in Ensure that we error when calling "const extern fn" with wrong convention #68370)Stabilizaton Report
Summary
This allows writing
const unsafe extern "calling-convention" fnandconst extern "calling-convention" fn:Today Rust and C calling conventions are stable (as of 1.62, see #95346). All other calling conventions are still unstable.
This can be used to const-ify an
extern fn(or equivalently, to make aconst fncallable from external code).Test cases
constcontext) leads to an error: https://github.com/rust-lang/rust/blob/master/src/test/ui/consts/miri_unleashed/abi-mismatch.rs