Co-authored-by: Camelid <camelidcamel@gmail.com>
b
//~^ ERROR mismatched types
};
b
//~^ ERROR mismatched types
};
+ let val = if true {
+ *a
+ } else if true {
+ //~^ ERROR incompatible types
+ b
+ } else {
+ &0
+ };
| expected `i32`, found `&{integer}`
| help: consider dereferencing the borrow: `*b`
| expected `i32`, found `&{integer}`
| help: consider dereferencing the borrow: `*b`
-error: aborting due to 12 previous errors
+error[E0308]: `if` and `else` have incompatible types
+ --> $DIR/deref-suggestion.rs:68:12
+ |
+LL | let val = if true {
+ | _______________-
+LL | | *a
+ | | -- expected because of this
+LL | | } else if true {
+ | |____________^
+LL | ||
+LL | || b
+LL | || } else {
+LL | || &0
+LL | || };
+ | || ^
+ | ||_____|
+ | |______`if` and `else` have incompatible types
+ | expected `i32`, found `&{integer}`
+ |
+help: consider dereferencing the borrow
+ |
+LL | } else *if true {
+LL |
+LL | b
+LL | } else {
+LL | &0
+LL | };
+ |
+
+error: aborting due to 13 previous errors
For more information about this error, try `rustc --explain E0308`.
For more information about this error, try `rustc --explain E0308`.