mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-21 22:34:05 +00:00
don't bail when encountering many placeholders
This commit is contained in:
parent
b64b25b99e
commit
919b61a6f4
@ -173,7 +173,8 @@ where
|
||||
// causing a coherence error in diesel, see #131969. We still bail with verflow
|
||||
// when later returning from the parent AliasRelate goal.
|
||||
if !self.is_normalizes_to_goal {
|
||||
let num_non_region_vars = canonical.variables.iter().filter(|c| !c.is_region()).count();
|
||||
let num_non_region_vars =
|
||||
canonical.variables.iter().filter(|c| !c.is_region() && c.is_existential()).count();
|
||||
if num_non_region_vars > self.cx().recursion_limit() {
|
||||
debug!(?num_non_region_vars, "too many inference variables -> overflow");
|
||||
return Ok(self.make_ambiguous_response_no_constraints(MaybeCause::Overflow {
|
||||
|
@ -0,0 +1,16 @@
|
||||
//@ compile-flags: -Znext-solver
|
||||
//@ check-pass
|
||||
|
||||
// When canonicalizing responses, we bail if there are too many inference variables.
|
||||
// We previously also counted placeholders, which is incorrect.
|
||||
#![recursion_limit = "8"]
|
||||
|
||||
fn foo<T>() {}
|
||||
|
||||
fn bar<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>() {
|
||||
// The query response will contain 10 placeholders, which previously
|
||||
// caused us to bail here.
|
||||
foo::<(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)>();
|
||||
}
|
||||
|
||||
fn main() {}
|
@ -1,8 +1,8 @@
|
||||
//~ ERROR overflow evaluating the requirement `Self: Trait`
|
||||
//~^ ERROR overflow evaluating the requirement `Self well-formed`
|
||||
// This is a non-regression test for issue #115351, where a recursion limit of 0 caused an ICE.
|
||||
//@ check-pass
|
||||
//@ compile-flags: -Znext-solver --crate-type=lib
|
||||
|
||||
// This is a non-regression test for issue #115351, where a recursion limit of 0 caused an ICE.
|
||||
|
||||
#![recursion_limit = "0"]
|
||||
trait Trait {}
|
||||
impl Trait for u32 {}
|
||||
|
@ -1,11 +0,0 @@
|
||||
error[E0275]: overflow evaluating the requirement `Self: Trait`
|
||||
|
|
||||
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "2"]` attribute to your crate (`recursion_limit_zero_issue_115351`)
|
||||
|
||||
error[E0275]: overflow evaluating the requirement `Self well-formed`
|
||||
|
|
||||
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "2"]` attribute to your crate (`recursion_limit_zero_issue_115351`)
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0275`.
|
Loading…
Reference in New Issue
Block a user