-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Commit 4e431fa
Auto merge of #123561 - saethlin:str-unchecked-sub-index, r=scottmcm
Use unchecked_sub in str indexing
#108763 applied this logic to indexing for slices, but of course `str` has its own separate impl.
Found this by skimming over the codegen for https://github.com/oxidecomputer/hubris/; their dist builds enable overflow checks so the lack of `unchecked_sub` was producing an impossible-to-hit overflow check and also inhibiting some inlining.
r? scottmcmFile tree
2 files changed
+37
-6
lines changed- library/core/src/str
- tests/codegen
2 files changed
+37
-6
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | 1 |
| |
2 | 2 |
| |
3 | 3 |
| |
4 | + | ||
4 | 5 |
| |
5 | 6 |
| |
6 | 7 |
| |
| |||
210 | 211 |
| |
211 | 212 |
| |
212 | 213 |
| |
213 | - | ||
214 | - | ||
215 | - | ||
214 | + | ||
215 | + | ||
216 | + | ||
217 | + | ||
216 | 218 |
| |
217 | 219 |
| |
218 | 220 |
| |
| |||
229 | 231 |
| |
230 | 232 |
| |
231 | 233 |
| |
232 | - | ||
233 | - | ||
234 | - | ||
234 | + | ||
235 | + | ||
236 | + | ||
237 | + | ||
235 | 238 |
| |
236 | 239 |
| |
237 | 240 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
32 | 32 |
| |
33 | 33 |
| |
34 | 34 |
| |
35 | + | ||
36 | + | ||
37 | + | ||
38 | + | ||
39 | + | ||
40 | + | ||
41 | + | ||
42 | + | ||
43 | + | ||
44 | + | ||
45 | + | ||
46 | + | ||
47 | + | ||
48 | + | ||
49 | + | ||
50 | + | ||
51 | + | ||
52 | + | ||
53 | + | ||
54 | + | ||
55 | + | ||
56 | + | ||
57 | + | ||
58 | + | ||
59 | + | ||
60 | + | ||
61 | + | ||
62 | + |
0 commit comments