Skip to content

Commit 05fcb2e

Browse files
Add E0130 error explanation
1 parent 7160d92 commit 05fcb2e

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

src/librustc_typeck/diagnostics.rs

+31-3
Original file line numberDiff line numberDiff line change
@@ -1378,8 +1378,8 @@ pub struct Foo<SomeType=SomeType>;
13781378
// identifiers
13791379
```
13801380
1381-
Please verify you used the good type or change the type parameter identifier.
1382-
Example:
1381+
Please verify that a name clash hasn't been accidentally introduced, and rename
1382+
the type parameter if so. Example:
13831383
13841384
```
13851385
pub struct Foo<T=SomeType> {
@@ -1388,6 +1388,35 @@ pub struct Foo<T=SomeType> {
13881388
```
13891389
"##,
13901390

1391+
E0130: r##"
1392+
You declared a pattern as an argument in a foreign function declaration.
1393+
Erroneous code example:
1394+
1395+
```
1396+
extern {
1397+
fn foo((a, b): (u32, u32)); // error: patterns aren't allowed in foreign
1398+
// function declarations
1399+
}
1400+
```
1401+
1402+
Please replace the pattern argument with a regular one. Example:
1403+
1404+
```
1405+
struct SomeStruct {
1406+
a: u32,
1407+
b: u32,
1408+
}
1409+
1410+
extern {
1411+
fn foo(s: SomeStruct); // ok!
1412+
}
1413+
// or
1414+
extern {
1415+
fn foo(a: (u32, u32)); // ok!
1416+
}
1417+
```
1418+
"##,
1419+
13911420
E0131: r##"
13921421
It is not possible to define `main` with type parameters, or even with function
13931422
parameters. When `main` is present, it must take no arguments and return `()`.
@@ -1999,7 +2028,6 @@ register_diagnostics! {
19992028
E0123,
20002029
E0127,
20012030
E0129,
2002-
E0130,
20032031
E0141,
20042032
E0159,
20052033
E0163,

0 commit comments

Comments
 (0)