Skip to content

Commit 018c3e2

Browse files
Coercion doesn't need binders either
1 parent 52f7384 commit 018c3e2

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

compiler/rustc_hir_typeck/src/coercion.rs

+6-7
Original file line numberDiff line numberDiff line change
@@ -632,9 +632,8 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
632632
while !queue.is_empty() {
633633
let obligation = queue.remove(0);
634634
debug!("coerce_unsized resolve step: {:?}", obligation);
635-
let bound_predicate = obligation.predicate.kind();
636-
let trait_pred = match bound_predicate.skip_binder() {
637-
ty::PredicateKind::Clause(ty::ClauseKind::Trait(trait_pred))
635+
let trait_pred = match obligation.predicate.kind().no_bound_vars() {
636+
Some(ty::PredicateKind::Clause(ty::ClauseKind::Trait(trait_pred)))
638637
if traits.contains(&trait_pred.def_id()) =>
639638
{
640639
if unsize_did == trait_pred.def_id() {
@@ -652,20 +651,20 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
652651
has_unsized_tuple_coercion = true;
653652
}
654653
}
655-
bound_predicate.rebind(trait_pred)
654+
trait_pred
656655
}
657656
_ => {
658657
coercion.obligations.push(obligation);
659658
continue;
660659
}
661660
};
662-
match selcx.poly_select(&obligation.with(selcx.tcx(), trait_pred)) {
661+
match selcx.select(&obligation.with(selcx.tcx(), trait_pred)) {
663662
// Uncertain or unimplemented.
664663
Ok(None) => {
665664
if trait_pred.def_id() == unsize_did {
666665
let trait_pred = self.resolve_vars_if_possible(trait_pred);
667-
let self_ty = trait_pred.skip_binder().self_ty();
668-
let unsize_ty = trait_pred.skip_binder().trait_ref.substs[1].expect_ty();
666+
let self_ty = trait_pred.self_ty();
667+
let unsize_ty = trait_pred.trait_ref.substs[1].expect_ty();
669668
debug!("coerce_unsized: ambiguous unsize case for {:?}", trait_pred);
670669
match (self_ty.kind(), unsize_ty.kind()) {
671670
(&ty::Infer(ty::TyVar(v)), ty::Dynamic(..))

0 commit comments

Comments
 (0)