Log when buffering a diagnostic.
This is useful in debugging when and where errors are emitted in logs.
This commit is contained in:
parent
f004cae536
commit
874e08bdd8
4 changed files with 7 additions and 0 deletions
|
@ -2183,6 +2183,7 @@ name = "rustc_errors"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
"atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"log 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rustc_cratesio_shim 0.0.0",
|
"rustc_cratesio_shim 0.0.0",
|
||||||
"rustc_data_structures 0.0.0",
|
"rustc_data_structures 0.0.0",
|
||||||
"serialize 0.0.0",
|
"serialize 0.0.0",
|
||||||
|
|
|
@ -9,6 +9,7 @@ path = "lib.rs"
|
||||||
crate-type = ["dylib"]
|
crate-type = ["dylib"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
log = "0.4"
|
||||||
serialize = { path = "../libserialize" }
|
serialize = { path = "../libserialize" }
|
||||||
syntax_pos = { path = "../libsyntax_pos" }
|
syntax_pos = { path = "../libsyntax_pos" }
|
||||||
rustc_data_structures = { path = "../librustc_data_structures" }
|
rustc_data_structures = { path = "../librustc_data_structures" }
|
||||||
|
|
|
@ -108,6 +108,9 @@ impl<'a> DiagnosticBuilder<'a> {
|
||||||
diagnostic = ::std::ptr::read(&self.diagnostic);
|
diagnostic = ::std::ptr::read(&self.diagnostic);
|
||||||
::std::mem::forget(self);
|
::std::mem::forget(self);
|
||||||
};
|
};
|
||||||
|
// Logging here is useful to help track down where in logs an error was
|
||||||
|
// actually emitted.
|
||||||
|
debug!("buffer: diagnostic={:?}", diagnostic);
|
||||||
buffered_diagnostics.push(diagnostic);
|
buffered_diagnostics.push(diagnostic);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,8 @@ extern crate atty;
|
||||||
extern crate termcolor;
|
extern crate termcolor;
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
extern crate libc;
|
extern crate libc;
|
||||||
|
#[macro_use]
|
||||||
|
extern crate log;
|
||||||
extern crate rustc_data_structures;
|
extern crate rustc_data_structures;
|
||||||
extern crate serialize as rustc_serialize;
|
extern crate serialize as rustc_serialize;
|
||||||
extern crate syntax_pos;
|
extern crate syntax_pos;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue