Skip to content

Add dedicated error message referring to cxx::ExternType when opaque type is used by value #335

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

Merged
merged 3 commits into from
Oct 4, 2020

Conversation

dtolnay
Copy link
Owner

@dtolnay dtolnay commented Oct 4, 2020

The previous error of "error: passing non-trivial C++ type by value is not supported" was not sufficient to put someone on the right track of how to make their C++ type "trivial". The new error points to your type and very briefly explains what is needed and why, referring to cxx::ExternType where the documentation covers this use case in detail.

error: using opaque C++ type by value is not supported
 --> $DIR/by_value_not_supported.rs:3:16
  |
3 |     struct S { c: C }
  |                ^^^^

error: needs a cxx::ExternType impl in order to be used as a field of `S`
  --> $DIR/by_value_not_supported.rs:10:9
   |
10 |         type C;
   |         ^^^^^^

Follow-up to #325.

@dtolnay dtolnay merged commit 44198dd into master Oct 4, 2020
@dtolnay dtolnay deleted the kind branch October 4, 2020 04:19
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