Auto merge of #114648 - compiler-errors:perf-114604, r=lqd
Only resolve target type in `try_coerce` in new solver Only needed in new solver, seems to affect perf in old solver. cc #114604/#114594
This commit is contained in:
commit
fd16988600
@ -1007,15 +1007,17 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
&self,
|
&self,
|
||||||
expr: &hir::Expr<'_>,
|
expr: &hir::Expr<'_>,
|
||||||
expr_ty: Ty<'tcx>,
|
expr_ty: Ty<'tcx>,
|
||||||
target: Ty<'tcx>,
|
mut target: Ty<'tcx>,
|
||||||
allow_two_phase: AllowTwoPhase,
|
allow_two_phase: AllowTwoPhase,
|
||||||
cause: Option<ObligationCause<'tcx>>,
|
cause: Option<ObligationCause<'tcx>>,
|
||||||
) -> RelateResult<'tcx, Ty<'tcx>> {
|
) -> RelateResult<'tcx, Ty<'tcx>> {
|
||||||
let source = self.try_structurally_resolve_type(expr.span, expr_ty);
|
let source = self.try_structurally_resolve_type(expr.span, expr_ty);
|
||||||
let target = self.try_structurally_resolve_type(
|
if self.next_trait_solver() {
|
||||||
cause.as_ref().map_or(expr.span, |cause| cause.span),
|
target = self.try_structurally_resolve_type(
|
||||||
target,
|
cause.as_ref().map_or(expr.span, |cause| cause.span),
|
||||||
);
|
target,
|
||||||
|
);
|
||||||
|
}
|
||||||
debug!("coercion::try({:?}: {:?} -> {:?})", expr, source, target);
|
debug!("coercion::try({:?}: {:?} -> {:?})", expr, source, target);
|
||||||
|
|
||||||
let cause =
|
let cause =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user