Description
This fails (as expected):
fn foo() -> String {
1 + 2
}
However, the help message is wrong:
error[E0308]: mismatched types
--> src/lib.rs:2:5
|
1 | fn foo() -> String {
| ------ expected `std::string::String` because of return type
2 | 1 + 2
| ^^^^^
| |
| expected struct `std::string::String`, found integer
| help: try using a conversion method: `1 + 2.to_string()`
|
= note: expected type `std::string::String`
found type `{integer}`
It should suggest (1 + 2).to_string()
instead.
Rust version: 1.38.0 (stable)