Commit e9285f9
committed
Auto merge of #21374 - dgrunwald:range-notation-fixes, r=nikomatsakis
This PR is intended as alternative to #20958. It fixes the same grammar inconsistencies, but does not increase the operator precedence of `..`, leaving it at the same level as the assignment operator.
For previous discussion, see #20811 and #20958.
Grammar changes:
* allow `for _ in 1..i {}` (fixes #20241)
* allow `for _ in 1.. {}` as infinite loop
* prevent use of range notation in contexts where only operators of high precedence are expected (fixes #20811)
Parser code cleanup:
* remove `RESTRICTION_NO_DOTS`
* make `AS_PREC` const and follow naming convention
* make `min_prec` inclusive
r? nikomatsakisFile tree
6 files changed
+80
-23
lines changed- src
- doc
- libsyntax
- parse
- test
- compile-fail
- run-pass
6 files changed
+80
-23
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3147 | 3147 | | |
3148 | 3148 | | |
3149 | 3149 | | |
3150 | | - | |
3151 | 3150 | | |
| 3151 | + | |
3152 | 3152 | | |
3153 | 3153 | | |
3154 | 3154 | | |
3155 | 3155 | | |
3156 | 3156 | | |
3157 | | - | |
3158 | | - | |
| 3157 | + | |
3159 | 3158 | | |
3160 | 3159 | | |
3161 | | - | |
| 3160 | + | |
3162 | 3161 | | |
3163 | 3162 | | |
3164 | 3163 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
336 | 336 | | |
337 | 337 | | |
338 | 338 | | |
339 | | - | |
340 | | - | |
| 339 | + | |
341 | 340 | | |
342 | 341 | | |
343 | 342 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
| 65 | + | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
97 | 96 | | |
98 | 97 | | |
99 | 98 | | |
| |||
2775 | 2774 | | |
2776 | 2775 | | |
2777 | 2776 | | |
2778 | | - | |
2779 | | - | |
2780 | | - | |
2781 | | - | |
2782 | | - | |
2783 | | - | |
2784 | | - | |
2785 | 2777 | | |
2786 | 2778 | | |
2787 | 2779 | | |
| |||
2855 | 2847 | | |
2856 | 2848 | | |
2857 | 2849 | | |
2858 | | - | |
| 2850 | + | |
2859 | 2851 | | |
2860 | 2852 | | |
2861 | | - | |
| 2853 | + | |
2862 | 2854 | | |
2863 | 2855 | | |
2864 | 2856 | | |
| |||
2869 | 2861 | | |
2870 | 2862 | | |
2871 | 2863 | | |
2872 | | - | |
| 2864 | + | |
2873 | 2865 | | |
2874 | 2866 | | |
2875 | 2867 | | |
| |||
2905 | 2897 | | |
2906 | 2898 | | |
2907 | 2899 | | |
2908 | | - | |
2909 | | - | |
| 2900 | + | |
| 2901 | + | |
| 2902 | + | |
| 2903 | + | |
| 2904 | + | |
| 2905 | + | |
| 2906 | + | |
| 2907 | + | |
| 2908 | + | |
| 2909 | + | |
| 2910 | + | |
| 2911 | + | |
| 2912 | + | |
| 2913 | + | |
| 2914 | + | |
| 2915 | + | |
| 2916 | + | |
| 2917 | + | |
2910 | 2918 | | |
2911 | 2919 | | |
2912 | 2920 | | |
| |||
2938 | 2946 | | |
2939 | 2947 | | |
2940 | 2948 | | |
2941 | | - | |
| 2949 | + | |
2942 | 2950 | | |
2943 | 2951 | | |
2944 | | - | |
2945 | | - | |
| 2952 | + | |
| 2953 | + | |
2946 | 2954 | | |
2947 | 2955 | | |
2948 | 2956 | | |
| |||
2960 | 2968 | | |
2961 | 2969 | | |
2962 | 2970 | | |
| 2971 | + | |
| 2972 | + | |
| 2973 | + | |
| 2974 | + | |
| 2975 | + | |
| 2976 | + | |
| 2977 | + | |
| 2978 | + | |
| 2979 | + | |
| 2980 | + | |
| 2981 | + | |
| 2982 | + | |
2963 | 2983 | | |
2964 | 2984 | | |
2965 | 2985 | | |
| |||
| 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 | + | |
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
51 | 58 | | |
52 | 59 | | |
0 commit comments