remove proof tree formatter, make em shallow
This commit is contained in:
@@ -7,15 +7,11 @@ pub mod suggestions;
|
||||
mod type_err_ctxt_ext;
|
||||
|
||||
use super::{Obligation, ObligationCause, ObligationCauseCode, PredicateObligation};
|
||||
use crate::infer::InferCtxt;
|
||||
use crate::solve::{GenerateProofTree, InferCtxtEvalExt};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::intravisit::Visitor;
|
||||
use rustc_middle::traits::solve::Goal;
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt};
|
||||
use rustc_span::Span;
|
||||
use std::io::Write;
|
||||
use std::ops::ControlFlow;
|
||||
|
||||
pub use self::infer_ctxt_ext::*;
|
||||
@@ -184,16 +180,3 @@ pub enum DefIdOrName {
|
||||
DefId(DefId),
|
||||
Name(&'static str),
|
||||
}
|
||||
|
||||
pub fn dump_proof_tree<'tcx>(o: &Obligation<'tcx, ty::Predicate<'tcx>>, infcx: &InferCtxt<'tcx>) {
|
||||
infcx.probe(|_| {
|
||||
let goal = Goal { predicate: o.predicate, param_env: o.param_env };
|
||||
let tree = infcx
|
||||
.evaluate_root_goal(goal, GenerateProofTree::Yes)
|
||||
.1
|
||||
.expect("proof tree should have been generated");
|
||||
let mut lock = std::io::stdout().lock();
|
||||
let _ = lock.write_fmt(format_args!("{tree:?}\n"));
|
||||
let _ = lock.flush();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -46,7 +46,6 @@ use rustc_middle::ty::{
|
||||
TypeVisitableExt, Upcast,
|
||||
};
|
||||
use rustc_middle::{bug, span_bug};
|
||||
use rustc_session::config::DumpSolverProofTree;
|
||||
use rustc_session::Limit;
|
||||
use rustc_span::def_id::LOCAL_CRATE;
|
||||
use rustc_span::symbol::sym;
|
||||
@@ -56,8 +55,8 @@ use std::fmt;
|
||||
use std::iter;
|
||||
|
||||
use super::{
|
||||
dump_proof_tree, ArgKind, CandidateSimilarity, FindExprBySpan, FindTypeParam,
|
||||
GetSafeTransmuteErrorAndReason, HasNumericInferVisitor, ImplCandidate, UnsatisfiedConst,
|
||||
ArgKind, CandidateSimilarity, FindExprBySpan, FindTypeParam, GetSafeTransmuteErrorAndReason,
|
||||
HasNumericInferVisitor, ImplCandidate, UnsatisfiedConst,
|
||||
};
|
||||
|
||||
pub use rustc_infer::traits::error_reporting::*;
|
||||
@@ -369,13 +368,6 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
||||
error: &SelectionError<'tcx>,
|
||||
) -> ErrorGuaranteed {
|
||||
let tcx = self.tcx;
|
||||
|
||||
if tcx.sess.opts.unstable_opts.next_solver.map(|c| c.dump_tree).unwrap_or_default()
|
||||
== DumpSolverProofTree::OnError
|
||||
{
|
||||
dump_proof_tree(root_obligation, self.infcx);
|
||||
}
|
||||
|
||||
let mut span = obligation.cause.span;
|
||||
|
||||
let mut err = match *error {
|
||||
@@ -1529,12 +1521,6 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
||||
|
||||
#[instrument(skip(self), level = "debug")]
|
||||
fn report_fulfillment_error(&self, error: &FulfillmentError<'tcx>) -> ErrorGuaranteed {
|
||||
if self.tcx.sess.opts.unstable_opts.next_solver.map(|c| c.dump_tree).unwrap_or_default()
|
||||
== DumpSolverProofTree::OnError
|
||||
{
|
||||
dump_proof_tree(&error.root_obligation, self.infcx);
|
||||
}
|
||||
|
||||
match error.code {
|
||||
FulfillmentErrorCode::Select(ref selection_error) => self.report_selection_error(
|
||||
error.obligation.clone(),
|
||||
|
||||
Reference in New Issue
Block a user