Commit 94bf32e
authored
Rollup merge of rust-lang#136835 - compiler-errors:contracts-span-hack, r=celinval
Stop using span hack for contracts feature gating
The contracts machinery is a pretty straightforward case of an *external* feature using a (perma-unstable) *internal* feature within its implementation. There's no reason why it needs to be implemented any differently than other features by using global span tracking hacks to change whether the internals are gated behind the `contracts` or `contracts_internals` feature gate -- for the case of macro expansions we already have `allow_internal_unstable` for exactly this situation.
This PR changes the internal, perma-unstable AST syntax to use the `contracts_internals` gate always, and adjusts the macro expansion to use the right spans so that `allow_internal_unstable` works correctly.
As a follow-up, there's really no reason to have `contracts` be a *compiler feature* since it's at this point fully a *library feature*; the only reason it's a compiler feature today is so we can mark it as incomplete, but that seems like a weak reason. I didn't do anything in this PR for this.
r? ``@celinval``File tree
6 files changed
+17
-59
lines changed- compiler
- rustc_builtin_macros/src
- rustc_parse/src/parser
- rustc_session/src
- tests/ui
- contracts/internal_machinery
- feature-gates
6 files changed
+17
-59
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | 1 | | |
4 | 2 | | |
5 | 3 | | |
6 | 4 | | |
7 | 5 | | |
8 | | - | |
| 6 | + | |
9 | 7 | | |
10 | 8 | | |
11 | 9 | | |
| |||
121 | 119 | | |
122 | 120 | | |
123 | 121 | | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | 122 | | |
130 | 123 | | |
131 | 124 | | |
132 | 125 | | |
133 | | - | |
| 126 | + | |
134 | 127 | | |
135 | 128 | | |
136 | 129 | | |
137 | 130 | | |
138 | | - | |
| 131 | + | |
| 132 | + | |
139 | 133 | | |
140 | | - | |
| 134 | + | |
141 | 135 | | |
142 | 136 | | |
143 | 137 | | |
| |||
155 | 149 | | |
156 | 150 | | |
157 | 151 | | |
158 | | - | |
| 152 | + | |
159 | 153 | | |
160 | 154 | | |
161 | 155 | | |
162 | 156 | | |
163 | | - | |
| 157 | + | |
| 158 | + | |
164 | 159 | | |
165 | | - | |
| 160 | + | |
166 | 161 | | |
167 | 162 | | |
168 | 163 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
302 | 302 | | |
303 | 303 | | |
304 | 304 | | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | 305 | | |
| 306 | + | |
316 | 307 | | |
317 | | - | |
318 | 308 | | |
319 | 309 | | |
320 | 310 | | |
321 | 311 | | |
322 | 312 | | |
| 313 | + | |
323 | 314 | | |
324 | | - | |
325 | 315 | | |
326 | 316 | | |
327 | 317 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | 211 | | |
216 | 212 | | |
217 | 213 | | |
| |||
260 | 256 | | |
261 | 257 | | |
262 | 258 | | |
263 | | - | |
264 | 259 | | |
265 | 260 | | |
266 | 261 | | |
| |||
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
10 | 9 | | |
11 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
| 21 | + | |
42 | 22 | | |
43 | 23 | | |
0 commit comments