diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
commit | 218caa410aa38c29984be31a5229b9fa717560ee (patch) | |
tree | c54bd55eeb6e4c508940a30e94c0032fbd45d677 /compiler/rustc_infer/src/infer/nll_relate | |
parent | Releasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_infer/src/infer/nll_relate')
-rw-r--r-- | compiler/rustc_infer/src/infer/nll_relate/mod.rs | 48 |
1 files changed, 27 insertions, 21 deletions
diff --git a/compiler/rustc_infer/src/infer/nll_relate/mod.rs b/compiler/rustc_infer/src/infer/nll_relate/mod.rs index f6bc4db0d..f235cb5ab 100644 --- a/compiler/rustc_infer/src/infer/nll_relate/mod.rs +++ b/compiler/rustc_infer/src/infer/nll_relate/mod.rs @@ -275,13 +275,13 @@ where /// `ProjectionEq(projection = ?U)`, `ProjectionEq(other_projection = ?U)`. fn relate_projection_ty( &mut self, - projection_ty: ty::ProjectionTy<'tcx>, + projection_ty: ty::AliasTy<'tcx>, value_ty: Ty<'tcx>, ) -> Ty<'tcx> { use rustc_span::DUMMY_SP; match *value_ty.kind() { - ty::Projection(other_projection_ty) => { + ty::Alias(ty::Projection, other_projection_ty) => { let var = self.infcx.next_ty_var(TypeVariableOrigin { kind: TypeVariableOriginKind::MiscVariable, span: DUMMY_SP, @@ -335,7 +335,9 @@ where return Ok(value_ty); } - ty::Projection(projection_ty) if D::normalization() == NormalizationStrategy::Lazy => { + ty::Alias(ty::Projection, projection_ty) + if D::normalization() == NormalizationStrategy::Lazy => + { return Ok(self.relate_projection_ty(projection_ty, self.infcx.tcx.mk_ty_var(vid))); } @@ -406,8 +408,8 @@ where } }; let (a, b) = match (a.kind(), b.kind()) { - (&ty::Opaque(..), _) => (a, generalize(b, false)?), - (_, &ty::Opaque(..)) => (generalize(a, true)?, b), + (&ty::Alias(ty::Opaque, ..), _) => (a, generalize(b, false)?), + (_, &ty::Alias(ty::Opaque, ..)) => (generalize(a, true)?, b), _ => unreachable!(), }; let cause = ObligationCause::dummy_with_span(self.delegate.span()); @@ -437,7 +439,7 @@ trait VidValuePair<'tcx>: Debug { fn value_ty(&self) -> Ty<'tcx>; /// Extract the scopes that apply to whichever side of the tuple - /// the vid was found on. See the comment where this is called + /// the vid was found on. See the comment where this is called /// for more details on why we want them. fn vid_scopes<'r, D: TypeRelatingDelegate<'tcx>>( &self, @@ -608,26 +610,30 @@ where (&ty::Infer(ty::TyVar(vid)), _) => self.relate_ty_var((vid, b)), - (&ty::Opaque(a_def_id, _), &ty::Opaque(b_def_id, _)) if a_def_id == b_def_id => { - infcx.super_combine_tys(self, a, b).or_else(|err| { - self.tcx().sess.delay_span_bug( - self.delegate.span(), - "failure to relate an opaque to itself should result in an error later on", - ); - if a_def_id.is_local() { self.relate_opaques(a, b) } else { Err(err) } - }) - } - (&ty::Opaque(did, ..), _) | (_, &ty::Opaque(did, ..)) if did.is_local() => { + ( + &ty::Alias(ty::Opaque, ty::AliasTy { def_id: a_def_id, .. }), + &ty::Alias(ty::Opaque, ty::AliasTy { def_id: b_def_id, .. }), + ) if a_def_id == b_def_id => infcx.super_combine_tys(self, a, b).or_else(|err| { + self.tcx().sess.delay_span_bug( + self.delegate.span(), + "failure to relate an opaque to itself should result in an error later on", + ); + if a_def_id.is_local() { self.relate_opaques(a, b) } else { Err(err) } + }), + (&ty::Alias(ty::Opaque, ty::AliasTy { def_id, .. }), _) + | (_, &ty::Alias(ty::Opaque, ty::AliasTy { def_id, .. })) + if def_id.is_local() => + { self.relate_opaques(a, b) } - (&ty::Projection(projection_ty), _) + (&ty::Alias(ty::Projection, projection_ty), _) if D::normalization() == NormalizationStrategy::Lazy => { Ok(self.relate_projection_ty(projection_ty, b)) } - (_, &ty::Projection(projection_ty)) + (_, &ty::Alias(ty::Projection, projection_ty)) if D::normalization() == NormalizationStrategy::Lazy => { Ok(self.relate_projection_ty(projection_ty, a)) @@ -825,7 +831,7 @@ where /// (these are not explicitly present in the ty representation right /// now). This visitor handles that: it descends the type, tracking /// binder depth, and finds late-bound regions targeting the -/// `for<..`>. For each of those, it creates an entry in +/// `for<..`>. For each of those, it creates an entry in /// `bound_region_scope`. struct ScopeInstantiator<'me, 'tcx> { next_region: &'me mut dyn FnMut(ty::BoundRegion) -> ty::Region<'tcx>, @@ -843,7 +849,7 @@ impl<'me, 'tcx> TypeVisitor<'tcx> for ScopeInstantiator<'me, 'tcx> { t.super_visit_with(self); self.target_index.shift_out(1); - ControlFlow::CONTINUE + ControlFlow::Continue(()) } fn visit_region(&mut self, r: ty::Region<'tcx>) -> ControlFlow<Self::BreakTy> { @@ -857,7 +863,7 @@ impl<'me, 'tcx> TypeVisitor<'tcx> for ScopeInstantiator<'me, 'tcx> { _ => {} } - ControlFlow::CONTINUE + ControlFlow::Continue(()) } } |