From 0b9c589beb81499e623d76a142f0ee68910e138c Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Tue, 26 Mar 2019 14:57:17 +0100 Subject: [PATCH] adjust assignment-in-if test accordingly. --- .../ui/type/type-check/assignment-in-if.rs | 9 ++++++-- .../type/type-check/assignment-in-if.stderr | 23 +++++++++++++++---- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/test/ui/type/type-check/assignment-in-if.rs b/src/test/ui/type/type-check/assignment-in-if.rs index 232b0a00b30..77b122b0a79 100644 --- a/src/test/ui/type/type-check/assignment-in-if.rs +++ b/src/test/ui/type/type-check/assignment-in-if.rs @@ -31,8 +31,13 @@ fn main() { //~^ ERROR mismatched types println!("{}", x); } - if (if true { x = 4 } else { x = 5 }) { - //~^ ERROR mismatched types + if ( + if true { + x = 4 //~ ERROR mismatched types + } else { + x = 5 //~ ERROR mismatched types + } + ) { println!("{}", x); } } diff --git a/src/test/ui/type/type-check/assignment-in-if.stderr b/src/test/ui/type/type-check/assignment-in-if.stderr index 403f7b4f7ae..87b8d17c21b 100644 --- a/src/test/ui/type/type-check/assignment-in-if.stderr +++ b/src/test/ui/type/type-check/assignment-in-if.stderr @@ -47,14 +47,29 @@ LL | if 3 = x { found type `()` error[E0308]: mismatched types - --> $DIR/assignment-in-if.rs:34:8 + --> $DIR/assignment-in-if.rs:36:13 | -LL | if (if true { x = 4 } else { x = 5 }) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected bool, found () +LL | x = 4 + | ^^^^^ + | | + | expected bool, found () + | help: try comparing for equality: `x == 4` | = note: expected type `bool` found type `()` -error: aborting due to 5 previous errors +error[E0308]: mismatched types + --> $DIR/assignment-in-if.rs:38:13 + | +LL | x = 5 + | ^^^^^ + | | + | expected bool, found () + | help: try comparing for equality: `x == 5` + | + = note: expected type `bool` + found type `()` + +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0308`.