Commit 3bd84f1
authored
Rollup merge of rust-lang#126700 - compiler-errors:fragment, r=fmease
Make edition dependent `:expr` macro fragment act like the edition-dependent `:pat` fragment does
Parse the `:expr` fragment as `:expr_2021` in editions <=2021, and as `:expr` in edition 2024. This is similar to how we parse `:pat` as `:pat_param` in edition <=2018 and `:pat_with_or` in >=2021, and means we can get rid of a span dependency from `nonterminal_may_begin_with`.
Specifically, this fixes a theoretical regression since the `expr_2021` macro fragment previously would allow `const {}` if the *caller* is edition 2024. This is inconsistent with the way that the `pat` macro fragment was upgraded, and also leads to surprising behavior when a macro *caller* crate upgrades to edtion 2024, since they may have parsing changes that they never asked for (with no way of opting out of it).
This PR also allows using `expr_2021` in all editions. Why was this was disallowed in the first place? It's purely additive, and also it's still feature gated?
r? ```@fmease``` ```@eholk``` cc ```@vincenzopalazzo```
cc rust-lang#123865
Tracking:
- rust-lang#123742File tree
8 files changed
+42
-49
lines changed- compiler
- rustc_ast/src
- rustc_expand/src/mbe
- rustc_parse/src/parser
- tests/ui/macros
- auxiliary
8 files changed
+42
-49
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
900 | 900 | | |
901 | 901 | | |
902 | 902 | | |
903 | | - | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
904 | 908 | | |
905 | 909 | | |
906 | 910 | | |
| |||
929 | 933 | | |
930 | 934 | | |
931 | 935 | | |
932 | | - | |
933 | | - | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
934 | 943 | | |
935 | 944 | | |
936 | 945 | | |
| |||
949 | 958 | | |
950 | 959 | | |
951 | 960 | | |
952 | | - | |
953 | | - | |
| 961 | + | |
| 962 | + | |
954 | 963 | | |
955 | 964 | | |
956 | 965 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1292 | 1292 | | |
1293 | 1293 | | |
1294 | 1294 | | |
1295 | | - | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
1296 | 1298 | | |
1297 | 1299 | | |
1298 | 1300 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
| 116 | + | |
| 117 | + | |
117 | 118 | | |
118 | 119 | | |
119 | 120 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
51 | 50 | | |
52 | 51 | | |
53 | 52 | | |
| |||
149 | 148 | | |
150 | 149 | | |
151 | 150 | | |
152 | | - | |
| 151 | + | |
153 | 152 | | |
154 | 153 | | |
155 | 154 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
This file was deleted.
This file was deleted.
0 commit comments