Skip to content

Clarify story on native functions #1281

Closed
@nikomatsakis

Description

@nikomatsakis

Right now, native functions have a distinct type from normal functions but there is no way to write it! The reason that the type is distinct used to be because the ABI for native functions was different. This caused a lot of bugs (#1059, #1058, #1174, #1179) so I implemented wrappers. I like the wrappers, it makes for very clean trans code. However, I also think it would be great to be able to pass around native C function pointers.

Basically I think we ought to decide between one of two options:

  • keep the wrappers, merge native function types with normal functions
  • ditch the wrappers, make it so that native functions are limited, and create a syntax for native fn types

If we do the latter, we'd have to fix the problems listed in the prior bugs. In some cases, like bind, we can just make it illegal. Cross-crate calls though probably ought to work (or maybe not?).

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions