Allow Rust vector of array of trivially relocatable type

This commit is contained in:
David Tolnay 2022-09-19 10:24:59 -07:00
parent 83075824a4
commit 072fd4f0a3
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -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: