From 072fd4f0a37a717548ae5dd13ed4819e61fc1edb Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Mon, 19 Sep 2022 10:24:59 -0700 Subject: [PATCH] Allow Rust vector of array of trivially relocatable type --- gen/src/write.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gen/src/write.rs b/gen/src/write.rs index 982fb3caf..dddec7a55 100644 --- a/gen/src/write.rs +++ b/gen/src/write.rs @@ -472,10 +472,10 @@ fn check_trivial_extern_type(out: &mut OutFile, alias: &TypeAlias, reasons: &[Tr writeln!(out, "static_assert("); if reasons .iter() - .all(|r| matches!(r, TrivialReason::StructField(_))) + .all(|r| matches!(r, TrivialReason::StructField(_) | TrivialReason::VecElement)) { - // If the type is only used as a struct field and not as by-value - // function argument or any other use, then C array of trivially + // If the type is only used as a struct field or Vec element, not as + // by-value function argument or return value, then C array of trivially // relocatable type is also permissible. // // --- means something sane: