Add reasons for Trivial requirements in C++ errors
diff --git a/gen/src/write.rs b/gen/src/write.rs
index 2770a05..de992db 100644
--- a/gen/src/write.rs
+++ b/gen/src/write.rs
@@ -1,4 +1,3 @@
-use crate::gen::block::Block;
 use crate::gen::nested::NamespaceEntries;
 use crate::gen::out::OutFile;
 use crate::gen::{builtin, include, Opt};
@@ -8,6 +7,7 @@
     derive, mangle, Api, Enum, ExternFn, ExternType, Pair, RustName, Signature, Struct, Trait,
     Type, Types, Var,
 };
+use crate::{gen::block::Block, syntax::types::TrivialReason};
 use proc_macro2::Ident;
 use std::collections::{HashMap, HashSet};
 
@@ -117,8 +117,8 @@
     out.next_section();
     for api in apis {
         if let Api::TypeAlias(ety) = api {
-            if out.types.required_trivial.contains_key(&ety.name.rust) {
-                check_trivial_extern_type(out, &ety.name)
+            if let Some(reason) = out.types.required_trivial.get(&ety.name.rust) {
+                check_trivial_extern_type(out, &ety.name, reason)
             }
         }
     }
@@ -366,7 +366,7 @@
     }
 }
 
-fn check_trivial_extern_type(out: &mut OutFile, id: &Pair) {
+fn check_trivial_extern_type(out: &mut OutFile, id: &Pair, reason: &TrivialReason) {
     // NOTE: The following static assertion is just nice-to-have and not
     // necessary for soundness. That's because triviality is always declared by
     // the user in the form of an unsafe impl of cxx::ExternType:
@@ -406,8 +406,9 @@
     writeln!(out, "    ::rust::IsRelocatable<{}>::value,", id);
     writeln!(
         out,
-        "    \"type {} marked as Trivial in Rust is not trivially move constructible and trivially destructible in C++\");",
+        "    \"type {} is not move constructible and trivially destructible in C++ yet is used as a trivial type in Rust ({})\");",
         id,
+        reason
     );
 }