about summary refs log tree commit diff
path: root/src/test/ui/expr/if
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/test/ui/expr/if
parent8c71b67159e1a3d0863caf28b7cefee0160cb927 (diff)
do not reverse the expected type and found type for ObligationCauseCode of IfExpressionWithNoElse
this will fix #102397
Diffstat (limited to 'src/test/ui/expr/if')
-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
4 files changed, 4 insertions, 4 deletions
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