-
Notifications
You must be signed in to change notification settings - Fork 13.4k
-Znext-solver=coherence
: suggest increasing recursion limit
#121497
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,7 +60,6 @@ pub enum Certainty { | |
|
||
impl Certainty { | ||
pub const AMBIGUOUS: Certainty = Certainty::Maybe(MaybeCause::Ambiguity); | ||
pub const OVERFLOW: Certainty = Certainty::Maybe(MaybeCause::Overflow); | ||
|
||
/// Use this function to merge the certainty of multiple nested subgoals. | ||
/// | ||
|
@@ -79,16 +78,13 @@ impl Certainty { | |
(Certainty::Yes, Certainty::Yes) => Certainty::Yes, | ||
(Certainty::Yes, Certainty::Maybe(_)) => other, | ||
(Certainty::Maybe(_), Certainty::Yes) => self, | ||
(Certainty::Maybe(MaybeCause::Ambiguity), Certainty::Maybe(MaybeCause::Ambiguity)) => { | ||
Certainty::Maybe(MaybeCause::Ambiguity) | ||
} | ||
(Certainty::Maybe(MaybeCause::Ambiguity), Certainty::Maybe(MaybeCause::Overflow)) | ||
| (Certainty::Maybe(MaybeCause::Overflow), Certainty::Maybe(MaybeCause::Ambiguity)) | ||
| (Certainty::Maybe(MaybeCause::Overflow), Certainty::Maybe(MaybeCause::Overflow)) => { | ||
Certainty::Maybe(MaybeCause::Overflow) | ||
} | ||
(Certainty::Maybe(a), Certainty::Maybe(b)) => Certainty::Maybe(a.unify_with(b)), | ||
} | ||
} | ||
|
||
pub const fn overflow(suggest_increasing_limit: bool) -> Certainty { | ||
Certainty::Maybe(MaybeCause::Overflow { suggest_increasing_limit }) | ||
} | ||
} | ||
|
||
/// Why we failed to evaluate a goal. | ||
|
@@ -99,7 +95,21 @@ pub enum MaybeCause { | |
/// or we hit a case where we just don't bother, e.g. `?x: Trait` goals. | ||
Ambiguity, | ||
/// We gave up due to an overflow, most often by hitting the recursion limit. | ||
Overflow, | ||
Overflow { suggest_increasing_limit: bool }, | ||
} | ||
|
||
impl MaybeCause { | ||
fn unify_with(self, other: MaybeCause) -> MaybeCause { | ||
match (self, other) { | ||
(MaybeCause::Ambiguity, MaybeCause::Ambiguity) => MaybeCause::Ambiguity, | ||
(MaybeCause::Ambiguity, MaybeCause::Overflow { .. }) => other, | ||
(MaybeCause::Overflow { .. }, MaybeCause::Ambiguity) => self, | ||
( | ||
MaybeCause::Overflow { suggest_increasing_limit: a }, | ||
MaybeCause::Overflow { suggest_increasing_limit: b }, | ||
) => MaybeCause::Overflow { suggest_increasing_limit: a || b }, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't suggest increasing the limit if we hit a true cycle, correct? I feel like this should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or hitting the fixpoint limit, which also won't be improved by increasing the limit. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it will, in case one of the goals fails or has no constraints, if we have two nested goals:
then we should suggest increasing the recursion limit as it would change the result to |
||
} | ||
} | ||
} | ||
|
||
#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash, HashStable, TypeFoldable, TypeVisitable)] | ||
|
Uh oh!
There was an error while loading. Please reload this page.