Rollup merge of #114301 - compiler-errors:dont-error-on-missing-region-outlives, r=spastorino
Don't check unnecessarily that impl trait is RPIT We have this random `return_type_impl_trait` function to detect if a function returns an RPIT which is used in outlives suggestions, but removing it doesn't actually change any diagnostics. Let's just remove it. Also, suppress a spurious outlives error from a ReError. Fixes #114274
This commit is contained in:
commit
f338a1f7ee
6 changed files with 46 additions and 35 deletions
|
@ -2567,15 +2567,13 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||
None,
|
||||
);
|
||||
if let Some(infer::RelateParamBound(_, t, _)) = origin {
|
||||
let return_impl_trait =
|
||||
self.tcx.return_type_impl_trait(generic_param_scope).is_some();
|
||||
let t = self.resolve_vars_if_possible(t);
|
||||
match t.kind() {
|
||||
// We've got:
|
||||
// fn get_later<G, T>(g: G, dest: &mut T) -> impl FnOnce() + '_
|
||||
// suggest:
|
||||
// fn get_later<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a
|
||||
ty::Closure(..) | ty::Alias(ty::Opaque, ..) if return_impl_trait => {
|
||||
ty::Closure(..) | ty::Alias(ty::Opaque, ..) => {
|
||||
new_binding_suggestion(&mut err, type_param_span);
|
||||
}
|
||||
_ => {
|
||||
|
|
|
@ -942,6 +942,10 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
|
|||
generic_ty: Ty<'tcx>,
|
||||
min: ty::Region<'tcx>,
|
||||
) -> bool {
|
||||
if let ty::ReError(_) = *min {
|
||||
return true;
|
||||
}
|
||||
|
||||
match bound {
|
||||
VerifyBound::IfEq(verify_if_eq_b) => {
|
||||
let verify_if_eq_b = var_values.normalize(self.region_rels.tcx, *verify_if_eq_b);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue