Closed
Description
Per some meeting or other, we discussed a plan to reform how how C functions work. I have been laying some of the groundwork for this but I think there is no meta-bug discussing it and bringing together the various things that need to be done.
The plan is:
- Add a type
extern "abi" fn(S) -> T
whereabi
is one of the Rust-supported ABIs, and defaults toC
. (Addextern "abi" fn
type to represent C pointers #3321) - Remove the current
extern fn
type (Remove bare function types, replace with inference #3320) andextern fn
(crust fn) declarations- Allow bare fns to be inferred to
extern fn
type; in trans, we generate a wrapper at that time
- Allow bare fns to be inferred to
- Remove the wrappers in trans that we currently use to adapt C functions to Rust ABI
- When calling a function of
extern fn
type, we will generate inline the C-abi style invocation, perhaps generating wrappers
- When calling a function of