Skip to content

Extern/native function reform #3678

Closed
Closed
@nikomatsakis

Description

@nikomatsakis

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 where abi is one of the Rust-supported ABIs, and defaults to C. (Add extern "abi" fn type to represent C pointers #3321)
  • Remove the current extern fn type (Remove bare function types, replace with inference #3320) and extern fn (crust fn) declarations
    • Allow bare fns to be inferred to extern fn type; in trans, we generate a wrapper at that time
  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-FFIArea: Foreign function interface (FFI)A-codegenArea: Code generationA-type-systemArea: Type systemC-cleanupCategory: PRs that clean code up or issues documenting cleanup.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions