From b8543bd30c4b3bb2e528643082f85a296ed85c08 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Mon, 5 Oct 2020 13:21:57 -0700 Subject: [PATCH] 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. --- src/extern_type.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/extern_type.rs b/src/extern_type.rs index 04320968..b9c53860 100644 --- a/src/extern_type.rs +++ b/src/extern_type.rs @@ -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;