about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2023-08-09 17:00:59 +0000
committerMichael Goulet <michael@errs.io>2023-08-09 17:00:59 +0000
commit214d78daecdda209a4e0a3bc56dcb18c1eb00292 (patch)
tree734cdce8f1c4007ea76ed8b9c21f2d5c545cf76d
parent8838c73e866aa85b40463640ff6f5af268507812 (diff)
downloadrust-214d78daecdda209a4e0a3bc56dcb18c1eb00292.tar.gz
rust-214d78daecdda209a4e0a3bc56dcb18c1eb00292.zip
Only resolve in new solver
-rw-r--r--compiler/rustc_hir_typeck/src/coercion.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/compiler/rustc_hir_typeck/src/coercion.rs b/compiler/rustc_hir_typeck/src/coercion.rs
index b2b3f435505..d9b17a2e2b7 100644
--- a/compiler/rustc_hir_typeck/src/coercion.rs
+++ b/compiler/rustc_hir_typeck/src/coercion.rs
@@ -1007,15 +1007,17 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
         &self,
         expr: &hir::Expr<'_>,
         expr_ty: Ty<'tcx>,
-        target: Ty<'tcx>,
+        mut target: Ty<'tcx>,
         allow_two_phase: AllowTwoPhase,
         cause: Option<ObligationCause<'tcx>>,
     ) -> RelateResult<'tcx, Ty<'tcx>> {
         let source = self.try_structurally_resolve_type(expr.span, expr_ty);
-        let target = self.try_structurally_resolve_type(
-            cause.as_ref().map_or(expr.span, |cause| cause.span),
-            target,
-        );
+        if self.next_trait_solver() {
+            target = self.try_structurally_resolve_type(
+                cause.as_ref().map_or(expr.span, |cause| cause.span),
+                target,
+            );
+        }
         debug!("coercion::try({:?}: {:?} -> {:?})", expr, source, target);
 
         let cause =