Closed
Description
Consider this case
fn main() {
let x = {
println!("foo");
"bar";
};
println!("{}",x)
}
this results in the type checking error.
error[E0277]: the trait bound `(): std::fmt::Display` is not satisfied
--> src/main.rs:8:19
|
8 | println!("{}",x)
| ^ `()` cannot be formatted with the default formatter; try using `:?` instead if you are using a format string
|
= help: the trait `std::fmt::Display` is not implemented for `()`
= note: required by `std::fmt::Display::fmt`
when the actual error is the trailing semicolon in "bar";
This is similar to #30497 but that handles the case of a function type signature not an assignment.
@Manishearth mentioned it might be easiest to introduce a lint. Looking for mentorship on contributing a fix.
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsCategory: An issue proposing an enhancement or a PR with one.Diagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint; hard to understand for new users.Relevant to the compiler team, which will review and decide on the PR/issue.