about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorYiming Lei <yiming.lei@futurewei.com>2022-10-05 14:00:51 -0700
committerYiming Lei <yiming.lei@futurewei.com>2022-10-05 14:00:51 -0700
commit0501d615bb1484fbbd6e2035cff4c3c44e94f10d (patch)
treefeb4f987b352e738f495366b9557362de4e7c7a2 /src
parent8c71b67159e1a3d0863caf28b7cefee0160cb927 (diff)
downloadrust-0501d615bb1484fbbd6e2035cff4c3c44e94f10d.tar.gz
rust-0501d615bb1484fbbd6e2035cff4c3c44e94f10d.zip
do not reverse the expected type and found type for ObligationCauseCode of IfExpressionWithNoElse
this will fix #102397
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/async-await/issue-66387-if-without-else.stderr2
-rw-r--r--src/test/ui/consts/control-flow/issue-50577.stderr2
-rw-r--r--src/test/ui/expr/if/if-without-else-result.rs2
-rw-r--r--src/test/ui/expr/if/if-without-else-result.stderr2
-rw-r--r--src/test/ui/expr/if/issue-4201.rs2
-rw-r--r--src/test/ui/expr/if/issue-4201.stderr2
-rw-r--r--src/test/ui/issues/issue-19991.rs2
-rw-r--r--src/test/ui/issues/issue-19991.stderr2
8 files changed, 8 insertions, 8 deletions
diff --git a/src/test/ui/async-await/issue-66387-if-without-else.stderr b/src/test/ui/async-await/issue-66387-if-without-else.stderr
index e8e2a48983c..8155fcb56b6 100644
--- a/src/test/ui/async-await/issue-66387-if-without-else.stderr
+++ b/src/test/ui/async-await/issue-66387-if-without-else.stderr
@@ -4,7 +4,7 @@ error[E0317]: `if` may be missing an `else` clause
 LL | /     if true {
 LL | |         return 0;
 LL | |     }
-   | |_____^ expected `()`, found `i32`
+   | |_____^ expected `i32`, found `()`
    |
    = note: `if` expressions without `else` evaluate to `()`
    = help: consider adding an `else` block that evaluates to the expected type
diff --git a/src/test/ui/consts/control-flow/issue-50577.stderr b/src/test/ui/consts/control-flow/issue-50577.stderr
index b6e73f889ad..a931c89f47e 100644
--- a/src/test/ui/consts/control-flow/issue-50577.stderr
+++ b/src/test/ui/consts/control-flow/issue-50577.stderr
@@ -2,7 +2,7 @@ error[E0317]: `if` may be missing an `else` clause
   --> $DIR/issue-50577.rs:3:16
    |
 LL |         Drop = assert_eq!(1, 1),
-   |                ^^^^^^^^^^^^^^^^ expected `()`, found `isize`
+   |                ^^^^^^^^^^^^^^^^ expected `isize`, found `()`
    |
    = note: `if` expressions without `else` evaluate to `()`
    = help: consider adding an `else` block that evaluates to the expected type
diff --git a/src/test/ui/expr/if/if-without-else-result.rs b/src/test/ui/expr/if/if-without-else-result.rs
index cf84a99e53f..95604758a6b 100644
--- a/src/test/ui/expr/if/if-without-else-result.rs
+++ b/src/test/ui/expr/if/if-without-else-result.rs
@@ -1,6 +1,6 @@
 fn main() {
     let a = if true { true };
     //~^ ERROR `if` may be missing an `else` clause [E0317]
-    //~| expected `()`, found `bool`
+    //~| expected `bool`, found `()`
     println!("{}", a);
 }
diff --git a/src/test/ui/expr/if/if-without-else-result.stderr b/src/test/ui/expr/if/if-without-else-result.stderr
index 821635d3768..317faf7c619 100644
--- a/src/test/ui/expr/if/if-without-else-result.stderr
+++ b/src/test/ui/expr/if/if-without-else-result.stderr
@@ -5,7 +5,7 @@ LL |     let a = if true { true };
    |             ^^^^^^^^^^----^^
    |             |         |
    |             |         found here
-   |             expected `()`, found `bool`
+   |             expected `bool`, found `()`
    |
    = note: `if` expressions without `else` evaluate to `()`
    = help: consider adding an `else` block that evaluates to the expected type
diff --git a/src/test/ui/expr/if/issue-4201.rs b/src/test/ui/expr/if/issue-4201.rs
index 1f292229fd6..59c465b9e14 100644
--- a/src/test/ui/expr/if/issue-4201.rs
+++ b/src/test/ui/expr/if/issue-4201.rs
@@ -3,7 +3,7 @@ fn main() {
         0
     } else if false {
 //~^ ERROR `if` may be missing an `else` clause
-//~| expected `()`, found integer
+//~| expected integer, found `()`
         1
     };
 }
diff --git a/src/test/ui/expr/if/issue-4201.stderr b/src/test/ui/expr/if/issue-4201.stderr
index bc638ddf55b..612fe77642c 100644
--- a/src/test/ui/expr/if/issue-4201.stderr
+++ b/src/test/ui/expr/if/issue-4201.stderr
@@ -8,7 +8,7 @@ LL | |
 LL | |         1
    | |         - found here
 LL | |     };
-   | |_____^ expected `()`, found integer
+   | |_____^ expected integer, found `()`
    |
    = note: `if` expressions without `else` evaluate to `()`
    = help: consider adding an `else` block that evaluates to the expected type
diff --git a/src/test/ui/issues/issue-19991.rs b/src/test/ui/issues/issue-19991.rs
index 1f3b73f96d8..dd0efa972ba 100644
--- a/src/test/ui/issues/issue-19991.rs
+++ b/src/test/ui/issues/issue-19991.rs
@@ -3,7 +3,7 @@
 
 fn main() {
     if let Some(homura) = Some("madoka") { //~  ERROR missing an `else` clause
-                                           //~| expected `()`, found integer
+                                           //~| expected integer, found `()`
         765
     };
 }
diff --git a/src/test/ui/issues/issue-19991.stderr b/src/test/ui/issues/issue-19991.stderr
index 6e92be87a02..57b0882b636 100644
--- a/src/test/ui/issues/issue-19991.stderr
+++ b/src/test/ui/issues/issue-19991.stderr
@@ -6,7 +6,7 @@ LL | |
 LL | |         765
    | |         --- found here
 LL | |     };
-   | |_____^ expected `()`, found integer
+   | |_____^ expected integer, found `()`
    |
    = note: `if` expressions without `else` evaluate to `()`
    = help: consider adding an `else` block that evaluates to the expected type