Skip to content

Commit 4ca85bd

Browse files
---
yaml --- r: 227793 b: refs/heads/try c: 4c2587c h: refs/heads/master i: 227791: 219220c v: v3
1 parent 98654cf commit 4ca85bd

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: aca2057ed5fb7af3f8905b2bc01f72fa001c35c8
33
refs/heads/snap-stage3: 1af31d4974e33027a68126fa5a5a3c2c6491824f
4-
refs/heads/try: e52b94e259b7f416ec584164e6803dcbf038b200
4+
refs/heads/try: 4c2587c1c0865dfa04ce7bebb680c2ceec615f5c
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/src/librustc_typeck/diagnostics.rs

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -753,28 +753,34 @@ You tried to use a structure initialization with a non-structure type.
753753
Example of erroneous code:
754754
755755
```
756-
enum Foo { f };
756+
enum Foo { FirstValue };
757757
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!
761763
```
762764
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:
765771
766772
```
767773
struct Inner {
768774
value: i32
769775
}
770776
771777
enum Foo {
772-
f(Inner)
778+
FirstValue(Inner)
773779
}
774780
775781
fn main() {
776-
let u = Foo::f(Inner { value: 0i32 });
777-
// or even simpler:
782+
let u = Foo::FirstValue(Inner { value: 0i32 });
783+
778784
let t = Inner { value: 0i32 };
779785
}
780786
```

0 commit comments

Comments
 (0)