It's tricky to get the FFI function signatures correct for external types since we don't know the concrete actual type. Here's where we determine the FFI type to use. I can think of at least 2 cases where this will fail:
A external custom type that wraps a primitive type. There's no way to represent that with ExternalKind
A "doubly external" type: crate1 defines a type, crate2 uses it as an external type, crate3 uses that type from crate2 as it's external type. In this case, the RustBuffer crate name will be wrong. This is a pretty weird case, but if we could support it it would be nice.
Now that the proc-macro metadata code has matured, I think we can fix both of these issues by:
Replacing ExternalKind with the actual type definition.
Making name refer to the crate that the type was originally defined in.
It's tricky to get the FFI function signatures correct for external types since we don't know the concrete actual type. Here's where we determine the FFI type to use. I can think of at least 2 cases where this will fail:
ExternalKind
crate1
defines a type,crate2
uses it as an external type,crate3
uses that type fromcrate2
as it's external type. In this case, theRustBuffer
crate name will be wrong. This is a pretty weird case, but if we could support it it would be nice.Now that the proc-macro metadata code has matured, I think we can fix both of these issues by:
ExternalKind
with the actual type definition.name
refer to the crate that the type was originally defined in.