@@ -1032,3 +1032,214 @@ pub(crate) struct StructLiteralBodyWithoutPathSugg {
1032
1032
#[ suggestion_part( code = " }}" ) ]
1033
1033
pub after : Span ,
1034
1034
}
1035
+
1036
+ #[ derive( Diagnostic ) ]
1037
+ #[ diag( parser:: unmatched_angle_brackets) ]
1038
+ pub ( crate ) struct UnmatchedAngleBrackets {
1039
+ #[ primary_span]
1040
+ #[ suggestion( code = "" , applicability = "machine-applicable" ) ]
1041
+ pub span : Span ,
1042
+ pub num_extra_brackets : usize ,
1043
+ }
1044
+
1045
+ #[ derive( Diagnostic ) ]
1046
+ #[ diag( parser:: generic_parameters_without_angle_brackets) ]
1047
+ pub ( crate ) struct GenericParamsWithoutAngleBrackets {
1048
+ #[ primary_span]
1049
+ pub span : Span ,
1050
+ #[ subdiagnostic]
1051
+ pub sugg : GenericParamsWithoutAngleBracketsSugg ,
1052
+ }
1053
+
1054
+ #[ derive( Subdiagnostic ) ]
1055
+ #[ multipart_suggestion( parser:: suggestion, applicability = "machine-applicable" ) ]
1056
+ pub ( crate ) struct GenericParamsWithoutAngleBracketsSugg {
1057
+ #[ suggestion_part( code = "<" ) ]
1058
+ pub left : Span ,
1059
+ #[ suggestion_part( code = ">" ) ]
1060
+ pub right : Span ,
1061
+ }
1062
+
1063
+ #[ derive( Diagnostic ) ]
1064
+ #[ diag( parser:: comparison_operators_cannot_be_chained) ]
1065
+ pub ( crate ) struct ComparisonOperatorsCannotBeChained {
1066
+ #[ primary_span]
1067
+ pub span : Vec < Span > ,
1068
+ #[ suggestion_verbose(
1069
+ parser:: sugg_turbofish_syntax,
1070
+ code = "::" ,
1071
+ applicability = "maybe-incorrect"
1072
+ ) ]
1073
+ pub suggest_turbofish : Option < Span > ,
1074
+ #[ help( parser:: sugg_turbofish_syntax) ]
1075
+ #[ help( parser:: sugg_parentheses_for_function_args) ]
1076
+ pub help_turbofish : Option < ( ) > ,
1077
+ #[ subdiagnostic]
1078
+ pub chaining_sugg : Option < ComparisonOperatorsCannotBeChainedSugg > ,
1079
+ }
1080
+
1081
+ #[ derive( Subdiagnostic ) ]
1082
+ pub ( crate ) enum ComparisonOperatorsCannotBeChainedSugg {
1083
+ #[ suggestion_verbose(
1084
+ parser:: sugg_split_comparison,
1085
+ code = " && {middle_term}" ,
1086
+ applicability = "maybe-incorrect"
1087
+ ) ]
1088
+ SplitComparison {
1089
+ #[ primary_span]
1090
+ span : Span ,
1091
+ middle_term : String ,
1092
+ } ,
1093
+ #[ multipart_suggestion( parser:: sugg_parenthesize, applicability = "maybe-incorrect" ) ]
1094
+ Parenthesize {
1095
+ #[ suggestion_part( code = "(" ) ]
1096
+ left : Span ,
1097
+ #[ suggestion_part( code = ")" ) ]
1098
+ right : Span ,
1099
+ } ,
1100
+ }
1101
+
1102
+ #[ derive( Diagnostic ) ]
1103
+ #[ diag( parser:: question_mark_in_type) ]
1104
+ pub ( crate ) struct QuestionMarkInType {
1105
+ #[ primary_span]
1106
+ #[ label]
1107
+ pub span : Span ,
1108
+ #[ subdiagnostic]
1109
+ pub sugg : QuestionMarkInTypeSugg ,
1110
+ }
1111
+
1112
+ #[ derive( Subdiagnostic ) ]
1113
+ #[ multipart_suggestion( parser:: suggestion, applicability = "machine-applicable" ) ]
1114
+ pub ( crate ) struct QuestionMarkInTypeSugg {
1115
+ #[ suggestion_part( code = "Option<" ) ]
1116
+ pub left : Span ,
1117
+ #[ suggestion_part( code = ">" ) ]
1118
+ pub right : Span ,
1119
+ }
1120
+
1121
+ #[ derive( Diagnostic ) ]
1122
+ #[ diag( parser:: unexpected_parentheses_in_for_head) ]
1123
+ pub ( crate ) struct ParenthesesInForHead {
1124
+ #[ primary_span]
1125
+ pub span : Vec < Span > ,
1126
+ #[ subdiagnostic]
1127
+ pub sugg : ParenthesesInForHeadSugg ,
1128
+ }
1129
+
1130
+ #[ derive( Subdiagnostic ) ]
1131
+ #[ multipart_suggestion( parser:: suggestion, applicability = "machine-applicable" ) ]
1132
+ pub ( crate ) struct ParenthesesInForHeadSugg {
1133
+ #[ suggestion_part( code = "" ) ]
1134
+ pub left : Span ,
1135
+ #[ suggestion_part( code = "" ) ]
1136
+ pub right : Span ,
1137
+ }
1138
+
1139
+ #[ derive( Diagnostic ) ]
1140
+ #[ diag( parser:: doc_comment_on_param_type) ]
1141
+ pub ( crate ) struct DocCommentOnParamType {
1142
+ #[ primary_span]
1143
+ #[ label]
1144
+ pub span : Span ,
1145
+ }
1146
+
1147
+ #[ derive( Diagnostic ) ]
1148
+ #[ diag( parser:: attribute_on_param_type) ]
1149
+ pub ( crate ) struct AttributeOnParamType {
1150
+ #[ primary_span]
1151
+ #[ label]
1152
+ pub span : Span ,
1153
+ }
1154
+
1155
+ #[ derive( Diagnostic ) ]
1156
+ #[ diag( parser:: pattern_method_param_without_body, code = "E0642" ) ]
1157
+ pub ( crate ) struct PatternMethodParamWithoutBody {
1158
+ #[ primary_span]
1159
+ #[ suggestion( code = "_" , applicability = "machine-applicable" ) ]
1160
+ pub span : Span ,
1161
+ }
1162
+
1163
+ #[ derive( Diagnostic ) ]
1164
+ #[ diag( parser:: self_param_not_first) ]
1165
+ pub ( crate ) struct SelfParamNotFirst {
1166
+ #[ primary_span]
1167
+ #[ label]
1168
+ pub span : Span ,
1169
+ }
1170
+
1171
+ #[ derive( Diagnostic ) ]
1172
+ #[ diag( parser:: const_generic_without_braces) ]
1173
+ pub ( crate ) struct ConstGenericWithoutBraces {
1174
+ #[ primary_span]
1175
+ pub span : Span ,
1176
+ #[ subdiagnostic]
1177
+ pub sugg : ConstGenericWithoutBracesSugg ,
1178
+ }
1179
+
1180
+ #[ derive( Subdiagnostic ) ]
1181
+ #[ multipart_suggestion( parser:: suggestion, applicability = "machine-applicable" ) ]
1182
+ pub ( crate ) struct ConstGenericWithoutBracesSugg {
1183
+ #[ suggestion_part( code = "{{ " ) ]
1184
+ pub left : Span ,
1185
+ #[ suggestion_part( code = " }}" ) ]
1186
+ pub right : Span ,
1187
+ }
1188
+
1189
+ #[ derive( Diagnostic ) ]
1190
+ #[ diag( parser:: unexpected_const_param_declaration) ]
1191
+ pub ( crate ) struct UnexpectedConstParamDeclaration {
1192
+ #[ primary_span]
1193
+ #[ label]
1194
+ pub span : Span ,
1195
+ #[ subdiagnostic]
1196
+ pub sugg : Option < UnexpectedConstParamDeclarationSugg > ,
1197
+ }
1198
+
1199
+ #[ derive( Subdiagnostic ) ]
1200
+ pub ( crate ) enum UnexpectedConstParamDeclarationSugg {
1201
+ #[ multipart_suggestion( parser:: suggestion, applicability = "machine-applicable" ) ]
1202
+ AddParam {
1203
+ #[ suggestion_part( code = "<{snippet}>" ) ]
1204
+ impl_generics : Span ,
1205
+ #[ suggestion_part( code = "{ident}" ) ]
1206
+ incorrect_decl : Span ,
1207
+ snippet : String ,
1208
+ ident : String ,
1209
+ } ,
1210
+ #[ multipart_suggestion( parser:: suggestion, applicability = "machine-applicable" ) ]
1211
+ AppendParam {
1212
+ #[ suggestion_part( code = ", {snippet}" ) ]
1213
+ impl_generics_end : Span ,
1214
+ #[ suggestion_part( code = "{ident}" ) ]
1215
+ incorrect_decl : Span ,
1216
+ snippet : String ,
1217
+ ident : String ,
1218
+ } ,
1219
+ }
1220
+
1221
+ #[ derive( Diagnostic ) ]
1222
+ #[ diag( parser:: unexpected_const_in_generic_param) ]
1223
+ pub ( crate ) struct UnexpectedConstInGenericParam {
1224
+ #[ primary_span]
1225
+ pub span : Span ,
1226
+ #[ suggestion_verbose( code = "" , applicability = "maybe-incorrect" ) ]
1227
+ pub to_remove : Option < Span > ,
1228
+ }
1229
+
1230
+ #[ derive( Diagnostic ) ]
1231
+ #[ diag( parser:: async_move_order_incorrect) ]
1232
+ pub ( crate ) struct AsyncMoveOrderIncorrect {
1233
+ #[ primary_span]
1234
+ #[ suggestion_verbose( code = "async move" , applicability = "maybe-incorrect" ) ]
1235
+ pub span : Span ,
1236
+ }
1237
+
1238
+ #[ derive( Diagnostic ) ]
1239
+ #[ diag( parser:: double_colon_in_bound) ]
1240
+ pub ( crate ) struct DoubleColonInBound {
1241
+ #[ primary_span]
1242
+ pub span : Span ,
1243
+ #[ suggestion( code = ": " , applicability = "machine-applicable" ) ]
1244
+ pub between : Span ,
1245
+ }
0 commit comments