book: size and align in trait object vtables are used#39191
book: size and align in trait object vtables are used#39191bors merged 2 commits intorust-lang:masterfrom
Conversation
The book currently claims that the `size` and `align` fields in the trait object vtable are not used, but this is false. These two fields are used by the stable `mem::size_of_val` and `mem::align_of_val` functions. See the `ty::TyDynamic` case of the `glue::size_and_align_of_dst` function in librustc_trans, which is used to implement both intrinsics in the unsized case.
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @steveklabnik (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
|
Personally, I think it would be better to just remove that bit, and end the sentence at alignment requirements. I'm not sure how useful it is for a reader to know that the |
|
@steveklabnik done. |
|
@bors: r+ rollup thank you! |
|
📌 Commit c7b092b has been approved by |
…ze-and-align, r=steveklabnik book: size and align in trait object vtables are used The book currently claims that the `size` and `align` fields in the trait object vtable are not used, but this is false. These two fields are used by the stable `mem::size_of_val` and `mem::align_of_val` functions. See the `ty::TyDynamic` case of the `glue::size_and_align_of_dst` function in librustc_trans, which is used to implement both intrinsics in the unsized case. r? @steveklabnik
The book currently claims that the
sizeandalignfields in thetrait object vtable are not used, but this is false. These two fields
are used by the stable
mem::size_of_valandmem::align_of_valfunctions.
See the
ty::TyDynamiccase of theglue::size_and_align_of_dstfunction in librustc_trans, which is used to implement both intrinsics
in the unsized case.
r? @steveklabnik