Skip to content

Commit 308d197

Browse files
committed
Log when buffering a diagnostic.
This is useful in debugging when and where errors are emitted in logs.
1 parent 20ca025 commit 308d197

File tree

4 files changed

+7
-0
lines changed

4 files changed

+7
-0
lines changed

src/Cargo.lock

+1
Original file line numberDiff line numberDiff line change
@@ -2161,6 +2161,7 @@ name = "rustc_errors"
21612161
version = "0.0.0"
21622162
dependencies = [
21632163
"atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
2164+
"log 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
21642165
"rustc_cratesio_shim 0.0.0",
21652166
"rustc_data_structures 0.0.0",
21662167
"serialize 0.0.0",

src/librustc_errors/Cargo.toml

+1
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

+3
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ impl<'a> DiagnosticBuilder<'a> {
9898
diagnostic = ::std::ptr::read(&self.diagnostic);
9999
::std::mem::forget(self);
100100
};
101+
// Logging here is useful to help track down where in logs an error was
102+
// actually emitted.
103+
debug!("buffer: diagnostic={:?}", diagnostic);
101104
buffered_diagnostics.push(diagnostic);
102105
}
103106

src/librustc_errors/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ extern crate atty;
2424
extern crate termcolor;
2525
#[cfg(unix)]
2626
extern crate libc;
27+
#[macro_use]
28+
extern crate log;
2729
extern crate rustc_data_structures;
2830
extern crate serialize as rustc_serialize;
2931
extern crate syntax_pos;

0 commit comments

Comments
 (0)