Skip to content

Commit 7bca516

Browse files
Get rid of can_eq_shallow
1 parent 20f23ab commit 7bca516

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

compiler/rustc_infer/src/infer/mod.rs

-12
Original file line numberDiff line numberDiff line change
@@ -755,18 +755,6 @@ impl<'tcx> InferCtxt<'tcx> {
755755
.collect()
756756
}
757757

758-
// FIXME(-Znext-solver): Get rid of this method, it's never correct. Either that,
759-
// or we need to process the obligations.
760-
pub fn can_eq_shallow<T>(&self, param_env: ty::ParamEnv<'tcx>, a: T, b: T) -> bool
761-
where
762-
T: at::ToTrace<'tcx>,
763-
{
764-
let origin = &ObligationCause::dummy();
765-
// We're only answering whether the types could be the same, and with
766-
// opaque types, "they can be the same", via registering a hidden type.
767-
self.probe(|_| self.at(origin, param_env).eq(DefineOpaqueTypes::Yes, a, b).is_ok())
768-
}
769-
770758
#[instrument(skip(self), level = "debug")]
771759
pub fn sub_regions(
772760
&self,

compiler/rustc_trait_selection/src/error_reporting/infer/note_and_explain.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use rustc_middle::{
1212
use rustc_span::{def_id::DefId, sym, BytePos, Span, Symbol};
1313

1414
use crate::error_reporting::TypeErrCtxt;
15+
use crate::infer::InferCtxtExt;
1516

1617
impl<'tcx> TypeErrCtxt<'_, 'tcx> {
1718
pub fn note_and_explain_type_err(
@@ -821,7 +822,7 @@ fn foo(&self) -> Self::T { String::new() }
821822
tcx.defaultness(item.id.owner_id)
822823
{
823824
let assoc_ty = tcx.type_of(item.id.owner_id).instantiate_identity();
824-
if self.infcx.can_eq_shallow(param_env, assoc_ty, found) {
825+
if self.infcx.can_eq(param_env, assoc_ty, found) {
825826
diag.span_label(
826827
item.span,
827828
"associated type defaults can't be assumed inside the \
@@ -844,7 +845,7 @@ fn foo(&self) -> Self::T { String::new() }
844845
let assoc_ty = tcx.type_of(item.id.owner_id).instantiate_identity();
845846
if let hir::Defaultness::Default { has_value: true } =
846847
tcx.defaultness(item.id.owner_id)
847-
&& self.infcx.can_eq_shallow(param_env, assoc_ty, found)
848+
&& self.infcx.can_eq(param_env, assoc_ty, found)
848849
{
849850
diag.span_label(
850851
item.span,

0 commit comments

Comments
 (0)