]> git.lizzy.rs Git - rust.git/commitdiff
Add more test cases to tests/ui/issues/issue-92741.rs
authorCastilloDel <delcastillodelarosadaniel@gmail.com>
Mon, 6 Feb 2023 14:30:29 +0000 (15:30 +0100)
committerCastilloDel <delcastillodelarosadaniel@gmail.com>
Mon, 6 Feb 2023 14:30:29 +0000 (15:30 +0100)
tests/ui/issues/issue-92741.rs
tests/ui/issues/issue-92741.stderr

index c42d4338fc10508711eae2730d2feb867e03f54f..4e18918c1cf0992205270223fe2f3c9df1ebdeb1 100644 (file)
@@ -4,3 +4,13 @@ fn foo() -> bool {
     mut
     if true { true } else { false }
 }
+
+fn bar() -> bool {
+    &  //~ ERROR 9:5: 10:40: mismatched types [E0308]
+    mut if true { true } else { false }
+}
+
+fn baz() -> bool {
+    & mut //~ ERROR 14:5: 15:36: mismatched types [E0308]
+    if true { true } else { false }
+}
index 9459757d38fe70a63258b07a7278077c7fbb0492..7716a10cde0cd7d3f2e923b5c3d0c6c6ff634e2e 100644 (file)
@@ -14,6 +14,36 @@ LL -     &
 LL -     mut
    |
 
-error: aborting due to previous error
+error[E0308]: mismatched types
+  --> $DIR/issue-92741.rs:9:5
+   |
+LL |   fn bar() -> bool {
+   |               ---- expected `bool` because of return type
+LL | /     &
+LL | |     mut if true { true } else { false }
+   | |_______________________________________^ expected `bool`, found `&mut bool`
+   |
+help: consider removing the borrow
+   |
+LL -     &
+LL -     mut if true { true } else { false }
+LL +     if true { true } else { false }
+   |
+
+error[E0308]: mismatched types
+  --> $DIR/issue-92741.rs:14:5
+   |
+LL |   fn baz() -> bool {
+   |               ---- expected `bool` because of return type
+LL | /     & mut
+LL | |     if true { true } else { false }
+   | |___________________________________^ expected `bool`, found `&mut bool`
+   |
+help: consider removing the borrow
+   |
+LL -     & mut
+   |
+
+error: aborting due to 3 previous errors
 
 For more information about this error, try `rustc --explain E0308`.