Commit 46abacf
committed
rustc: Require that vector indices are uints
This commit tightens up the restriction on types used to index slices to require
exactly `uint` indices. Previously any integral type was accepted, but this
leads to a few subtle problems:
* 64-bit indices don't make much sense on 32-bit systems
* Signed indices for slices used as negative indexing isn't implemented
This was discussed at the recent work week, and also has some discussion on
issue #10453.
Closes #104531 parent 3786b55 commit 46abacf
File tree
3 files changed
+47
-1
lines changed- src
- librustc/middle
- typeck/check
- test/compile-fail
3 files changed
+47
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2602 | 2602 | | |
2603 | 2603 | | |
2604 | 2604 | | |
| 2605 | + | |
| 2606 | + | |
| 2607 | + | |
| 2608 | + | |
| 2609 | + | |
| 2610 | + | |
| 2611 | + | |
2605 | 2612 | | |
2606 | 2613 | | |
2607 | 2614 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3151 | 3151 | | |
3152 | 3152 | | |
3153 | 3153 | | |
3154 | | - | |
| 3154 | + | |
3155 | 3155 | | |
3156 | 3156 | | |
3157 | 3157 | | |
| |||
3195 | 3195 | | |
3196 | 3196 | | |
3197 | 3197 | | |
| 3198 | + | |
| 3199 | + | |
| 3200 | + | |
| 3201 | + | |
| 3202 | + | |
| 3203 | + | |
| 3204 | + | |
| 3205 | + | |
| 3206 | + | |
3198 | 3207 | | |
3199 | 3208 | | |
3200 | 3209 | | |
| |||
3854 | 3863 | | |
3855 | 3864 | | |
3856 | 3865 | | |
| 3866 | + | |
| 3867 | + | |
| 3868 | + | |
| 3869 | + | |
| 3870 | + | |
3857 | 3871 | | |
3858 | 3872 | | |
3859 | 3873 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
0 commit comments