Add additional test
Co-authored-by: Camelid <camelidcamel@gmail.com>
This commit is contained in:
parent
e603f994b1
commit
08879449c6
2 changed files with 38 additions and 1 deletions
|
@ -63,4 +63,12 @@ fn main() {
|
|||
b
|
||||
//~^ ERROR mismatched types
|
||||
};
|
||||
let val = if true {
|
||||
*a
|
||||
} else if true {
|
||||
//~^ ERROR incompatible types
|
||||
b
|
||||
} else {
|
||||
&0
|
||||
};
|
||||
}
|
||||
|
|
|
@ -107,6 +107,35 @@ LL | 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`.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue