mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-25 00:04:15 +00:00
Disabled broken Clone impl for unsized buffers
This commit is contained in:
parent
dc27941fe4
commit
9cda522d13
@ -174,15 +174,20 @@ fn write_struct(doc: &parse::Spirv, struct_id: u32, members: &[u32]) -> String {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// We can only implement Clone if there's no unsized member in the struct.
|
||||
let impl_text = if current_rust_offset.is_some() {
|
||||
format!("\nimpl Clone for {name} {{\n fn clone(&self) -> Self {{\n \
|
||||
{name} {{\n{copies}\n }}\n }}\n}}\n", name = name,
|
||||
copies = rust_members.iter().map(Member::copy_text).collect::<Vec<_>>().join(",\n"))
|
||||
} else {
|
||||
"".to_owned()
|
||||
};
|
||||
|
||||
format!("#[repr(C)]\n\
|
||||
pub struct {name} {{\n{members}\n}} /* total_size: {t:?} */\n\n\
|
||||
impl Clone for {name} {{\n fn clone(&self) -> Self {{\n \
|
||||
{name} {{\n{copies}\n }}\n }}\n}}\n\n",
|
||||
format!("#[repr(C)]\npub struct {name} {{\n{members}\n}} /* total_size: {t:?} */\n{impl_text}",
|
||||
name = name,
|
||||
members = rust_members.iter().map(Member::declaration_text).collect::<Vec<_>>().join(",\n"),
|
||||
t = spirv_req_total_size,
|
||||
copies = rust_members.iter().map(Member::copy_text).collect::<Vec<_>>().join(",\n"))
|
||||
t = spirv_req_total_size, impl_text=impl_text)
|
||||
}
|
||||
|
||||
/// Returns true if a `BuiltIn` decorator is applied on a struct member.
|
||||
|
Loading…
Reference in New Issue
Block a user