Skip to content

Commit 214d78d

Browse files
Only resolve in new solver
1 parent 8838c73 commit 214d78d

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

compiler/rustc_hir_typeck/src/coercion.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -1007,15 +1007,17 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
10071007
&self,
10081008
expr: &hir::Expr<'_>,
10091009
expr_ty: Ty<'tcx>,
1010-
target: Ty<'tcx>,
1010+
mut target: Ty<'tcx>,
10111011
allow_two_phase: AllowTwoPhase,
10121012
cause: Option<ObligationCause<'tcx>>,
10131013
) -> RelateResult<'tcx, Ty<'tcx>> {
10141014
let source = self.try_structurally_resolve_type(expr.span, expr_ty);
1015-
let target = self.try_structurally_resolve_type(
1016-
cause.as_ref().map_or(expr.span, |cause| cause.span),
1017-
target,
1018-
);
1015+
if self.next_trait_solver() {
1016+
target = self.try_structurally_resolve_type(
1017+
cause.as_ref().map_or(expr.span, |cause| cause.span),
1018+
target,
1019+
);
1020+
}
10191021
debug!("coercion::try({:?}: {:?} -> {:?})", expr, source, target);
10201022

10211023
let cause =

0 commit comments

Comments
 (0)