about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/point-to-type-err-cause-on-impl-trait-return.rs29
-rw-r--r--src/test/ui/point-to-type-err-cause-on-impl-trait-return.stderr48
2 files changed, 76 insertions, 1 deletions
diff --git a/src/test/ui/point-to-type-err-cause-on-impl-trait-return.rs b/src/test/ui/point-to-type-err-cause-on-impl-trait-return.rs
index d416db628c0..58109be447e 100644
--- a/src/test/ui/point-to-type-err-cause-on-impl-trait-return.rs
+++ b/src/test/ui/point-to-type-err-cause-on-impl-trait-return.rs
@@ -33,4 +33,33 @@ fn qux() -> impl std::fmt::Display {
     }
 }
 
+fn bat() -> impl std::fmt::Display {
+    match 13 {
+        0 => return 0i32,
+        _ => 1u32,
+        //~^ ERROR mismatched types
+    }
+}
+
+fn can() -> impl std::fmt::Display {
+    match 13 {
+    //~^ ERROR mismatched types
+        0 => return 0i32,
+        1 => 1u32,
+        _ => 2u32,
+    }
+}
+
+fn cat() -> impl std::fmt::Display {
+    match 13 {
+        0 => {
+            return 0i32;
+        }
+        _ => {
+            1u32
+            //~^ ERROR mismatched types
+        }
+    }
+}
+
 fn main() {}
diff --git a/src/test/ui/point-to-type-err-cause-on-impl-trait-return.stderr b/src/test/ui/point-to-type-err-cause-on-impl-trait-return.stderr
index 47644d66d1a..314ff84ae3c 100644
--- a/src/test/ui/point-to-type-err-cause-on-impl-trait-return.stderr
+++ b/src/test/ui/point-to-type-err-cause-on-impl-trait-return.stderr
@@ -59,6 +59,52 @@ LL | |     }
    = note: expected type `i32`
               found type `u32`
 
-error: aborting due to 4 previous errors
+error[E0308]: mismatched types
+  --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:39:14
+   |
+LL | fn bat() -> impl std::fmt::Display {
+   |             ---------------------- expected because this return type...
+LL |     match 13 {
+LL |         0 => return 0i32,
+   |                     ---- ...is found to be `i32` here
+LL |         _ => 1u32,
+   |              ^^^^ expected i32, found u32
+   |
+   = note: expected type `i32`
+              found type `u32`
+
+error[E0308]: mismatched types
+  --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:45:5
+   |
+LL |   fn can() -> impl std::fmt::Display {
+   |               ---------------------- expected because this return type...
+LL | /     match 13 {
+LL | |
+LL | |         0 => return 0i32,
+   | |                     ---- ...is found to be `i32` here
+LL | |         1 => 1u32,
+LL | |         _ => 2u32,
+LL | |     }
+   | |_____^ expected i32, found u32
+   |
+   = note: expected type `i32`
+              found type `u32`
+
+error[E0308]: mismatched types
+  --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:59:13
+   |
+LL | fn cat() -> impl std::fmt::Display {
+   |             ---------------------- expected because this return type...
+...
+LL |             return 0i32;
+   |                    ---- ...is found to be `i32` here
+...
+LL |             1u32
+   |             ^^^^ expected i32, found u32
+   |
+   = note: expected type `i32`
+              found type `u32`
+
+error: aborting due to 7 previous errors
 
 For more information about this error, try `rustc --explain E0308`.