You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to previous information the first usize pointed by the trait object's metadata/vtable is the size of the struct. This is reiterated in the documentation of the https://doc.rust-lang.org/beta/std/ptr/struct.DynMetadata.html. Did the layout of trait object metadata change?
I expected to see this happen: see the struct's size as the first usize pointed by the trait object's metadata pointer.
Instead, this happened: junk value printed, the second usize appears to be the size of the struct and the third is the alignment.
Is this related to the deprecation of std::raw::TraitObject/#84207?
The text was updated successfully, but these errors were encountered:
No it did not change I remembered it wrong the first usize is drop implementation:
/// The common prefix of all vtables. It is followed by function pointers for trait methods.
///
/// Private implementation detail of `DynMetadata::size_of` etc.
#[repr(C)]
struct VTable {
drop_in_place: fn(*mut ()),
size_of: usize,
align_of: usize,
}
I tried this code: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=a122541641e9a77365b11b861971d578
According to previous information the first usize pointed by the trait object's metadata/vtable is the size of the struct. This is reiterated in the documentation of the https://doc.rust-lang.org/beta/std/ptr/struct.DynMetadata.html. Did the layout of trait object metadata change?
I expected to see this happen: see the struct's size as the first usize pointed by the trait object's metadata pointer.
Instead, this happened: junk value printed, the second usize appears to be the size of the struct and the third is the alignment.
Is this related to the deprecation of std::raw::TraitObject/#84207?
The text was updated successfully, but these errors were encountered: