diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-07-23 13:06:56 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-23 13:06:56 +0200 |
| commit | a0676fc07a8aac2103f6bc53c5cb5b859d85df76 (patch) | |
| tree | a1ececb2cfdbe2dd26010e67f9b01b6c34f02eb3 | |
| parent | 4d6f74b450ea52f8da4cf5747c1f969ba03df25d (diff) | |
| parent | 7bca516b357f5cf596250f99353a08f65cb0456a (diff) | |
| download | rust-a0676fc07a8aac2103f6bc53c5cb5b859d85df76.tar.gz rust-a0676fc07a8aac2103f6bc53c5cb5b859d85df76.zip | |
Rollup merge of #128067 - compiler-errors:can_eq_shallow, r=lcnr
Get rid of `can_eq_shallow` ✨ r? lcnr
| -rw-r--r-- | compiler/rustc_infer/src/infer/mod.rs | 12 | ||||
| -rw-r--r-- | compiler/rustc_trait_selection/src/error_reporting/infer/note_and_explain.rs | 5 |
2 files changed, 3 insertions, 14 deletions
diff --git a/compiler/rustc_infer/src/infer/mod.rs b/compiler/rustc_infer/src/infer/mod.rs index 7fc4e36d752..3cee0a622f1 100644 --- a/compiler/rustc_infer/src/infer/mod.rs +++ b/compiler/rustc_infer/src/infer/mod.rs @@ -755,18 +755,6 @@ impl<'tcx> InferCtxt<'tcx> { .collect() } - // FIXME(-Znext-solver): Get rid of this method, it's never correct. Either that, - // or we need to process the obligations. - pub fn can_eq_shallow<T>(&self, param_env: ty::ParamEnv<'tcx>, a: T, b: T) -> bool - where - T: at::ToTrace<'tcx>, - { - let origin = &ObligationCause::dummy(); - // We're only answering whether the types could be the same, and with - // opaque types, "they can be the same", via registering a hidden type. - self.probe(|_| self.at(origin, param_env).eq(DefineOpaqueTypes::Yes, a, b).is_ok()) - } - #[instrument(skip(self), level = "debug")] pub fn sub_regions( &self, diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/note_and_explain.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/note_and_explain.rs index 1ff2fca83fa..f9110cfb3b9 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/note_and_explain.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/note_and_explain.rs @@ -12,6 +12,7 @@ use rustc_middle::{ use rustc_span::{def_id::DefId, sym, BytePos, Span, Symbol}; use crate::error_reporting::TypeErrCtxt; +use crate::infer::InferCtxtExt; impl<'tcx> TypeErrCtxt<'_, 'tcx> { pub fn note_and_explain_type_err( @@ -821,7 +822,7 @@ fn foo(&self) -> Self::T { String::new() } tcx.defaultness(item.id.owner_id) { let assoc_ty = tcx.type_of(item.id.owner_id).instantiate_identity(); - if self.infcx.can_eq_shallow(param_env, assoc_ty, found) { + if self.infcx.can_eq(param_env, assoc_ty, found) { diag.span_label( item.span, "associated type defaults can't be assumed inside the \ @@ -844,7 +845,7 @@ fn foo(&self) -> Self::T { String::new() } let assoc_ty = tcx.type_of(item.id.owner_id).instantiate_identity(); if let hir::Defaultness::Default { has_value: true } = tcx.defaultness(item.id.owner_id) - && self.infcx.can_eq_shallow(param_env, assoc_ty, found) + && self.infcx.can_eq(param_env, assoc_ty, found) { diag.span_label( item.span, |
