Commit 4db9554
authored
Rollup merge of rust-lang#142302 - JonathanBrouwer:invalid-const-token, r=jdonszelmann
Rework how the disallowed qualifier in function type diagnostics are generated
This pull request fixes two independent issues:
1. When qualifiers of a function type ptr are in the wrong order and one of them is async/const (not permitted on function types), the diagnostic suggests removing the incorrect qualifier. Fixes rust-lang#142268, which is an issue created by rust-lang#133151. This is fixed by moving the check into `parse_fn_front_matter`, where better span information is available to generate the right suggestions.
2. When qualifiers of a function type ptr are in the wrong order and one of them is async/const (not permitted on function types), `cargo fix` crashes because "cannot replace slice of data that was already replaced". This is fixed by not generating a suggestion for the "wrong order" diagnostic if the "disallowed qualifier" diagnostic is triggered.
There is a commit with failing tests so the test diff is clearer
r? `@jdonszelmann`File tree
9 files changed
+278
-182
lines changed- compiler/rustc_parse
- src
- parser
- tests/ui/parser
- recover
9 files changed
+278
-182
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
299 | 299 | | |
300 | 300 | | |
301 | 301 | | |
| 302 | + | |
302 | 303 | | |
303 | 304 | | |
304 | 305 | | |
305 | 306 | | |
| 307 | + | |
306 | 308 | | |
307 | 309 | | |
308 | 310 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2938 | 2938 | | |
2939 | 2939 | | |
2940 | 2940 | | |
| 2941 | + | |
2941 | 2942 | | |
2942 | 2943 | | |
2943 | | - | |
2944 | 2944 | | |
2945 | | - | |
| 2945 | + | |
2946 | 2946 | | |
2947 | 2947 | | |
2948 | 2948 | | |
2949 | 2949 | | |
2950 | 2950 | | |
2951 | 2951 | | |
| 2952 | + | |
2952 | 2953 | | |
2953 | 2954 | | |
2954 | | - | |
2955 | 2955 | | |
2956 | | - | |
| 2956 | + | |
2957 | 2957 | | |
2958 | 2958 | | |
2959 | 2959 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
2402 | 2402 | | |
2403 | 2403 | | |
2404 | 2404 | | |
2405 | | - | |
| 2405 | + | |
2406 | 2406 | | |
2407 | 2407 | | |
2408 | 2408 | | |
| |||
2658 | 2658 | | |
2659 | 2659 | | |
2660 | 2660 | | |
| 2661 | + | |
| 2662 | + | |
| 2663 | + | |
2661 | 2664 | | |
2662 | 2665 | | |
2663 | 2666 | | |
2664 | 2667 | | |
| 2668 | + | |
2665 | 2669 | | |
2666 | 2670 | | |
2667 | 2671 | | |
| 2672 | + | |
| 2673 | + | |
| 2674 | + | |
| 2675 | + | |
| 2676 | + | |
| 2677 | + | |
| 2678 | + | |
| 2679 | + | |
2668 | 2680 | | |
2669 | 2681 | | |
2670 | 2682 | | |
| 2683 | + | |
| 2684 | + | |
| 2685 | + | |
| 2686 | + | |
| 2687 | + | |
| 2688 | + | |
| 2689 | + | |
| 2690 | + | |
| 2691 | + | |
2671 | 2692 | | |
2672 | 2693 | | |
2673 | 2694 | | |
| |||
2703 | 2724 | | |
2704 | 2725 | | |
2705 | 2726 | | |
| 2727 | + | |
| 2728 | + | |
| 2729 | + | |
| 2730 | + | |
| 2731 | + | |
2706 | 2732 | | |
2707 | 2733 | | |
2708 | 2734 | | |
| |||
2716 | 2742 | | |
2717 | 2743 | | |
2718 | 2744 | | |
2719 | | - | |
| 2745 | + | |
| 2746 | + | |
| 2747 | + | |
| 2748 | + | |
| 2749 | + | |
| 2750 | + | |
| 2751 | + | |
| 2752 | + | |
| 2753 | + | |
| 2754 | + | |
| 2755 | + | |
| 2756 | + | |
| 2757 | + | |
| 2758 | + | |
| 2759 | + | |
2720 | 2760 | | |
2721 | 2761 | | |
2722 | 2762 | | |
| |||
2742 | 2782 | | |
2743 | 2783 | | |
2744 | 2784 | | |
2745 | | - | |
| 2785 | + | |
| 2786 | + | |
| 2787 | + | |
| 2788 | + | |
| 2789 | + | |
| 2790 | + | |
| 2791 | + | |
| 2792 | + | |
| 2793 | + | |
| 2794 | + | |
| 2795 | + | |
| 2796 | + | |
| 2797 | + | |
| 2798 | + | |
| 2799 | + | |
2746 | 2800 | | |
2747 | 2801 | | |
2748 | 2802 | | |
| |||
2840 | 2894 | | |
2841 | 2895 | | |
2842 | 2896 | | |
2843 | | - | |
| 2897 | + | |
2844 | 2898 | | |
2845 | 2899 | | |
2846 | 2900 | | |
2847 | 2901 | | |
2848 | 2902 | | |
2849 | 2903 | | |
2850 | | - | |
| 2904 | + | |
| 2905 | + | |
| 2906 | + | |
| 2907 | + | |
| 2908 | + | |
| 2909 | + | |
| 2910 | + | |
2851 | 2911 | | |
2852 | 2912 | | |
2853 | 2913 | | |
| |||
3194 | 3254 | | |
3195 | 3255 | | |
3196 | 3256 | | |
| 3257 | + | |
| 3258 | + | |
| 3259 | + | |
| 3260 | + | |
| 3261 | + | |
| 3262 | + | |
| 3263 | + | |
| 3264 | + | |
| 3265 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
20 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
669 | 670 | | |
670 | 671 | | |
671 | 672 | | |
672 | | - | |
673 | | - | |
674 | | - | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
675 | 678 | | |
676 | 679 | | |
677 | 680 | | |
678 | 681 | | |
679 | | - | |
680 | | - | |
681 | | - | |
682 | | - | |
683 | | - | |
684 | | - | |
685 | | - | |
686 | | - | |
687 | | - | |
688 | | - | |
689 | | - | |
690 | | - | |
691 | | - | |
692 | | - | |
693 | | - | |
694 | | - | |
695 | | - | |
696 | | - | |
697 | | - | |
698 | | - | |
699 | | - | |
700 | | - | |
701 | | - | |
702 | | - | |
703 | | - | |
704 | | - | |
705 | | - | |
706 | | - | |
707 | | - | |
708 | | - | |
709 | | - | |
710 | | - | |
711 | | - | |
712 | | - | |
713 | | - | |
714 | | - | |
715 | | - | |
716 | | - | |
717 | | - | |
718 | | - | |
719 | | - | |
720 | | - | |
721 | | - | |
722 | | - | |
723 | | - | |
724 | | - | |
725 | | - | |
726 | | - | |
727 | | - | |
| 682 | + | |
728 | 683 | | |
729 | 684 | | |
730 | 685 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
26 | 34 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
26 | 34 | | |
0 commit comments