Commit a7529f7
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 | |
|---|---|---|---|
| |||
2577 | 2577 | | |
2578 | 2578 | | |
2579 | 2579 | | |
| 2580 | + | |
| 2581 | + | |
| 2582 | + | |
| 2583 | + | |
2580 | 2584 | | |
2581 | 2585 | | |
2582 | 2586 | | |
| |||
| 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 | | |
| |||
543 | 543 | | |
544 | 544 | | |
545 | 545 | | |
| 546 | + | |
546 | 547 | | |
547 | 548 | | |
548 | | - | |
549 | | - | |
| 549 | + | |
| 550 | + | |
550 | 551 | | |
551 | 552 | | |
552 | 553 | | |
| |||
559 | 560 | | |
560 | 561 | | |
561 | 562 | | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
562 | 571 | | |
563 | 572 | | |
564 | 573 | | |
| |||
619 | 628 | | |
620 | 629 | | |
621 | 630 | | |
622 | | - | |
| 631 | + | |
| 632 | + | |
623 | 633 | | |
624 | 634 | | |
625 | 635 | | |
| |||
632 | 642 | | |
633 | 643 | | |
634 | 644 | | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
635 | 652 | | |
636 | 653 | | |
637 | 654 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
21 | 39 | | |
22 | 40 | | |
23 | 41 | | |
| |||
196 | 214 | | |
197 | 215 | | |
198 | 216 | | |
199 | | - | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
200 | 220 | | |
201 | 221 | | |
202 | 222 | | |
| |||
422 | 442 | | |
423 | 443 | | |
424 | 444 | | |
425 | | - | |
| 445 | + | |
| 446 | + | |
426 | 447 | | |
427 | | - | |
| 448 | + | |
| 449 | + | |
428 | 450 | | |
429 | | - | |
| 451 | + | |
430 | 452 | | |
| 453 | + | |
431 | 454 | | |
432 | 455 | | |
433 | 456 | | |
| |||
440 | 463 | | |
441 | 464 | | |
442 | 465 | | |
443 | | - | |
444 | 466 | | |
445 | | - | |
446 | 467 | | |
447 | 468 | | |
448 | 469 | | |
| |||
452 | 473 | | |
453 | 474 | | |
454 | 475 | | |
455 | | - | |
456 | | - | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
457 | 487 | | |
458 | 488 | | |
459 | 489 | | |
| |||
479 | 509 | | |
480 | 510 | | |
481 | 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 | + | |
| 541 | + | |
482 | 542 | | |
483 | 543 | | |
484 | 544 | | |
485 | | - | |
| 545 | + | |
486 | 546 | | |
| 547 | + | |
| 548 | + | |
487 | 549 | | |
488 | 550 | | |
489 | 551 | | |
490 | 552 | | |
491 | | - | |
| 553 | + | |
492 | 554 | | |
493 | 555 | | |
494 | 556 | | |
495 | 557 | | |
496 | 558 | | |
497 | 559 | | |
498 | | - | |
499 | | - | |
500 | | - | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
501 | 564 | | |
502 | 565 | | |
503 | 566 | | |
| |||
0 commit comments