diff options
| author | Steve Klabnik <steve@steveklabnik.com> | 2015-07-07 09:49:55 -0400 |
|---|---|---|
| committer | Steve Klabnik <steve@steveklabnik.com> | 2015-07-07 09:49:55 -0400 |
| commit | c69663caf6001e7681336cd0fe7f50c5211e8016 (patch) | |
| tree | 7ed2c6a55a96c7da7e46442cd98d0acb14155b47 | |
| parent | ed14593d98ce89eb52cc0354e90bec6802c9d041 (diff) | |
| parent | 5460650eeccb0d8925b36480d0ccd7db31a757d8 (diff) | |
| download | rust-c69663caf6001e7681336cd0fe7f50c5211e8016.tar.gz rust-c69663caf6001e7681336cd0fe7f50c5211e8016.zip | |
Rollup merge of #26742 - GuillaumeGomez:patch-2, r=arielb1
Part of #24407. r? @Manishearth
| -rw-r--r-- | src/librustc_typeck/diagnostics.rs | 83 |
1 files changed, 80 insertions, 3 deletions
diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index 549c89599ec..a1fa4218e70 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -1368,6 +1368,62 @@ struct Foo { ``` "##, +E0128: r##" +Type parameter defaults can only use parameters that occur before them. +Erroneous code example: + +``` +pub struct Foo<T=U, U=()> { + field1: T, + filed2: U, +} +// error: type parameters with a default cannot use forward declared +// identifiers +``` + +Since type parameters are evaluated in-order, you may be able to fix this issue +by doing: + +``` +pub struct Foo<U=(), T=U> { + field1: T, + filed2: U, +} +``` + +Please also verify that this wasn't because of a name-clash and rename the type +parameter if so. +"##, + +E0130: r##" +You declared a pattern as an argument in a foreign function declaration. +Erroneous code example: + +``` +extern { + fn foo((a, b): (u32, u32)); // error: patterns aren't allowed in foreign + // function declarations +} +``` + +Please replace the pattern argument with a regular one. Example: + +``` +struct SomeStruct { + a: u32, + b: u32, +} + +extern { + fn foo(s: SomeStruct); // ok! +} +// or +extern { + fn foo(a: (u32, u32)); // ok! +} +``` +"##, + E0131: r##" It is not possible to define `main` with type parameters, or even with function parameters. When `main` is present, it must take no arguments and return `()`. @@ -1382,6 +1438,30 @@ fn(isize, *const *const u8) -> isize ``` "##, +E0159: r##" +You tried to use a trait as a struct constructor. Erroneous code example: + +``` +trait TraitNotAStruct {} + +TraitNotAStruct{ value: 0 }; // error: use of trait `TraitNotAStruct` as a + // struct constructor +``` + +Please verify you used the correct type name or please implement the trait +on a struct and use this struct constructor. Example: + +``` +trait TraitNotAStruct {} + +struct Foo { + value: i32 +} + +Foo{ value: 0 }; // ok! +``` +"##, + E0166: r##" This error means that the compiler found a return expression in a function marked as diverging. A function diverges if it has `!` in the place of the @@ -1978,11 +2058,8 @@ register_diagnostics! { E0122, E0123, E0127, - E0128, E0129, - E0130, E0141, - E0159, E0163, E0164, E0167, |
