Commit 5bd1ec3
committed
Auto merge of rust-lang#83706 - a1phyr:fix_vec_layout_calculation, r=JohnTitor
Fix a layout possible miscalculation in `alloc::RawVec`
A layout miscalculation could happen in `RawVec` when used with a type whose size isn't a multiple of its alignment. I don't know if such type can exist in Rust, but the Layout API provides ways to manipulate such types. Anyway, it is better to calculate memory size in a consistent way.File tree
2 files changed
+7
-5
lines changed- library/alloc/src
- src/test/ui/sanitize
2 files changed
+7
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
247 | | - | |
248 | | - | |
249 | | - | |
| 247 | + | |
250 | 248 | | |
251 | 249 | | |
252 | 250 | | |
| |||
427 | 425 | | |
428 | 426 | | |
429 | 427 | | |
430 | | - | |
431 | 428 | | |
432 | 429 | | |
433 | | - | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
434 | 433 | | |
435 | 434 | | |
436 | 435 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
4 | 7 | | |
5 | 8 | | |
6 | 9 | | |
| |||
0 commit comments