Commit 39a0bd5
committed
Generalize the wide-pointer total-size bound
We document that, for references and `Box<T>`, pointed-to values
with slice or `str` metadata must be no larger than `isize::MAX`. We
hadn't required this for pointed-to values with `dyn` metadata. It's
tempting to think this isn't necessary since we separately require
that the metadata point to a vtable generated by the compiler, which
ensures the encoded size of the erased type is OK.
But the bound is on the total size of the pointed-to value, including
any sized prefix of a type with an unsized tail. Since the prefix
combined with the size in the vtable can push us past the limit, we
need the separate restriction.
Let's apply the rule to both cases and add an admonition to remind
ourselves of why this is needed.1 parent 4699c2b commit 39a0bd5
1 file changed
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
150 | | - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
151 | 156 | | |
152 | 157 | | |
153 | 158 | | |
| |||
0 commit comments