diff --git a/src/librustc_typeck/check/expr.rs b/src/librustc_typeck/check/expr.rs index c567741be398..5c859b9fd325 100644 --- a/src/librustc_typeck/check/expr.rs +++ b/src/librustc_typeck/check/expr.rs @@ -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); diff --git a/src/test/ui/loops/loop-break-value.stderr b/src/test/ui/loops/loop-break-value.stderr index 7310790b880c..fef5b5873068 100644 --- a/src/test/ui/loops/loop-break-value.stderr +++ b/src/test/ui/loops/loop-break-value.stderr @@ -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 `()`