Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for renamed type aliases #1203

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dpaoliello
Copy link

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_type check ensures that the name of the type used in an extern "C++" block matches the Id of the ExternType implementation.

This change adds a new #[renamed] attribute which can be used to mark a type alias in an extern "C++" block as renaming the type, thus bypassing the Id check in verify_extern_type (a new verify_extern_type_renamed check 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 ExternTypeAlias for the primitive types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant