diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-12-20 21:32:33 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-20 21:32:33 +0100 |
| commit | 10a7405fdefddfc341e37b9a640e4a086cf8da27 (patch) | |
| tree | 0ef1dc21b278257a880150ef093efa2e95e9ea4d | |
| parent | 0b1834d66bcfb038f817e5450aeab5873b809ea5 (diff) | |
| parent | 6bc1fe1c3a40367abf3d54253fb1a478ced4b73b (diff) | |
| download | rust-10a7405fdefddfc341e37b9a640e4a086cf8da27.tar.gz rust-10a7405fdefddfc341e37b9a640e4a086cf8da27.zip | |
Rollup merge of #134574 - lcnr:opaque-ty-hack-yeet, r=compiler-errors
next-solver: disable unnecessary hack the new solver never constrains inference variables to normalizeable aliases, so this is no longer necessary.
| -rw-r--r-- | compiler/rustc_borrowck/src/region_infer/opaque_types.rs | 13 | ||||
| -rw-r--r-- | compiler/rustc_hir_typeck/src/writeback.rs | 12 |
2 files changed, 14 insertions, 11 deletions
diff --git a/compiler/rustc_borrowck/src/region_infer/opaque_types.rs b/compiler/rustc_borrowck/src/region_infer/opaque_types.rs index 7164a129235..3e16a3ca157 100644 --- a/compiler/rustc_borrowck/src/region_infer/opaque_types.rs +++ b/compiler/rustc_borrowck/src/region_infer/opaque_types.rs @@ -134,12 +134,13 @@ impl<'tcx> RegionInferenceContext<'tcx> { // the hidden type becomes the opaque type itself. In this case, this was an opaque // usage of the opaque type and we can ignore it. This check is mirrored in typeck's // writeback. - // FIXME(-Znext-solver): This should be unnecessary with the new solver. - if let ty::Alias(ty::Opaque, alias_ty) = ty.kind() - && alias_ty.def_id == opaque_type_key.def_id.to_def_id() - && alias_ty.args == opaque_type_key.args - { - continue; + if !infcx.next_trait_solver() { + if let ty::Alias(ty::Opaque, alias_ty) = ty.kind() + && alias_ty.def_id == opaque_type_key.def_id.to_def_id() + && alias_ty.args == opaque_type_key.args + { + continue; + } } // Sometimes two opaque types are the same only after we remap the generic parameters // back to the opaque type definition. E.g. we may have `OpaqueType<X, Y>` mapped to diff --git a/compiler/rustc_hir_typeck/src/writeback.rs b/compiler/rustc_hir_typeck/src/writeback.rs index 303a07a5bf0..5612aa75aae 100644 --- a/compiler/rustc_hir_typeck/src/writeback.rs +++ b/compiler/rustc_hir_typeck/src/writeback.rs @@ -554,11 +554,13 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> { let hidden_type = self.resolve(decl.hidden_type, &decl.hidden_type.span); let opaque_type_key = self.resolve(opaque_type_key, &decl.hidden_type.span); - if let ty::Alias(ty::Opaque, alias_ty) = hidden_type.ty.kind() - && alias_ty.def_id == opaque_type_key.def_id.to_def_id() - && alias_ty.args == opaque_type_key.args - { - continue; + if !self.fcx.next_trait_solver() { + if let ty::Alias(ty::Opaque, alias_ty) = hidden_type.ty.kind() + && alias_ty.def_id == opaque_type_key.def_id.to_def_id() + && alias_ty.args == opaque_type_key.args + { + continue; + } } // Here we only detect impl trait definition conflicts when they |
