From 8ae2b1d7dd9e25b09439d6494a3a9d2540c08dbf Mon Sep 17 00:00:00 2001 From: Alisdair Owens Date: Sat, 29 Aug 2015 17:20:46 +0100 Subject: [PATCH] add long diagnostics for E0122 --- src/librustc_typeck/diagnostics.rs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index 0dbfffe5c644a..9f811eda4417d 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -1642,6 +1642,26 @@ static BAR: _ = "test"; // error, explicitly write out the type instead ``` "##, +E0122: r##" +An attempt was made to add a generic constraint to a type alias. While Rust will +allow this with a warning, it will not currently enforce the constraint. +Consider the example below: + +``` +trait Foo{} + +type MyType = (R, ()); + +fn main() { + let t: MyType; +} +``` + +We're able to declare a variable of type `MyType`, despite the fact that +`u32` does not implement `Foo`. As a result, one should avoid using generic +constraints in concert with type aliases. +"##, + E0124: r##" You declared two fields of a struct with the same name. Erroneous code example: @@ -3010,7 +3030,6 @@ register_diagnostics! { E0103, // @GuillaumeGomez: I was unable to get this error, try your best! E0104, E0118, - E0122, // E0123, // E0127, // E0129,