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 }
+}
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`.