Commit 3a9305c
committed
auto merge of #19690 : barosl/rust/struct-variant-as-a-function-ice, r=alexcrichton
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.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 | |
|---|---|---|---|
| |||
5807 | 5807 | | |
5808 | 5808 | | |
5809 | 5809 | | |
| 5810 | + | |
| 5811 | + | |
5810 | 5812 | | |
| 5813 | + | |
| 5814 | + | |
| 5815 | + | |
| 5816 | + | |
| 5817 | + | |
| 5818 | + | |
| 5819 | + | |
| 5820 | + | |
| 5821 | + | |
| 5822 | + | |
| 5823 | + | |
| 5824 | + | |
| 5825 | + | |
5811 | 5826 | | |
5812 | 5827 | | |
5813 | 5828 | | |
5814 | | - | |
| 5829 | + | |
5815 | 5830 | | |
5816 | 5831 | | |
5817 | 5832 | | |
5818 | 5833 | | |
5819 | | - | |
5820 | 5834 | | |
5821 | 5835 | | |
5822 | 5836 | | |
| |||
5829 | 5843 | | |
5830 | 5844 | | |
5831 | 5845 | | |
5832 | | - | |
| 5846 | + | |
5833 | 5847 | | |
5834 | 5848 | | |
5835 | 5849 | | |
5836 | 5850 | | |
5837 | | - | |
| 5851 | + | |
5838 | 5852 | | |
5839 | 5853 | | |
5840 | 5854 | | |
| |||
5851 | 5865 | | |
5852 | 5866 | | |
5853 | 5867 | | |
5854 | | - | |
| 5868 | + | |
5855 | 5869 | | |
5856 | 5870 | | |
5857 | 5871 | | |
| |||
5863 | 5877 | | |
5864 | 5878 | | |
5865 | 5879 | | |
5866 | | - | |
| 5880 | + | |
5867 | 5881 | | |
5868 | 5882 | | |
5869 | 5883 | | |
5870 | 5884 | | |
5871 | | - | |
| 5885 | + | |
5872 | 5886 | | |
5873 | 5887 | | |
5874 | | - | |
| 5888 | + | |
5875 | 5889 | | |
5876 | 5890 | | |
5877 | | - | |
| 5891 | + | |
5878 | 5892 | | |
5879 | 5893 | | |
5880 | 5894 | | |
| |||
5884 | 5898 | | |
5885 | 5899 | | |
5886 | 5900 | | |
5887 | | - | |
| 5901 | + | |
5888 | 5902 | | |
5889 | 5903 | | |
5890 | 5904 | | |
| |||
| 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