File tree 4 files changed +44
-2
lines changed
4 files changed +44
-2
lines changed Original file line number Diff line number Diff line change @@ -14,4 +14,9 @@ fn main() {
14
14
} . hi ( ) {
15
15
println ! ( "yo" ) ;
16
16
}
17
+ if let true = Foo { //~ ERROR struct literals are not allowed here
18
+ x: 3
19
+ } . hi ( ) {
20
+ println ! ( "yo" ) ;
21
+ }
17
22
}
Original file line number Diff line number Diff line change @@ -14,5 +14,21 @@ LL | x: 3
14
14
LL ~ }).hi() {
15
15
|
16
16
17
- error: aborting due to previous error
17
+ error: struct literals are not allowed here
18
+ --> $DIR/struct-literal-in-if.rs:17:19
19
+ |
20
+ LL | if let true = Foo {
21
+ | ___________________^
22
+ LL | | x: 3
23
+ LL | | }.hi() {
24
+ | |_____^
25
+ |
26
+ help: surround the struct literal with parentheses
27
+ |
28
+ LL ~ if let true = (Foo {
29
+ LL | x: 3
30
+ LL ~ }).hi() {
31
+ |
32
+
33
+ error: aborting due to 2 previous errors
18
34
Original file line number Diff line number Diff line change @@ -14,4 +14,9 @@ fn main() {
14
14
} . hi ( ) {
15
15
println ! ( "yo" ) ;
16
16
}
17
+ while let true = Foo { //~ ERROR struct literals are not allowed here
18
+ x: 3
19
+ } . hi ( ) {
20
+ println ! ( "yo" ) ;
21
+ }
17
22
}
Original file line number Diff line number Diff line change @@ -14,5 +14,21 @@ LL | x: 3
14
14
LL ~ }).hi() {
15
15
|
16
16
17
- error: aborting due to previous error
17
+ error: struct literals are not allowed here
18
+ --> $DIR/struct-literal-in-while.rs:17:22
19
+ |
20
+ LL | while let true = Foo {
21
+ | ______________________^
22
+ LL | | x: 3
23
+ LL | | }.hi() {
24
+ | |_____^
25
+ |
26
+ help: surround the struct literal with parentheses
27
+ |
28
+ LL ~ while let true = (Foo {
29
+ LL | x: 3
30
+ LL ~ }).hi() {
31
+ |
32
+
33
+ error: aborting due to 2 previous errors
18
34
You can’t perform that action at this time.
0 commit comments