Use a ty::Error instead of patching up a type after erroring

This commit is contained in:
Oli Scherer 2024-01-09 15:49:31 +00:00
parent 9273d63f07
commit ba27e22f67

View File

@ -603,6 +603,8 @@ fn infer_placeholder_type<'a>(
}
err.emit();
// diagnostic stashing loses the information of whether something is a hard error.
Ty::new_error_with_message(tcx, span, "ItemNoType is a hard error")
}
None => {
let mut diag = bad_placeholder(tcx, vec![span], kind);
@ -623,15 +625,9 @@ fn infer_placeholder_type<'a>(
}
}
diag.emit();
Ty::new_error(tcx, diag.emit())
}
}
// Typeck doesn't expect erased regions to be returned from `type_of`.
tcx.fold_regions(ty, |r, _| match *r {
ty::ReErased => tcx.lifetimes.re_static,
_ => r,
})
}
fn check_feature_inherent_assoc_ty(tcx: TyCtxt<'_>, span: Span) {