File tree Expand file tree Collapse file tree 2 files changed +16
-10
lines changed
branches/stable/src/librustc_typeck Expand file tree Collapse file tree 2 files changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ refs/heads/tmp: afae2ff723393b3ab4ccffef6ac7c6d1809e2da0
29
29
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
30
30
refs/tags/homu-tmp: f859507de8c410b648d934d8f5ec1c52daac971d
31
31
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32
- refs/heads/stable: e52b94e259b7f416ec584164e6803dcbf038b200
32
+ refs/heads/stable: 4c2587c1c0865dfa04ce7bebb680c2ceec615f5c
33
33
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
34
34
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
35
35
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e
Original file line number Diff line number Diff line change @@ -753,28 +753,34 @@ You tried to use a structure initialization with a non-structure type.
753
753
Example of erroneous code:
754
754
755
755
```
756
- enum Foo { f };
756
+ enum Foo { FirstValue };
757
757
758
- let u = Foo::f { value: 0i32 }; // error: Foo:f isn't a structure!
759
- // or even simpler:
760
- let u = t { random_field: 0i32 }; //error: t isn't a structure!
758
+ let u = Foo::FirstValue { value: 0i32 }; // error: Foo::FirstValue
759
+ // isn't a structure!
760
+ // or even simpler, if the structure wasn't defined at all:
761
+ let u = RandomName { random_field: 0i32 }; // error: RandomName
762
+ // isn't a structure!
761
763
```
762
764
763
- To fix this error, please declare the structure with the given name
764
- first:
765
+ To fix this, please check:
766
+ * Did you spell it right?
767
+ * Did you accidentaly used an enum as a struct?
768
+ * Did you accidentaly make an enum when you intended to use a struct?
769
+
770
+ Here is the previous code with all missing information:
765
771
766
772
```
767
773
struct Inner {
768
774
value: i32
769
775
}
770
776
771
777
enum Foo {
772
- f (Inner)
778
+ FirstValue (Inner)
773
779
}
774
780
775
781
fn main() {
776
- let u = Foo::f (Inner { value: 0i32 });
777
- // or even simpler:
782
+ let u = Foo::FirstValue (Inner { value: 0i32 });
783
+
778
784
let t = Inner { value: 0i32 };
779
785
}
780
786
```
You can’t perform that action at this time.
0 commit comments