@@ -1308,36 +1308,6 @@ where
13081308            } , 
13091309        ) ; 
13101310
1311-         // HACK: We bail with overflow if the response would have too many non-region 
1312-         // inference variables. This tends to only happen if we encounter a lot of 
1313-         // ambiguous alias types which get replaced with fresh inference variables 
1314-         // during generalization. This prevents hangs caused by an exponential blowup, 
1315-         // see tests/ui/traits/next-solver/coherence-alias-hang.rs. 
1316-         match  self . current_goal_kind  { 
1317-             // We don't do so for `NormalizesTo` goals as we erased the expected term and 
1318-             // bailing with overflow here would prevent us from detecting a type-mismatch, 
1319-             // causing a coherence error in diesel, see #131969. We still bail with overflow 
1320-             // when later returning from the parent AliasRelate goal. 
1321-             CurrentGoalKind :: NormalizesTo  => { } 
1322-             CurrentGoalKind :: Misc  | CurrentGoalKind :: CoinductiveTrait  => { 
1323-                 let  num_non_region_vars = canonical
1324-                     . variables 
1325-                     . iter ( ) 
1326-                     . filter ( |c| !c. is_region ( )  && c. is_existential ( ) ) 
1327-                     . count ( ) ; 
1328-                 if  num_non_region_vars > self . cx ( ) . recursion_limit ( )  { 
1329-                     debug ! ( ?num_non_region_vars,  "too many inference variables -> overflow" ) ; 
1330-                     return  Ok ( self . make_ambiguous_response_no_constraints ( 
1331-                         MaybeCause :: Overflow  { 
1332-                             suggest_increasing_limit :  true , 
1333-                             keep_constraints :  false , 
1334-                         } , 
1335-                         OpaqueTypesJank :: AllGood , 
1336-                     ) ) ; 
1337-                 } 
1338-             } 
1339-         } 
1340- 
13411311        Ok ( canonical) 
13421312    } 
13431313
0 commit comments