Skip to content

Commit fedefec

Browse files
committed
debug messages added
1 parent f466f52 commit fedefec

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/librustc/infer/error_reporting/mod.rs

+9
Original file line numberDiff line numberDiff line change
@@ -867,6 +867,9 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
867867
/// Compares two given types, eliding parts that are the same between them and highlighting
868868
/// relevant differences, and return two representation of those types for highlighted printing.
869869
fn cmp(&self, t1: Ty<'tcx>, t2: Ty<'tcx>) -> (DiagnosticStyledString, DiagnosticStyledString) {
870+
debug!("cmp(t1={}, t2={})", t1, t2);
871+
872+
// helper functions
870873
fn equals<'tcx>(a: Ty<'tcx>, b: Ty<'tcx>) -> bool {
871874
match (&a.kind, &b.kind) {
872875
(a, b) if *a == *b => true,
@@ -902,6 +905,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
902905
s.push_normal(ty.to_string());
903906
}
904907

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

1127+
debug!("note_type_err(diag={:?})", diag);
11231128
let (expected_found, exp_found, is_simple_error) = match values {
11241129
None => (None, None, false),
11251130
Some(values) => {
@@ -1170,6 +1175,10 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
11701175
);
11711176
}
11721177
(_, false, _) => {
1178+
debug!(
1179+
"note_type_err: exp_found={:?}, expected={:?} found={:?}",
1180+
exp_found, expected, found
1181+
);
11731182
if let Some(exp_found) = exp_found {
11741183
self.suggest_as_ref_where_appropriate(span, &exp_found, diag);
11751184
}

src/librustc_errors/diagnostic.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub struct SubDiagnostic {
3434
pub render_span: Option<MultiSpan>,
3535
}
3636

37-
#[derive(PartialEq, Eq)]
37+
#[derive(Debug, PartialEq, Eq)]
3838
pub struct DiagnosticStyledString(pub Vec<StringPart>);
3939

4040
impl DiagnosticStyledString {
@@ -60,7 +60,7 @@ impl DiagnosticStyledString {
6060
}
6161
}
6262

63-
#[derive(PartialEq, Eq)]
63+
#[derive(Debug, PartialEq, Eq)]
6464
pub enum StringPart {
6565
Normal(String),
6666
Highlighted(String),

0 commit comments

Comments
 (0)