-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Commit d3a3939
Auto merge of #128465 - GrigorenkoPV:128200, r=estebank
Some `const { }` asserts for #128200
The correctness of code in #128200 relies on an array being sorted (so that it can be used in binary search later), which is currently enforced with `// tidy-alphabetical` (and characters being written in `\u{XXXX}` form), as well as lack of duplicate entries with conflicting keys, which is not currently enforced.
This PR changes it to using a `const{ }` assertion (and also checks for duplicate entries). Sadly, we cannot use the recently-stabilized `is_sorted_by_key` here, because it is not const (but it would not allow us to check for uniqueness anyways). Instead, let's write a manual loop.
Alternative approach (perfect hash function): #128463
r? `@ghost`1 file changed
+15
-7
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2595 | 2595 |
| |
2596 | 2596 |
| |
2597 | 2597 |
| |
2598 | - | ||
2599 | 2598 |
| |
2600 | - | ||
2601 | 2599 |
| |
2602 | 2600 |
| |
2603 | 2601 |
| |
| |||
2610 | 2608 |
| |
2611 | 2609 |
| |
2612 | 2610 |
| |
2613 | - | ||
2611 | + | ||
2614 | 2612 |
| |
2615 | 2613 |
| |
2616 | 2614 |
| |
| |||
2643 | 2641 |
| |
2644 | 2642 |
| |
2645 | 2643 |
| |
2646 | - | ||
2647 | 2644 |
| |
2648 | 2645 |
| |
2649 | 2646 |
| |
2650 | - | ||
2651 | - | ||
2652 | - | ||
2647 | + | ||
2648 | + | ||
2649 | + | ||
2650 | + | ||
2651 | + | ||
2652 | + | ||
2653 | + | ||
2654 | + | ||
2655 | + | ||
2656 | + | ||
2657 | + | ||
2658 | + | ||
2659 | + | ||
2660 | + | ||
2653 | 2661 |
| |
2654 | 2662 |
| |
2655 | 2663 |
| |
|
0 commit comments