File tree Expand file tree Collapse file tree 4 files changed +44
-2
lines changed Expand file tree Collapse file tree 4 files changed +44
-2
lines changed Original file line number Diff line number Diff line change @@ -14,4 +14,9 @@ fn main() {
1414 } . hi ( ) {
1515 println ! ( "yo" ) ;
1616 }
17+ if let true = Foo { //~ ERROR struct literals are not allowed here
18+ x: 3
19+ } . hi ( ) {
20+ println ! ( "yo" ) ;
21+ }
1722}
Original file line number Diff line number Diff line change @@ -14,5 +14,21 @@ LL | x: 3
1414LL ~ }).hi() {
1515 |
1616
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
1834
Original file line number Diff line number Diff line change @@ -14,4 +14,9 @@ fn main() {
1414 } . hi ( ) {
1515 println ! ( "yo" ) ;
1616 }
17+ while let true = Foo { //~ ERROR struct literals are not allowed here
18+ x: 3
19+ } . hi ( ) {
20+ println ! ( "yo" ) ;
21+ }
1722}
Original file line number Diff line number Diff line change @@ -14,5 +14,21 @@ LL | x: 3
1414LL ~ }).hi() {
1515 |
1616
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
1834
You can’t perform that action at this time.
0 commit comments