structpacked_wo_copy{shortf1;charf2[0]; } __attribute__((packed)); This is exactly copied from#2200. That's not exactly the case that triggered errors for me, but that one involved nested types with attribute aligned and whatsonot -- effect should be the same. Bindgen Invocation Diverg...
Also, even a "standard" Rust struct allocated at an unaligned address would result in unaligned references. But 7 is an aligned address for Outer, that's the problem. The documentation only mentions that it modifies the padding of the structure, and not the address alignment: https://doc.r...
In Rust speak, aresourceis astructandattributesare fields in thatstruct. Many fields areOption<T>because they are optional and not always defined. Serialization Format¶ High-Level Overview¶ The serialization format consists of: Aglobal headercontaining identifying magic and describing the overall...
In Rust speak, a resource is a struct and attributes are fields in that struct. Many fields are Option<T> because they are optional and not always defined.Serialization Format High-Level Overview The serialization format consists of: A global header containing identifying magic and describing the...
The default ABI for a struct, even one that is #[repr(packed)], is #[repr(Rust)], which is unstable and allows the compiler to do a lot of things, including e.g. reordering fields. This can even change between different compilations with the same compiler version (though in my experi...
and a packed type in Rust, then they should be ABI-compatible. But currently they are not. If you take the typePfrom my example, declare an equivalent type in C, have a C function that takes astruct Pas argument, and call it from Rust, then things will explode in the most amazing ...
I was under the impression that the Rust team wants to disallow references to packed struct fields simply because it is considered "wrong", not because of soundness. I now understand that this is not actually the case and there is still room for discussion on this topic, which I will try...
Consider (https://godbolt.org/z/x39GzMKz4): #[repr(packed)] #[derive(PartialEq)] pub struct Packed(i32); enum Y { Foo { id: Packed, }, Bar(i32) } fn pred(_: &i32) -> bool { return true; } fn f(x: Y) { match &x { Y::Foo { id: Packed(4), ...
Rust Library for serialization of javascript objects from and to c like packed structs as an Uint8Array. typescripttypesafestructuint8arraypacked UpdatedJun 6, 2024 TypeScript Tool for me, that built packed Resource File(s) delphitoolsresourceprogramming-toolspackedembeeded ...
While here, tighten up access to the struct's member fields. Why It's unsafe to access, via reference, members of a packed struct due to alignment. What's curious is that only@rebasedmingsaw rustc give compilation errors about this. ...