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

Make cxx.h available to high level code generators. #364

Merged
merged 2 commits into from
Oct 16, 2020

Conversation

adetaylor
Copy link
Collaborator

At present, this file is available only from the git repository,
but higher level code generators may wish to ensure that they supply
a version of cxx.h corresponding precisely to the version of cxx
in use.

Specifically, such higher level code generators may wish to use
rust::Str and similar types in code which they autogenerate,
and thus need a way to include definitions of such types. As
this code is autogenerated, it can't reasonably rummage around
the cxx git repository to find the correct cxx.h header.

To be even more specific, higher level code generators may wish
to pass rust::Str and/or rust::String types into C++, in order
to create UniquePtr<CxxString>s from Rust strings during function
calls.

At present, this file is available only from the git repository,
but higher level code generators may wish to ensure that they supply
a version of cxx.h corresponding precisely to the version of cxx
in use.

Specifically, such higher level code generators may wish to use
rust::Str and similar types in code which _they_ autogenerate,
and thus need a way to include definitions of such types. As
this code is autogenerated, it can't reasonably rummage around
the cxx git repository to find the correct cxx.h header.

To be even more specific, higher level code generators may wish
to pass rust::Str and/or rust::String types into C++, in order
to create UniquePtr<CxxString>s from Rust strings during function
calls.
Copy link
Owner

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

I think we might as well expose this as a static rather than a method call. I don't have plans to move away from the include_str!-based implementation.

@dtolnay dtolnay merged commit 33b1ae9 into dtolnay:master Oct 16, 2020
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.

2 participants