inspect: handle None in nested
This commit is contained in:
@@ -182,11 +182,11 @@ impl<'tcx> ProofTreeBuilder<'tcx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn nested(&self, state: impl Into<DebugSolver<'tcx>>) -> Self {
|
fn nested<T: Into<DebugSolver<'tcx>>>(&self, state: impl FnOnce() -> T) -> Self {
|
||||||
match &self.state {
|
match &self.state {
|
||||||
Some(prev_state) => Self {
|
Some(prev_state) => Self {
|
||||||
state: Some(Box::new(BuilderData {
|
state: Some(Box::new(BuilderData {
|
||||||
tree: state.into(),
|
tree: state().into(),
|
||||||
use_global_cache: prev_state.use_global_cache,
|
use_global_cache: prev_state.use_global_cache,
|
||||||
})),
|
})),
|
||||||
},
|
},
|
||||||
@@ -255,11 +255,7 @@ impl<'tcx> ProofTreeBuilder<'tcx> {
|
|||||||
goal: Goal<'tcx, ty::Predicate<'tcx>>,
|
goal: Goal<'tcx, ty::Predicate<'tcx>>,
|
||||||
is_normalizes_to_hack: IsNormalizesToHack,
|
is_normalizes_to_hack: IsNormalizesToHack,
|
||||||
) -> ProofTreeBuilder<'tcx> {
|
) -> ProofTreeBuilder<'tcx> {
|
||||||
if self.state.is_none() {
|
self.nested(|| WipGoalEvaluation {
|
||||||
return ProofTreeBuilder { state: None };
|
|
||||||
}
|
|
||||||
|
|
||||||
self.nested(WipGoalEvaluation {
|
|
||||||
uncanonicalized_goal: goal,
|
uncanonicalized_goal: goal,
|
||||||
evaluation: None,
|
evaluation: None,
|
||||||
is_normalizes_to_hack,
|
is_normalizes_to_hack,
|
||||||
@@ -271,11 +267,7 @@ impl<'tcx> ProofTreeBuilder<'tcx> {
|
|||||||
&mut self,
|
&mut self,
|
||||||
goal: CanonicalInput<'tcx>,
|
goal: CanonicalInput<'tcx>,
|
||||||
) -> ProofTreeBuilder<'tcx> {
|
) -> ProofTreeBuilder<'tcx> {
|
||||||
if self.state.is_none() {
|
self.nested(|| WipCanonicalGoalEvaluation {
|
||||||
return ProofTreeBuilder { state: None };
|
|
||||||
}
|
|
||||||
|
|
||||||
self.nested(WipCanonicalGoalEvaluation {
|
|
||||||
goal,
|
goal,
|
||||||
cache_hit: None,
|
cache_hit: None,
|
||||||
evaluation_steps: vec![],
|
evaluation_steps: vec![],
|
||||||
@@ -336,11 +328,7 @@ impl<'tcx> ProofTreeBuilder<'tcx> {
|
|||||||
&mut self,
|
&mut self,
|
||||||
instantiated_goal: QueryInput<'tcx, ty::Predicate<'tcx>>,
|
instantiated_goal: QueryInput<'tcx, ty::Predicate<'tcx>>,
|
||||||
) -> ProofTreeBuilder<'tcx> {
|
) -> ProofTreeBuilder<'tcx> {
|
||||||
if self.state.is_none() {
|
self.nested(|| WipGoalEvaluationStep {
|
||||||
return ProofTreeBuilder { state: None };
|
|
||||||
}
|
|
||||||
|
|
||||||
self.nested(WipGoalEvaluationStep {
|
|
||||||
instantiated_goal,
|
instantiated_goal,
|
||||||
added_goals_evaluations: vec![],
|
added_goals_evaluations: vec![],
|
||||||
candidates: vec![],
|
candidates: vec![],
|
||||||
@@ -362,11 +350,7 @@ impl<'tcx> ProofTreeBuilder<'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_goal_candidate(&mut self) -> ProofTreeBuilder<'tcx> {
|
pub fn new_goal_candidate(&mut self) -> ProofTreeBuilder<'tcx> {
|
||||||
if self.state.is_none() {
|
self.nested(|| WipGoalCandidate {
|
||||||
return ProofTreeBuilder { state: None };
|
|
||||||
}
|
|
||||||
|
|
||||||
self.nested(WipGoalCandidate {
|
|
||||||
added_goals_evaluations: vec![],
|
added_goals_evaluations: vec![],
|
||||||
candidates: vec![],
|
candidates: vec![],
|
||||||
kind: None,
|
kind: None,
|
||||||
@@ -398,11 +382,7 @@ impl<'tcx> ProofTreeBuilder<'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_evaluate_added_goals(&mut self) -> ProofTreeBuilder<'tcx> {
|
pub fn new_evaluate_added_goals(&mut self) -> ProofTreeBuilder<'tcx> {
|
||||||
if self.state.is_none() {
|
self.nested(|| WipAddedGoalsEvaluation { evaluations: vec![], result: None })
|
||||||
return ProofTreeBuilder { state: None };
|
|
||||||
}
|
|
||||||
|
|
||||||
self.nested(WipAddedGoalsEvaluation { evaluations: vec![], result: None })
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn evaluate_added_goals_loop_start(&mut self) {
|
pub fn evaluate_added_goals_loop_start(&mut self) {
|
||||||
|
|||||||
Reference in New Issue
Block a user