]> git.lizzy.rs Git - rust.git/commitdiff
Add E0071 error explanation
authorGuillaume Gomez <guillaume1.gomez@gmail.com>
Fri, 19 Jun 2015 14:47:01 +0000 (16:47 +0200)
committerGuillaume Gomez <guillaume1.gomez@gmail.com>
Tue, 23 Jun 2015 17:34:38 +0000 (19:34 +0200)
src/librustc_typeck/diagnostics.rs

index 59ddbc4f210d28aec1bb0351983c24ffdbf97b39..59c21f581ea4d591ad2db7bc759c5aa74d145b0b 100644 (file)
@@ -746,6 +746,38 @@ fn some_func(x: &mut i32) {
 ```
 "##,
 
+E0071: r##"
+You tried to use a structure initialization with a non-structure type.
+Example of erroneous code:
+
+```
+enum Foo { f };
+
+let u = Foo::f { value: 0i32 }; // error: Foo:f isn't a structure!
+// or even more simple:
+let u = t { random_field: 0i32 }; //error: t isn't a structure!
+```
+
+To fix this error, please declare the structure with the given name
+first:
+
+```
+struct Inner {
+    value: i32
+}
+
+enum Foo {
+    f(Inner)
+}
+
+fn main() {
+    let u = Foo::f(Inner { value: 0i32 });
+    // or even more simple:
+    let t = Inner { value: 0i32 };
+}
+```
+"##,
+
 E0072: r##"
 When defining a recursive struct or enum, any use of the type being defined
 from inside the definition must occur behind a pointer (like `Box` or `&`).
@@ -1505,7 +1537,6 @@ impl Baz for Bar { } // Note: This is OK
     E0035, // does not take type parameters
     E0036, // incorrect number of type parameters given for this method
     E0068,
-    E0071,
     E0074,
     E0075,
     E0076,