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_infer/src/infer | |
| 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_infer/src/infer')
| -rw-r--r-- | compiler/rustc_infer/src/infer/opaque_types.rs | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/compiler/rustc_infer/src/infer/opaque_types.rs b/compiler/rustc_infer/src/infer/opaque_types.rs index 1c3a5c36076..09df93fcc2f 100644 --- a/compiler/rustc_infer/src/infer/opaque_types.rs +++ b/compiler/rustc_infer/src/infer/opaque_types.rs @@ -145,7 +145,25 @@ impl<'tcx> InferCtxt<'tcx> { return None; } } - DefiningAnchor::Bubble => {} + DefiningAnchor::Bubble => { + if let ty::Alias(ty::Opaque, _) = b.kind() { + // In bubble mode we don't know which of the two opaque types is supposed to have the other + // as a hidden type (both, none or either one of them could be in its defining scope). + let predicate = ty::PredicateKind::AliasRelate( + a.into(), + b.into(), + ty::AliasRelationDirection::Equate, + ); + let obligation = traits::Obligation::new( + self.tcx, + cause.clone(), + param_env, + predicate, + ); + let obligations = vec![obligation]; + return Some(Ok(InferOk { value: (), obligations })); + } + } DefiningAnchor::Error => return None, }; if let ty::Alias(ty::Opaque, ty::AliasTy { def_id: b_def_id, .. }) = *b.kind() { |
