about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorDavid Wood <david@davidtw.co>2018-09-06 13:07:14 +0200
committerDavid Wood <david@davidtw.co>2018-09-18 13:45:24 +0200
commit874e08bdd802f527bc1e1e2c41442796e4d44c6b (patch)
tree263d27e1b5120a93374c3b8c4246171c9bee9997 /src
parentf004cae5360c4a3f365c7f7525b4293559201ce2 (diff)
downloadrust-874e08bdd802f527bc1e1e2c41442796e4d44c6b.tar.gz
rust-874e08bdd802f527bc1e1e2c41442796e4d44c6b.zip
Log when buffering a diagnostic.
This is useful in debugging when and where errors are emitted in
logs.
Diffstat (limited to 'src')
-rw-r--r--src/Cargo.lock1
-rw-r--r--src/librustc_errors/Cargo.toml1
-rw-r--r--src/librustc_errors/diagnostic_builder.rs3
-rw-r--r--src/librustc_errors/lib.rs2
4 files changed, 7 insertions, 0 deletions
diff --git a/src/Cargo.lock b/src/Cargo.lock
index 412cbbfb2db..b7d36929f54 100644
--- a/src/Cargo.lock
+++ b/src/Cargo.lock
@@ -2183,6 +2183,7 @@ name = "rustc_errors"
 version = "0.0.0"
 dependencies = [
  "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_data_structures 0.0.0",
  "serialize 0.0.0",
diff --git a/src/librustc_errors/Cargo.toml b/src/librustc_errors/Cargo.toml
index 101ca0650c8..b24f8ddf4d9 100644
--- a/src/librustc_errors/Cargo.toml
+++ b/src/librustc_errors/Cargo.toml
@@ -9,6 +9,7 @@ path = "lib.rs"
 crate-type = ["dylib"]
 
 [dependencies]
+log = "0.4"
 serialize = { path = "../libserialize" }
 syntax_pos = { path = "../libsyntax_pos" }
 rustc_data_structures = { path = "../librustc_data_structures" }
diff --git a/src/librustc_errors/diagnostic_builder.rs b/src/librustc_errors/diagnostic_builder.rs
index 5e962a4af32..a4b5b000f87 100644
--- a/src/librustc_errors/diagnostic_builder.rs
+++ b/src/librustc_errors/diagnostic_builder.rs
@@ -108,6 +108,9 @@ impl<'a> DiagnosticBuilder<'a> {
             diagnostic = ::std::ptr::read(&self.diagnostic);
             ::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);
     }
 
diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs
index d0ea6fba5eb..266aa326981 100644
--- a/src/librustc_errors/lib.rs
+++ b/src/librustc_errors/lib.rs
@@ -23,6 +23,8 @@ extern crate atty;
 extern crate termcolor;
 #[cfg(unix)]
 extern crate libc;
+#[macro_use]
+extern crate log;
 extern crate rustc_data_structures;
 extern crate serialize as rustc_serialize;
 extern crate syntax_pos;