Do not suggest using ! with break

This commit is contained in:
Esteban Küber 2019-08-06 17:24:39 -07:00
parent c076392143
commit 799b13ada5
2 changed files with 2 additions and 4 deletions

View file

@ -559,6 +559,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
ty::Char => "'a'",
ty::Int(_) | ty::Uint(_) => "42",
ty::Float(_) => "3.14159",
ty::Error | ty::Never => return,
_ => "value",
});
err.span_suggestion(expr.span, msg, sugg, Applicability::HasPlaceholders);

View file

@ -90,10 +90,7 @@ error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:4:31
|
LL | let val: ! = loop { break break; };
| ^^^^^
| |
| expected !, found ()
| help: give it a value of the expected type: `break value`
| ^^^^^ expected !, found ()
|
= note: expected type `!`
found type `()`