1
Fork 0

Auto merge of #95758 - compiler-errors:issue-54771, r=estebank

Only suggest removing semicolon when expression is compatible with `impl Trait`

https://github.com/rust-lang/rust/issues/54771#issuecomment-476423690
> It still needs checking that the last statement's expr can actually conform to the trait, but the naïve behavior is there.

Only suggest removing a semicolon when the type behind the semicolon actually implements the trait in an RPIT `-> impl Trait`. Also upgrade the label that suggests removing the semicolon to a suggestion (should it be verbose?).

cc #54771
This commit is contained in:
bors 2022-04-11 08:31:37 +00:00
commit d00e77078c
15 changed files with 97 additions and 32 deletions

View file

@ -936,7 +936,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
} else {
err.span_suggestion_short(
span_semi,
"consider removing this semicolon",
"remove this semicolon",
String::new(),
Applicability::MachineApplicable,
);