Skip to content

Commit 2f85c80

Browse files
Revert "Use DeepRejectCtxt in assemble_inherent_candidates_from_param"
This reverts commit ad59f0b.
1 parent 96ecc90 commit 2f85c80

File tree

4 files changed

+12
-58
lines changed

4 files changed

+12
-58
lines changed

compiler/rustc_hir_typeck/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// tidy-alphabetical-start
22
#![allow(rustc::diagnostic_outside_of_impl)]
33
#![allow(rustc::untranslatable_diagnostic)]
4-
#![feature(assert_matches)]
54
#![feature(box_patterns)]
65
#![feature(if_let_guard)]
76
#![feature(iter_intersperse)]

compiler/rustc_hir_typeck/src/method/probe.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use std::assert_matches::debug_assert_matches;
21
use std::cell::{Cell, RefCell};
32
use std::cmp::max;
43
use std::ops::Deref;
@@ -16,7 +15,7 @@ use rustc_infer::infer::{BoundRegionConversionTime, DefineOpaqueTypes, InferOk,
1615
use rustc_infer::traits::ObligationCauseCode;
1716
use rustc_middle::middle::stability;
1817
use rustc_middle::ty::elaborate::supertrait_def_ids;
19-
use rustc_middle::ty::fast_reject::{DeepRejectCtxt, TreatParams, simplify_type};
18+
use rustc_middle::ty::fast_reject::{TreatParams, simplify_type};
2019
use rustc_middle::ty::{
2120
self, AssocItem, AssocItemContainer, GenericArgs, GenericArgsRef, GenericParamDefKind,
2221
ParamEnvAnd, Ty, TyCtxt, TypeVisitableExt, Upcast,
@@ -803,8 +802,8 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
803802
);
804803
}
805804
}
806-
ty::Param(_) => {
807-
self.assemble_inherent_candidates_from_param(raw_self_ty);
805+
ty::Param(p) => {
806+
self.assemble_inherent_candidates_from_param(p);
808807
}
809808
ty::Bool
810809
| ty::Char
@@ -905,16 +904,18 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
905904
}
906905

907906
#[instrument(level = "debug", skip(self))]
908-
fn assemble_inherent_candidates_from_param(&mut self, param_ty: Ty<'tcx>) {
909-
debug_assert_matches!(param_ty.kind(), ty::Param(_));
910-
911-
let tcx = self.tcx;
907+
fn assemble_inherent_candidates_from_param(&mut self, param_ty: ty::ParamTy) {
912908
let bounds = self.param_env.caller_bounds().iter().filter_map(|predicate| {
913909
let bound_predicate = predicate.kind();
914910
match bound_predicate.skip_binder() {
915-
ty::ClauseKind::Trait(trait_predicate) => DeepRejectCtxt::relate_rigid_rigid(tcx)
916-
.types_may_unify(param_ty, trait_predicate.trait_ref.self_ty())
917-
.then(|| bound_predicate.rebind(trait_predicate.trait_ref)),
911+
ty::ClauseKind::Trait(trait_predicate) => {
912+
match *trait_predicate.trait_ref.self_ty().kind() {
913+
ty::Param(p) if p == param_ty => {
914+
Some(bound_predicate.rebind(trait_predicate.trait_ref))
915+
}
916+
_ => None,
917+
}
918+
}
918919
ty::ClauseKind::RegionOutlives(_)
919920
| ty::ClauseKind::TypeOutlives(_)
920921
| ty::ClauseKind::Projection(_)

tests/ui/traits/next-solver/method/param-method-from-unnormalized-param-env-2.rs

Lines changed: 0 additions & 29 deletions
This file was deleted.

tests/ui/traits/next-solver/method/param-method-from-unnormalized-param-env.rs

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)