Commit 3c7f2e1
authored
Rollup merge of rust-lang#106276 - Sp00ph:unify_slice_ranges, r=the8472
Fix `vec_deque::Drain` FIXME
In my original `VecDeque` rewrite, I didn't use `VecDeque::slice_ranges` in `Drain::as_slices`, even though that's basically the exact use case for `slice_ranges`. The reason for this was that a `VecDeque` wrapped in a `Drain` actually has its length set to `drain_start`, so that there's no potential use after free if you `mem::forget` the `Drain`. I modified `slice_ranges` to accept an explicit `len` parameter instead, which it now uses to bounds check the given range. This way, `Drain::as_slices` can use `slice_ranges` internally instead of having to basically just copy paste the `slice_ranges` code. Since `slice_ranges` is just an internal helper function, this shouldn't change the user facing behavior in any way.2 files changed
+31
-36
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
56 | | - | |
| 55 | + | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
85 | 71 | | |
86 | 72 | | |
87 | 73 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1156 | 1156 | | |
1157 | 1157 | | |
1158 | 1158 | | |
1159 | | - | |
| 1159 | + | |
1160 | 1160 | | |
1161 | 1161 | | |
1162 | 1162 | | |
| |||
1190 | 1190 | | |
1191 | 1191 | | |
1192 | 1192 | | |
1193 | | - | |
| 1193 | + | |
1194 | 1194 | | |
1195 | 1195 | | |
1196 | 1196 | | |
| |||
1232 | 1232 | | |
1233 | 1233 | | |
1234 | 1234 | | |
1235 | | - | |
1236 | | - | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
1237 | 1246 | | |
1238 | 1247 | | |
1239 | 1248 | | |
1240 | | - | |
| 1249 | + | |
1241 | 1250 | | |
1242 | 1251 | | |
1243 | 1252 | | |
1244 | 1253 | | |
1245 | 1254 | | |
1246 | | - | |
1247 | | - | |
| 1255 | + | |
| 1256 | + | |
1248 | 1257 | | |
1249 | 1258 | | |
1250 | 1259 | | |
| |||
1290 | 1299 | | |
1291 | 1300 | | |
1292 | 1301 | | |
1293 | | - | |
| 1302 | + | |
1294 | 1303 | | |
1295 | 1304 | | |
1296 | 1305 | | |
| |||
1330 | 1339 | | |
1331 | 1340 | | |
1332 | 1341 | | |
1333 | | - | |
| 1342 | + | |
1334 | 1343 | | |
1335 | 1344 | | |
1336 | 1345 | | |
| |||
0 commit comments