Tweak wording of the triviality requirement

It isn't actually a requirement that the type have no destructor as
brought up by the previous paragraph. Rather, it just needs to be safe
for values of that type to be moved via Rust's memcpy-based move
semantics.

The distinction is relevant e.g. for `struct S { s: String }` which
would have a C++ destructor and nontrivial move constructor but still be
safely memcpy movable.
This commit is contained in:
David Tolnay 2020-10-05 13:21:57 -07:00
parent 2c4b35f486
commit b8543bd30c
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -123,7 +123,7 @@ pub unsafe trait ExternType {
/// [move constructor is trivial]: https://en.cppreference.com/w/cpp/types/is_move_constructible
///
/// If you believe your C++ type reflected by this ExternType impl is indeed
/// trivial, you can specify:
/// fine to hold by value and move in Rust, you can specify:
///
/// ```
/// # struct TypeName;