Skip to content

Commit 874e08b

Browse files
committed
Log when buffering a diagnostic.
This is useful in debugging when and where errors are emitted in logs.
1 parent f004cae commit 874e08b

File tree

4 files changed

+7
-0
lines changed

4 files changed

+7
-0
lines changed

src/Cargo.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2183,6 +2183,7 @@ name = "rustc_errors"
21832183
version = "0.0.0"
21842184
dependencies = [
21852185
"atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
2186+
"log 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
21862187
"rustc_cratesio_shim 0.0.0",
21872188
"rustc_data_structures 0.0.0",
21882189
"serialize 0.0.0",

src/librustc_errors/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ path = "lib.rs"
99
crate-type = ["dylib"]
1010

1111
[dependencies]
12+
log = "0.4"
1213
serialize = { path = "../libserialize" }
1314
syntax_pos = { path = "../libsyntax_pos" }
1415
rustc_data_structures = { path = "../librustc_data_structures" }

src/librustc_errors/diagnostic_builder.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ impl<'a> DiagnosticBuilder<'a> {
108108
diagnostic = ::std::ptr::read(&self.diagnostic);
109109
::std::mem::forget(self);
110110
};
111+
// Logging here is useful to help track down where in logs an error was
112+
// actually emitted.
113+
debug!("buffer: diagnostic={:?}", diagnostic);
111114
buffered_diagnostics.push(diagnostic);
112115
}
113116

src/librustc_errors/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ extern crate atty;
2323
extern crate termcolor;
2424
#[cfg(unix)]
2525
extern crate libc;
26+
#[macro_use]
27+
extern crate log;
2628
extern crate rustc_data_structures;
2729
extern crate serialize as rustc_serialize;
2830
extern crate syntax_pos;

0 commit comments

Comments
 (0)