@@ -1368,6 +1368,62 @@ struct Foo {
1368
1368
```
1369
1369
"## ,
1370
1370
1371
+ E0128 : r##"
1372
+ Type parameter defaults can only use parameters that occur before them.
1373
+ Erroneous code example:
1374
+
1375
+ ```
1376
+ pub struct Foo<T=U, U=()> {
1377
+ field1: T,
1378
+ filed2: U,
1379
+ }
1380
+ // error: type parameters with a default cannot use forward declared
1381
+ // identifiers
1382
+ ```
1383
+
1384
+ Since type parameters are evaluated in-order, you may be able to fix this issue
1385
+ by doing:
1386
+
1387
+ ```
1388
+ pub struct Foo<U=(), T=U> {
1389
+ field1: T,
1390
+ filed2: U,
1391
+ }
1392
+ ```
1393
+
1394
+ Please also verify that this wasn't because of a name-clash and rename the type
1395
+ parameter if so.
1396
+ "## ,
1397
+
1398
+ E0130 : r##"
1399
+ You declared a pattern as an argument in a foreign function declaration.
1400
+ Erroneous code example:
1401
+
1402
+ ```
1403
+ extern {
1404
+ fn foo((a, b): (u32, u32)); // error: patterns aren't allowed in foreign
1405
+ // function declarations
1406
+ }
1407
+ ```
1408
+
1409
+ Please replace the pattern argument with a regular one. Example:
1410
+
1411
+ ```
1412
+ struct SomeStruct {
1413
+ a: u32,
1414
+ b: u32,
1415
+ }
1416
+
1417
+ extern {
1418
+ fn foo(s: SomeStruct); // ok!
1419
+ }
1420
+ // or
1421
+ extern {
1422
+ fn foo(a: (u32, u32)); // ok!
1423
+ }
1424
+ ```
1425
+ "## ,
1426
+
1371
1427
E0131 : r##"
1372
1428
It is not possible to define `main` with type parameters, or even with function
1373
1429
parameters. When `main` is present, it must take no arguments and return `()`.
@@ -1382,6 +1438,30 @@ fn(isize, *const *const u8) -> isize
1382
1438
```
1383
1439
"## ,
1384
1440
1441
+ E0159 : r##"
1442
+ You tried to use a trait as a struct constructor. Erroneous code example:
1443
+
1444
+ ```
1445
+ trait TraitNotAStruct {}
1446
+
1447
+ TraitNotAStruct{ value: 0 }; // error: use of trait `TraitNotAStruct` as a
1448
+ // struct constructor
1449
+ ```
1450
+
1451
+ Please verify you used the correct type name or please implement the trait
1452
+ on a struct and use this struct constructor. Example:
1453
+
1454
+ ```
1455
+ trait TraitNotAStruct {}
1456
+
1457
+ struct Foo {
1458
+ value: i32
1459
+ }
1460
+
1461
+ Foo{ value: 0 }; // ok!
1462
+ ```
1463
+ "## ,
1464
+
1385
1465
E0166 : r##"
1386
1466
This error means that the compiler found a return expression in a function
1387
1467
marked as diverging. A function diverges if it has `!` in the place of the
@@ -1978,11 +2058,8 @@ register_diagnostics! {
1978
2058
E0122 ,
1979
2059
E0123 ,
1980
2060
E0127 ,
1981
- E0128 ,
1982
2061
E0129 ,
1983
- E0130 ,
1984
2062
E0141 ,
1985
- E0159 ,
1986
2063
E0163 ,
1987
2064
E0164 ,
1988
2065
E0167 ,
0 commit comments