Commit cfee5b7
committed
Fix an ICE when trying to resolve a struct variant
Unlike a tuple variant constructor which can be called as a function, a
struct variant constructor is not a function, so cannot be called.
If the user tries to assign the constructor to a variable, an ICE
occurs, because there is no way to use it later. So we should stop the
constructor from being used like that.
A similar mechanism already exists for a normal struct, as it prohibits
a struct from being resolved. This commit does the same for a struct
variant.
This commit also includes some changes to the existing tests.
Fixes #19452.1 parent fddec2d commit cfee5b7
File tree
3 files changed
+42
-11
lines changed- src
- librustc/middle
- test/compile-fail
3 files changed
+42
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5769 | 5769 | | |
5770 | 5770 | | |
5771 | 5771 | | |
| 5772 | + | |
| 5773 | + | |
5772 | 5774 | | |
| 5775 | + | |
| 5776 | + | |
| 5777 | + | |
| 5778 | + | |
| 5779 | + | |
| 5780 | + | |
| 5781 | + | |
| 5782 | + | |
| 5783 | + | |
| 5784 | + | |
| 5785 | + | |
| 5786 | + | |
| 5787 | + | |
5773 | 5788 | | |
5774 | 5789 | | |
5775 | 5790 | | |
5776 | | - | |
| 5791 | + | |
5777 | 5792 | | |
5778 | 5793 | | |
5779 | 5794 | | |
5780 | 5795 | | |
5781 | | - | |
5782 | 5796 | | |
5783 | 5797 | | |
5784 | 5798 | | |
| |||
5791 | 5805 | | |
5792 | 5806 | | |
5793 | 5807 | | |
5794 | | - | |
| 5808 | + | |
5795 | 5809 | | |
5796 | 5810 | | |
5797 | 5811 | | |
5798 | 5812 | | |
5799 | | - | |
| 5813 | + | |
5800 | 5814 | | |
5801 | 5815 | | |
5802 | 5816 | | |
| |||
5813 | 5827 | | |
5814 | 5828 | | |
5815 | 5829 | | |
5816 | | - | |
| 5830 | + | |
5817 | 5831 | | |
5818 | 5832 | | |
5819 | 5833 | | |
| |||
5825 | 5839 | | |
5826 | 5840 | | |
5827 | 5841 | | |
5828 | | - | |
| 5842 | + | |
5829 | 5843 | | |
5830 | 5844 | | |
5831 | 5845 | | |
5832 | 5846 | | |
5833 | | - | |
| 5847 | + | |
5834 | 5848 | | |
5835 | 5849 | | |
5836 | | - | |
| 5850 | + | |
5837 | 5851 | | |
5838 | 5852 | | |
5839 | | - | |
| 5853 | + | |
5840 | 5854 | | |
5841 | 5855 | | |
5842 | 5856 | | |
| |||
5846 | 5860 | | |
5847 | 5861 | | |
5848 | 5862 | | |
5849 | | - | |
| 5863 | + | |
5850 | 5864 | | |
5851 | 5865 | | |
5852 | 5866 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
0 commit comments