Introduce ReError

CC #69314
This commit is contained in:
Esteban Küber
2023-02-03 23:21:56 +00:00
parent c40919b7a7
commit 30cf7a3f51
51 changed files with 208 additions and 211 deletions

View File

@@ -134,6 +134,8 @@ pub(super) fn note_and_explain_region<'tcx>(
ty::RePlaceholder(_) => return,
ty::ReError => return,
// FIXME(#13998) RePlaceholder should probably print like
// ReFree rather than dumping Debug output on the user.
//
@@ -313,6 +315,9 @@ pub fn unexpected_hidden_region_diagnostic<'tcx>(
)
}
}
ty::ReError => {
err.delay_as_bug();
}
_ => {
// Ugh. This is a painful case: the hidden region is not one
// that we can easily summarize or explain. This can happen
@@ -2546,7 +2551,11 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
);
err.note_expected_found(&"", sup_expected, &"", sup_found);
err.emit();
if sub_region.is_error() | sup_region.is_error() {
err.delay_as_bug();
} else {
err.emit();
}
return;
}
@@ -2562,7 +2571,11 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
);
self.note_region_origin(&mut err, &sub_origin);
err.emit();
if sub_region.is_error() | sup_region.is_error() {
err.delay_as_bug();
} else {
err.emit();
}
}
/// Determine whether an error associated with the given span and definition

View File

@@ -78,7 +78,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
sub: Region<'tcx>,
sup: Region<'tcx>,
) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> {
match origin {
let mut err = match origin {
infer::Subtype(box trace) => {
let terr = TypeError::RegionsDoesNotOutlive(sup, sub);
let mut err = self.report_and_explain_type_error(trace, terr);
@@ -299,7 +299,11 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
);
err
}
};
if sub.is_error() || sup.is_error() {
err.delay_as_bug();
}
err
}
pub fn suggest_copy_trait_method_bounds(