]> git.lizzy.rs Git - rust.git/commitdiff
Add E0159 error explanation
authorGuillaume Gomez <guillaume1.gomez@gmail.com>
Fri, 3 Jul 2015 11:31:23 +0000 (13:31 +0200)
committerGuillaume Gomez <guillaume1.gomez@gmail.com>
Sat, 4 Jul 2015 16:27:54 +0000 (18:27 +0200)
src/librustc_typeck/diagnostics.rs

index 8e6f6a50fa58f5f78667f9947e090e0d2eaef599..96637058225240b93fd8326916d1f51e2c8c246c 100644 (file)
@@ -1431,6 +1431,30 @@ struct SomeStruct {
 ```
 "##,
 
+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
@@ -2029,7 +2053,6 @@ impl Baz for Bar { } // Note: This is OK
     E0127,
     E0129,
     E0141,
-    E0159,
     E0163,
     E0164,
     E0167,