rustc_error: make ErrorReported impossible to construct
There are a few places were we have to construct it, though, and a few places that are more invasive to change. To do this, we create a constructor with a long obvious name.
This commit is contained in:
parent
461e807801
commit
bb8d4307eb
104 changed files with 705 additions and 550 deletions
|
@ -231,8 +231,8 @@ fn do_normalize_predicates<'tcx>(
|
|||
match fully_normalize(&infcx, fulfill_cx, cause, elaborated_env, predicates) {
|
||||
Ok(predicates) => predicates,
|
||||
Err(errors) => {
|
||||
infcx.report_fulfillment_errors(&errors, None, false);
|
||||
return Err(ErrorGuaranteed);
|
||||
let reported = infcx.report_fulfillment_errors(&errors, None, false);
|
||||
return Err(reported);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -258,13 +258,15 @@ fn do_normalize_predicates<'tcx>(
|
|||
// represents a legitimate failure due to some kind of
|
||||
// unconstrained variable, and it seems better not to ICE,
|
||||
// all things considered.
|
||||
tcx.sess.span_err(span, &fixup_err.to_string());
|
||||
return Err(ErrorGuaranteed);
|
||||
let reported = tcx.sess.span_err(span, &fixup_err.to_string());
|
||||
return Err(reported);
|
||||
}
|
||||
};
|
||||
if predicates.needs_infer() {
|
||||
tcx.sess.delay_span_bug(span, "encountered inference variables after `fully_resolve`");
|
||||
Err(ErrorGuaranteed)
|
||||
let reported = tcx
|
||||
.sess
|
||||
.delay_span_bug(span, "encountered inference variables after `fully_resolve`");
|
||||
Err(reported)
|
||||
} else {
|
||||
Ok(predicates)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue