fn point_at_returns_when_relevant(
&self,
- err: &mut Diagnostic,
+ err: &mut DiagnosticBuilder<'tcx, ErrorGuaranteed>,
obligation: &PredicateObligation<'tcx>,
);
fn point_at_returns_when_relevant(
&self,
- err: &mut Diagnostic,
+ err: &mut DiagnosticBuilder<'tcx, ErrorGuaranteed>,
obligation: &PredicateObligation<'tcx>,
) {
match obligation.cause.code().peel_derives() {
for expr in &visitor.returns {
if let Some(returned_ty) = typeck_results.node_type_opt(expr.hir_id) {
let ty = self.resolve_vars_if_possible(returned_ty);
- err.span_label(expr.span, &format!("this returned value is of type `{}`", ty));
+ if ty.references_error() {
+ // don't print out the [type error] here
+ err.delay_as_bug();
+ } else {
+ err.span_label(
+ expr.span,
+ &format!("this returned value is of type `{}`", ty),
+ );
+ }
}
}
}