diff options
| author | Steve Klabnik <steve@steveklabnik.com> | 2017-01-23 16:40:49 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-01-23 16:40:49 -0500 |
| commit | e113038a3617722169d7f4a69cdc99989d9caf49 (patch) | |
| tree | 2b3424d86bfa604d41bd45b3ab07e0743eb8a0f6 | |
| parent | 9df2daf34c1624bbd09ab5243120f58e4c9c40c2 (diff) | |
| parent | c7b092b47d8e50b58c975040af0a84a544f7fa7a (diff) | |
| download | rust-e113038a3617722169d7f4a69cdc99989d9caf49.tar.gz rust-e113038a3617722169d7f4a69cdc99989d9caf49.zip | |
Rollup merge of #39191 - cesarb:book/trait-objects-vtable-size-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
| -rw-r--r-- | src/doc/book/trait-objects.md | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/doc/book/trait-objects.md b/src/doc/book/trait-objects.md index a0396a75fa2..00a841a75db 100644 --- a/src/doc/book/trait-objects.md +++ b/src/doc/book/trait-objects.md @@ -263,10 +263,7 @@ any resources of the vtable’s type: for `u8` it is trivial, but for `String` i will free the memory. This is necessary for owning trait objects like `Box<Foo>`, which need to clean-up both the `Box` allocation as well as the internal type when they go out of scope. The `size` and `align` fields store -the size of the erased type, and its alignment requirements; these are -essentially unused at the moment since the information is embedded in the -destructor, but will be used in the future, as trait objects are progressively -made more flexible. +the size of the erased type, and its alignment requirements. Suppose we’ve got some values that implement `Foo`. The explicit form of construction and use of `Foo` trait objects might look a bit like (ignoring the |
