Commit a2eae7f
committed
Optimize
The check for `self.end() == usize::MAX` can be combined with the `self.end() +
1 > slice.len()` check into `self.en() >= slice.len()`, since `self.end() <
slice.len()` implies both `self.end() <= slice.len()` and `self.end() <
usize::MAX`.
The tradeoff is slightly worse error reporting: previously there would be a
special panic message in the `range.end() == usize::MAX` case.SliceIndex impl for RangeInclusive
1 parent ca77504 commit a2eae7f
File tree
3 files changed
+12
-11
lines changed- library
- coretests/tests
- core/src/slice
- src/tools/miri/tests/panic
3 files changed
+12
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
658 | 658 | | |
659 | 659 | | |
660 | 660 | | |
661 | | - | |
662 | 661 | | |
663 | 662 | | |
664 | 663 | | |
| |||
668 | 667 | | |
669 | 668 | | |
670 | 669 | | |
671 | | - | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
672 | 673 | | |
673 | 674 | | |
674 | 675 | | |
675 | 676 | | |
676 | | - | |
| 677 | + | |
677 | 678 | | |
678 | 679 | | |
679 | 680 | | |
| |||
690 | 691 | | |
691 | 692 | | |
692 | 693 | | |
693 | | - | |
694 | | - | |
| 694 | + | |
| 695 | + | |
695 | 696 | | |
696 | 697 | | |
697 | 698 | | |
698 | 699 | | |
699 | 700 | | |
700 | 701 | | |
701 | | - | |
702 | | - | |
| 702 | + | |
| 703 | + | |
703 | 704 | | |
704 | 705 | | |
705 | 706 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1492 | 1492 | | |
1493 | 1493 | | |
1494 | 1494 | | |
1495 | | - | |
| 1495 | + | |
1496 | 1496 | | |
1497 | 1497 | | |
1498 | 1498 | | |
1499 | 1499 | | |
1500 | 1500 | | |
1501 | 1501 | | |
1502 | | - | |
| 1502 | + | |
1503 | 1503 | | |
1504 | 1504 | | |
1505 | 1505 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
| 2 | + | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
0 commit comments