about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src
diff options
context:
space:
mode:
authorBoxy <supbscripter@gmail.com>2023-06-08 19:23:24 +0100
committerBoxy <supbscripter@gmail.com>2023-06-19 09:01:37 +0100
commita2050ba12d4c717478ec9da176090de1609e8b07 (patch)
tree157538d11b9cb5a790500d307e6417fa4ca3a6e1 /compiler/rustc_trait_selection/src
parent3009b2c647ad70fbab1b1df53ef08eaaa6e8759a (diff)
downloadrust-a2050ba12d4c717478ec9da176090de1609e8b07.tar.gz
rust-a2050ba12d4c717478ec9da176090de1609e8b07.zip
add -Z flag
Diffstat (limited to 'compiler/rustc_trait_selection/src')
-rw-r--r--compiler/rustc_trait_selection/src/solve/eval_ctxt.rs14
1 files changed, 11 insertions, 3 deletions
diff --git a/compiler/rustc_trait_selection/src/solve/eval_ctxt.rs b/compiler/rustc_trait_selection/src/solve/eval_ctxt.rs
index 6aff9e45cb4..7ac1ef19bbc 100644
--- a/compiler/rustc_trait_selection/src/solve/eval_ctxt.rs
+++ b/compiler/rustc_trait_selection/src/solve/eval_ctxt.rs
@@ -147,13 +147,21 @@ impl<'tcx> InferCtxtEvalExt<'tcx> for InferCtxt<'tcx> {
             var_values: CanonicalVarValues::dummy(),
             nested_goals: NestedGoals::new(),
             tainted: Ok(()),
-            inspect: Box::new(DebugSolver::new()),
+            inspect: match self.tcx.sess.opts.unstable_opts.dump_solver_proof_tree {
+                true => Box::new(DebugSolver::new()),
+                false => Box::new(()),
+            },
         };
         let result = ecx.evaluate_goal(IsNormalizesToHack::No, goal);
 
-        let tree = match ecx.inspect.into_debug_solver() {
+        let tcx = ecx.tcx();
+        match ecx.inspect.into_debug_solver() {
             Some(tree) => match Box::leak(tree) {
-                DebugSolver::GoalEvaluation(tree) => tree,
+                DebugSolver::GoalEvaluation(tree) => {
+                    if tcx.sess.opts.unstable_opts.dump_solver_proof_tree {
+                        println!("{:?}", tree);
+                    }
+                }
                 _ => unreachable!("unable to convert to `DebugSolver::GoalEvaluation`"),
             },
             _ => unreachable!("unable to convert to `DebugSolver::GoalEvaluation`"),