Commit f396387
authored
Rollup merge of rust-lang#67820 - ecstatic-morse:const-trait, r=oli-obk
Parse the syntax described in RFC 2632
This adds support for both `impl const Trait for Ty` and `?const Trait` bound syntax from rust-lang/rfcs#2632 to the parser. For now, both modifiers end up in a newly-added `constness` field on `ast::TraitRef`, although this may change once the implementation is fleshed out.
I was planning on using `delay_span_bug` when this syntax is encountered during lowering, but I can't write `should-ice` UI tests. I emit a normal error instead, which causes duplicates when the feature gate is not enabled (see the `.stderr` files for the feature gate tests). Not sure what the desired approach is; Maybe just do nothing when the syntax is encountered with the feature gate is enabled?
@oli-obk I went with `const_trait_impl` and `const_trait_bound_opt_out` for the names of these features. Are these to your liking?
cc rust-lang#67792 rust-lang#67794
r? @CentrilFile tree
37 files changed
+586
-25
lines changed- src
- librustc_ast_lowering
- librustc_expand
- librustc_feature
- librustc_parse/parser
- librustc_passes
- librustc_span
- libsyntax
- feature_gate
- test/ui
- parser
- rfc-2632-const-trait-impl
- const-trait-bound-opt-out
37 files changed
+586
-25
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
74 | 80 | | |
75 | 81 | | |
76 | 82 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2579 | 2579 | | |
2580 | 2580 | | |
2581 | 2581 | | |
| 2582 | + | |
| 2583 | + | |
| 2584 | + | |
| 2585 | + | |
2582 | 2586 | | |
2583 | 2587 | | |
2584 | 2588 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | | - | |
| 113 | + | |
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
544 | 544 | | |
545 | 545 | | |
546 | 546 | | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
547 | 553 | | |
548 | 554 | | |
549 | 555 | | |
| |||
559 | 565 | | |
560 | 566 | | |
561 | 567 | | |
| 568 | + | |
| 569 | + | |
562 | 570 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
542 | 542 | | |
543 | 543 | | |
544 | 544 | | |
| 545 | + | |
545 | 546 | | |
546 | 547 | | |
547 | | - | |
548 | | - | |
| 548 | + | |
| 549 | + | |
549 | 550 | | |
550 | 551 | | |
551 | 552 | | |
| |||
558 | 559 | | |
559 | 560 | | |
560 | 561 | | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
561 | 570 | | |
562 | 571 | | |
563 | 572 | | |
| |||
618 | 627 | | |
619 | 628 | | |
620 | 629 | | |
621 | | - | |
| 630 | + | |
| 631 | + | |
622 | 632 | | |
623 | 633 | | |
624 | 634 | | |
| |||
631 | 641 | | |
632 | 642 | | |
633 | 643 | | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
634 | 651 | | |
635 | 652 | | |
636 | 653 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
20 | 38 | | |
21 | 39 | | |
22 | 40 | | |
| |||
195 | 213 | | |
196 | 214 | | |
197 | 215 | | |
198 | | - | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
199 | 219 | | |
200 | 220 | | |
201 | 221 | | |
| |||
421 | 441 | | |
422 | 442 | | |
423 | 443 | | |
424 | | - | |
| 444 | + | |
| 445 | + | |
425 | 446 | | |
426 | | - | |
| 447 | + | |
| 448 | + | |
427 | 449 | | |
428 | | - | |
| 450 | + | |
429 | 451 | | |
| 452 | + | |
430 | 453 | | |
431 | 454 | | |
432 | 455 | | |
| |||
439 | 462 | | |
440 | 463 | | |
441 | 464 | | |
442 | | - | |
443 | 465 | | |
444 | | - | |
445 | 466 | | |
446 | 467 | | |
447 | 468 | | |
| |||
451 | 472 | | |
452 | 473 | | |
453 | 474 | | |
454 | | - | |
455 | | - | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
456 | 486 | | |
457 | 487 | | |
458 | 488 | | |
| |||
478 | 508 | | |
479 | 509 | | |
480 | 510 | | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
481 | 541 | | |
482 | 542 | | |
483 | 543 | | |
484 | | - | |
| 544 | + | |
485 | 545 | | |
| 546 | + | |
| 547 | + | |
486 | 548 | | |
487 | 549 | | |
488 | 550 | | |
489 | 551 | | |
490 | | - | |
| 552 | + | |
491 | 553 | | |
492 | 554 | | |
493 | 555 | | |
494 | 556 | | |
495 | 557 | | |
496 | 558 | | |
497 | | - | |
498 | | - | |
499 | | - | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
500 | 563 | | |
501 | 564 | | |
502 | 565 | | |
| |||
0 commit comments