Skip to content

Commit

Permalink
Change comment to mention vtable
Browse files Browse the repository at this point in the history
  • Loading branch information
5225225 committed Aug 1, 2022
1 parent eb1b384 commit a6ab54b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions compiler/rustc_middle/src/ty/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3559,11 +3559,11 @@ where
// which acts much like a [u8].
//
// We *do* need to panic for &dyn Trait, even though the layout of dyn Trait is
// size 0 align 1, because &dyn Trait holds a reference to a non-zero sized type,
// which also must be aligned.
// size 0 align 1, because &dyn Trait holds a reference to the vtable, which
// must be aligned and dereferenceable.
//
// This even applies to *const dyn Trait, which holds a reference and therefore
// must be valid, so 1-initialization is not okay there.
// This even applies to *const dyn Trait, which holds a reference to the vtable
// and therefore must be valid, so 1-initialization is not okay there.
//
// If this bypass didn't exist, old versions of `hyper` with no semver compatible
// fix (0.11, 0.12, 0.13) would panic, as they make uninit &[u8] and &str.
Expand Down

0 comments on commit a6ab54b

Please sign in to comment.