diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2023-08-07 14:49:44 +0000 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2023-09-11 16:53:39 +0000 |
| commit | 930affa39d7902e57a830e328754ce546c992608 (patch) | |
| tree | 2d69116876c180f9907757a980588789ec1c3d62 /compiler/rustc_trait_selection/src/traits/fulfill.rs | |
| parent | ad4dd759d84b02ed8bf0508ae54d9638c139dc5c (diff) | |
| download | rust-930affa39d7902e57a830e328754ce546c992608.tar.gz rust-930affa39d7902e57a830e328754ce546c992608.zip | |
Bubble up opaque <eq> opaque operations instead of picking an order
Diffstat (limited to 'compiler/rustc_trait_selection/src/traits/fulfill.rs')
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/fulfill.rs | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/fulfill.rs b/compiler/rustc_trait_selection/src/traits/fulfill.rs index 3ebf1246a41..f1779451bc5 100644 --- a/compiler/rustc_trait_selection/src/traits/fulfill.rs +++ b/compiler/rustc_trait_selection/src/traits/fulfill.rs @@ -6,6 +6,7 @@ use rustc_infer::infer::DefineOpaqueTypes; use rustc_infer::traits::ProjectionCacheKey; use rustc_infer::traits::{PolyTraitObligation, SelectionError, TraitEngine}; use rustc_middle::mir::interpret::ErrorHandled; +use rustc_middle::traits::DefiningAnchor; use rustc_middle::ty::abstract_const::NotConstEvaluatable; use rustc_middle::ty::error::{ExpectedFound, TypeError}; use rustc_middle::ty::GenericArgsRef; @@ -623,9 +624,27 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> { } } ty::PredicateKind::Ambiguous => ProcessResult::Unchanged, - ty::PredicateKind::AliasRelate(..) => { - bug!("AliasRelate is only used for new solver") + ty::PredicateKind::AliasRelate(..) + if matches!(self.selcx.infcx.defining_use_anchor, DefiningAnchor::Bubble) => + { + ProcessResult::Unchanged } + ty::PredicateKind::AliasRelate(a, b, relate) => match relate { + ty::AliasRelationDirection::Equate => match self + .selcx + .infcx + .at(&obligation.cause, obligation.param_env) + .eq(DefineOpaqueTypes::Yes, a, b) + { + Ok(inf_ok) => ProcessResult::Changed(mk_pending(inf_ok.into_obligations())), + Err(_) => ProcessResult::Error(FulfillmentErrorCode::CodeSelectionError( + SelectionError::Unimplemented, + )), + }, + ty::AliasRelationDirection::Subtype => { + bug!("AliasRelate with subtyping is only used for new solver") + } + }, ty::PredicateKind::Clause(ty::ClauseKind::ConstArgHasType(ct, ty)) => { match self.selcx.infcx.at(&obligation.cause, obligation.param_env).eq( DefineOpaqueTypes::No, |
