Fix nonsense Debug impl on non-char static arrays
This commit is contained in:
parent
c62172bdf8
commit
d4789768a6
3523
ash/src/vk.rs
3523
ash/src/vk.rs
File diff suppressed because it is too large
Load diff
|
@ -1248,7 +1248,7 @@ pub fn derive_debug(_struct: &vkxml::Struct, union_types: &HashSet<&str>) -> Opt
|
||||||
.map(|n| n.contains("pfn"))
|
.map(|n| n.contains("pfn"))
|
||||||
.unwrap_or(false)
|
.unwrap_or(false)
|
||||||
});
|
});
|
||||||
let contains_static_array = members.clone().any(is_static_array);
|
let contains_static_array = members.clone().any(|x| is_static_array(x) && x.basetype == "char");
|
||||||
let contains_union = members
|
let contains_union = members
|
||||||
.clone()
|
.clone()
|
||||||
.any(|field| union_types.contains(field.basetype.as_str()));
|
.any(|field| union_types.contains(field.basetype.as_str()));
|
||||||
|
@ -1258,7 +1258,7 @@ pub fn derive_debug(_struct: &vkxml::Struct, union_types: &HashSet<&str>) -> Opt
|
||||||
let debug_fields = members.clone().map(|field| {
|
let debug_fields = members.clone().map(|field| {
|
||||||
let param_ident = field.param_ident();
|
let param_ident = field.param_ident();
|
||||||
let param_str = param_ident.as_ref();
|
let param_str = param_ident.as_ref();
|
||||||
let debug_value = if is_static_array(field) {
|
let debug_value = if is_static_array(field) && field.basetype == "char" {
|
||||||
quote!{
|
quote!{
|
||||||
&unsafe {
|
&unsafe {
|
||||||
::std::ffi::CStr::from_ptr(self.#param_ident.as_ptr() as *const i8)
|
::std::ffi::CStr::from_ptr(self.#param_ident.as_ptr() as *const i8)
|
||||||
|
|
Loading…
Reference in a new issue