Auto merge of #148066 - lcnr:remove-perf-hack, r=BoxyUwU · rust-lang/rust@cc63a0a (original) (raw)
File tree
2 files changed
lines changed
- compiler/rustc_next_trait_solver/src/solve/eval_ctxt
- tests/ui/traits/next-solver/cycles/coinduction
2 files changed
lines changed
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1308,36 +1308,6 @@ where | ||
| 1308 | 1308 | }, |
| 1309 | 1309 | ); |
| 1310 | 1310 | |
| 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 | |
| 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 | - | |
| 1341 | 1311 | Ok(canonical) |
| 1342 | 1312 | } |
| 1343 | 1313 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -4,7 +4,6 @@ error[E0275]: overflow evaluating the requirement `W<_>: Trait` | ||
| 4 | 4 | LL | impls::<W<_>>(); |
| 5 | 5 | | ^^^^ |
| 6 | 6 | | |
| 7 | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`fixpoint_exponential_growth`) | |
| 8 | 7 | note: required by a bound in `impls` |
| 9 | 8 | --> $DIR/fixpoint-exponential-growth.rs:30:13 |
| 10 | 9 | | |