File tree Expand file tree Collapse file tree 2 files changed +26
-6
lines changed
src/test/ui/type/type-check Expand file tree Collapse file tree 2 files changed +26
-6
lines changed Original file line number Diff line number Diff line change @@ -31,8 +31,13 @@ fn main() {
3131 //~^ ERROR mismatched types
3232 println ! ( "{}" , x) ;
3333 }
34- if ( if true { x = 4 } else { x = 5 } ) {
35- //~^ ERROR mismatched types
34+ if (
35+ if true {
36+ x = 4 //~ ERROR mismatched types
37+ } else {
38+ x = 5 //~ ERROR mismatched types
39+ }
40+ ) {
3641 println ! ( "{}" , x) ;
3742 }
3843}
Original file line number Diff line number Diff line change @@ -47,14 +47,29 @@ LL | if 3 = x {
4747 found type `()`
4848
4949error[E0308]: mismatched types
50- --> $DIR/assignment-in-if.rs:34:8
50+ --> $DIR/assignment-in-if.rs:36:13
5151 |
52- LL | if (if true { x = 4 } else { x = 5 }) {
53- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected bool, found ()
52+ LL | x = 4
53+ | ^^^^^
54+ | |
55+ | expected bool, found ()
56+ | help: try comparing for equality: `x == 4`
5457 |
5558 = note: expected type `bool`
5659 found type `()`
5760
58- error: aborting due to 5 previous errors
61+ error[E0308]: mismatched types
62+ --> $DIR/assignment-in-if.rs:38:13
63+ |
64+ LL | x = 5
65+ | ^^^^^
66+ | |
67+ | expected bool, found ()
68+ | help: try comparing for equality: `x == 5`
69+ |
70+ = note: expected type `bool`
71+ found type `()`
72+
73+ error: aborting due to 6 previous errors
5974
6075For more information about this error, try `rustc --explain E0308`.
You can’t perform that action at this time.
0 commit comments