@@ -184,18 +184,6 @@ pub enum SourceKindMultiSuggestion<'a> {
184
184
} ,
185
185
}
186
186
187
- #[ derive( Subdiagnostic ) ]
188
- #[ suggestion(
189
- infer_suggest_add_let_for_letchains,
190
- style = "verbose" ,
191
- applicability = "machine-applicable" ,
192
- code = "let "
193
- ) ]
194
- pub ( crate ) struct SuggAddLetForLetChains {
195
- #[ primary_span]
196
- pub span : Span ,
197
- }
198
-
199
187
impl < ' a > SourceKindMultiSuggestion < ' a > {
200
188
pub fn new_fully_qualified (
201
189
span : Span ,
@@ -1373,17 +1361,172 @@ impl AddToDiagnostic for SuggestTuplePatternMany {
1373
1361
}
1374
1362
1375
1363
#[ derive( Subdiagnostic ) ]
1376
- pub enum TupleTrailingCommaSuggestion {
1364
+ pub enum Error0308Subdiags {
1365
+ #[ suggestion(
1366
+ infer_meant_byte_literal,
1367
+ code = "b'{code}'" ,
1368
+ applicability = "machine-applicable"
1369
+ ) ]
1370
+ MeantByteLiteral {
1371
+ #[ primary_span]
1372
+ span : Span ,
1373
+ code : String ,
1374
+ } ,
1375
+ #[ suggestion(
1376
+ infer_meant_char_literal,
1377
+ code = "'{code}'" ,
1378
+ applicability = "machine-applicable"
1379
+ ) ]
1380
+ MeantCharLiteral {
1381
+ #[ primary_span]
1382
+ span : Span ,
1383
+ code : String ,
1384
+ } ,
1385
+ #[ suggestion(
1386
+ infer_meant_str_literal,
1387
+ code = "\" {code}\" " ,
1388
+ applicability = "machine-applicable"
1389
+ ) ]
1390
+ MeantStrLiteral {
1391
+ #[ primary_span]
1392
+ span : Span ,
1393
+ code : String ,
1394
+ } ,
1395
+ #[ suggestion(
1396
+ infer_consider_specifying_length,
1397
+ code = "{length}" ,
1398
+ applicability = "maybe-incorrect"
1399
+ ) ]
1400
+ ConsiderSpecifyingLength {
1401
+ #[ primary_span]
1402
+ span : Span ,
1403
+ length : u64 ,
1404
+ } ,
1405
+ #[ note( infer_try_cannot_convert) ]
1406
+ TryCannotConvert { found : String , expected : String } ,
1377
1407
#[ suggestion( infer_tuple_trailing_comma, code = "," , applicability = "machine-applicable" ) ]
1378
- OnlyComma {
1408
+ TupleOnlyComma {
1379
1409
#[ primary_span]
1380
1410
span : Span ,
1381
1411
} ,
1382
1412
#[ multipart_suggestion( infer_tuple_trailing_comma, applicability = "machine-applicable" ) ]
1383
- AlsoParentheses {
1413
+ TupleAlsoParentheses {
1384
1414
#[ suggestion_part( code = "(" ) ]
1385
1415
span_low : Span ,
1386
1416
#[ suggestion_part( code = ",)" ) ]
1387
1417
span_high : Span ,
1388
1418
} ,
1419
+ #[ suggestion(
1420
+ infer_suggest_add_let_for_letchains,
1421
+ style = "verbose" ,
1422
+ applicability = "machine-applicable" ,
1423
+ code = "let "
1424
+ ) ]
1425
+ AddLetForLetChains {
1426
+ #[ primary_span]
1427
+ span : Span ,
1428
+ } ,
1429
+ }
1430
+
1431
+ #[ derive( Diagnostic ) ]
1432
+ pub enum FailureCodeDiagnostics {
1433
+ #[ diag( infer_oc_method_compat, code = "E0308" ) ]
1434
+ MethodCompat {
1435
+ #[ primary_span]
1436
+ span : Span ,
1437
+ #[ subdiagnostic]
1438
+ subdiags : Vec < Error0308Subdiags > ,
1439
+ } ,
1440
+ #[ diag( infer_oc_type_compat, code = "E0308" ) ]
1441
+ TypeCompat {
1442
+ #[ primary_span]
1443
+ span : Span ,
1444
+ #[ subdiagnostic]
1445
+ subdiags : Vec < Error0308Subdiags > ,
1446
+ } ,
1447
+ #[ diag( infer_oc_const_compat, code = "E0308" ) ]
1448
+ ConstCompat {
1449
+ #[ primary_span]
1450
+ span : Span ,
1451
+ #[ subdiagnostic]
1452
+ subdiags : Vec < Error0308Subdiags > ,
1453
+ } ,
1454
+ #[ diag( infer_oc_try_compat, code = "E0308" ) ]
1455
+ TryCompat {
1456
+ #[ primary_span]
1457
+ span : Span ,
1458
+ #[ subdiagnostic]
1459
+ subdiags : Vec < Error0308Subdiags > ,
1460
+ } ,
1461
+ #[ diag( infer_oc_match_compat, code = "E0308" ) ]
1462
+ MatchCompat {
1463
+ #[ primary_span]
1464
+ span : Span ,
1465
+ #[ subdiagnostic]
1466
+ subdiags : Vec < Error0308Subdiags > ,
1467
+ } ,
1468
+ #[ diag( infer_oc_if_else_different, code = "E0308" ) ]
1469
+ IfElseDifferent {
1470
+ #[ primary_span]
1471
+ span : Span ,
1472
+ #[ subdiagnostic]
1473
+ subdiags : Vec < Error0308Subdiags > ,
1474
+ } ,
1475
+ #[ diag( infer_oc_no_else, code = "E0317" ) ]
1476
+ NoElse {
1477
+ #[ primary_span]
1478
+ span : Span ,
1479
+ } ,
1480
+ #[ diag( infer_oc_no_diverge, code = "E0308" ) ]
1481
+ NoDiverge {
1482
+ #[ primary_span]
1483
+ span : Span ,
1484
+ #[ subdiagnostic]
1485
+ subdiags : Vec < Error0308Subdiags > ,
1486
+ } ,
1487
+ #[ diag( infer_oc_fn_main_correct_type, code = "E0580" ) ]
1488
+ FnMainCorrectType {
1489
+ #[ primary_span]
1490
+ span : Span ,
1491
+ } ,
1492
+ #[ diag( infer_oc_fn_start_correct_type, code = "E0308" ) ]
1493
+ FnStartCorrectType {
1494
+ #[ primary_span]
1495
+ span : Span ,
1496
+ #[ subdiagnostic]
1497
+ subdiags : Vec < Error0308Subdiags > ,
1498
+ } ,
1499
+ #[ diag( infer_oc_intristic_correct_type, code = "E0308" ) ]
1500
+ IntristicCorrectType {
1501
+ #[ primary_span]
1502
+ span : Span ,
1503
+ #[ subdiagnostic]
1504
+ subdiags : Vec < Error0308Subdiags > ,
1505
+ } ,
1506
+ #[ diag( infer_oc_method_correct_type, code = "E0308" ) ]
1507
+ MethodCorrectType {
1508
+ #[ primary_span]
1509
+ span : Span ,
1510
+ #[ subdiagnostic]
1511
+ subdiags : Vec < Error0308Subdiags > ,
1512
+ } ,
1513
+ #[ diag( infer_oc_closure_selfref, code = "E0644" ) ]
1514
+ ClosureSelfref {
1515
+ #[ primary_span]
1516
+ span : Span ,
1517
+ } ,
1518
+ #[ diag( infer_oc_cant_coerce, code = "E0308" ) ]
1519
+ CantCoerce {
1520
+ #[ primary_span]
1521
+ span : Span ,
1522
+ #[ subdiagnostic]
1523
+ subdiags : Vec < Error0308Subdiags > ,
1524
+ } ,
1525
+ #[ diag( infer_oc_generic, code = "E0308" ) ]
1526
+ Generic {
1527
+ #[ primary_span]
1528
+ span : Span ,
1529
+ #[ subdiagnostic]
1530
+ subdiags : Vec < Error0308Subdiags > ,
1531
+ } ,
1389
1532
}
0 commit comments