Skip to content

Commit

Permalink
debug messages added
Browse files Browse the repository at this point in the history
  • Loading branch information
kevgrasso committed Oct 23, 2019
1 parent f466f52 commit fedefec
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 9 additions & 0 deletions src/librustc/infer/error_reporting/mod.rs
Expand Up @@ -867,6 +867,9 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
/// Compares two given types, eliding parts that are the same between them and highlighting
/// relevant differences, and return two representation of those types for highlighted printing.
fn cmp(&self, t1: Ty<'tcx>, t2: Ty<'tcx>) -> (DiagnosticStyledString, DiagnosticStyledString) {
debug!("cmp(t1={}, t2={})", t1, t2);

// helper functions
fn equals<'tcx>(a: Ty<'tcx>, b: Ty<'tcx>) -> bool {
match (&a.kind, &b.kind) {
(a, b) if *a == *b => true,
Expand Down Expand Up @@ -902,6 +905,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
s.push_normal(ty.to_string());
}

// process starts here
match (&t1.kind, &t2.kind) {
(&ty::Adt(def1, sub1), &ty::Adt(def2, sub2)) => {
let sub_no_defaults_1 = self.strip_generic_default_params(def1.did, sub1);
Expand Down Expand Up @@ -1120,6 +1124,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
_ => {}
}

debug!("note_type_err(diag={:?})", diag);
let (expected_found, exp_found, is_simple_error) = match values {
None => (None, None, false),
Some(values) => {
Expand Down Expand Up @@ -1170,6 +1175,10 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
);
}
(_, false, _) => {
debug!(
"note_type_err: exp_found={:?}, expected={:?} found={:?}",
exp_found, expected, found
);
if let Some(exp_found) = exp_found {
self.suggest_as_ref_where_appropriate(span, &exp_found, diag);
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_errors/diagnostic.rs
Expand Up @@ -34,7 +34,7 @@ pub struct SubDiagnostic {
pub render_span: Option<MultiSpan>,
}

#[derive(PartialEq, Eq)]
#[derive(Debug, PartialEq, Eq)]
pub struct DiagnosticStyledString(pub Vec<StringPart>);

impl DiagnosticStyledString {
Expand All @@ -60,7 +60,7 @@ impl DiagnosticStyledString {
}
}

#[derive(PartialEq, Eq)]
#[derive(Debug, PartialEq, Eq)]
pub enum StringPart {
Normal(String),
Highlighted(String),
Expand Down

0 comments on commit fedefec

Please sign in to comment.