Add support for renamed type aliases #1203
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A single Rust type may map to multiple C++ types - an example of this is the various Win32 type aliases that exist for primitive types (e.g.,
DWORD,LONG).Currently the cxx crate can't handle this (#254) as the
verify_extern_typecheck ensures that the name of the type used in anextern "C++"block matches theIdof theExternTypeimplementation.This change adds a new
#[renamed]attribute which can be used to mark a type alias in anextern "C++"block as renaming the type, thus bypassing theIdcheck inverify_extern_type(a newverify_extern_type_renamedcheck is emitted instead).NOTE: #529 is an alternative to this PR, but it not usable for the Win32 type aliases case as the orphan rule would prevent a dependent crate from implementing
ExternTypeAliasfor the primitive types.