about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2018-01-02 16:21:35 -0800
committerAlex Crichton <alex@alexcrichton.com>2018-01-04 07:21:22 -0800
commit8c9bf663d4a8074e4955d1ad3f85a3b82e946297 (patch)
tree60ba9e4cd702044773e52321995bd54fc5c545c8 /src
parent53fd0c50d847edb30c5673d7c4625ad8ee82db8f (diff)
rustc: Don't use relative paths for extended errors
These no longer work now that Cargo changes the cwd of rustc while it's running.
Instead use an absolute path that's set by rustbuild.
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/builder.rs4
-rw-r--r--src/bootstrap/check.rs3
-rw-r--r--src/bootstrap/doc.rs3
-rw-r--r--src/bootstrap/lib.rs5
-rw-r--r--src/librustc/lib.rs1
-rw-r--r--src/librustc_const_eval/lib.rs1
-rw-r--r--src/librustc_driver/lib.rs8
-rw-r--r--src/librustc_metadata/lib.rs1
-rw-r--r--src/librustc_mir/lib.rs1
-rw-r--r--src/librustc_passes/lib.rs1
-rw-r--r--src/librustc_plugin/lib.rs1
-rw-r--r--src/librustc_privacy/lib.rs1
-rw-r--r--src/librustc_resolve/lib.rs1
-rw-r--r--src/librustc_trans/lib.rs1
-rw-r--r--src/librustc_typeck/lib.rs1
-rw-r--r--src/libsyntax/diagnostics/metadata.rs11
-rw-r--r--src/libsyntax/lib.rs1
17 files changed, 36 insertions, 9 deletions
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index 16de31406f8..ce30d1f4cec 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -484,8 +484,8 @@ impl<'a> Builder<'a> {
              } else {
                  PathBuf::from("/path/to/nowhere/rustdoc/not/required")
              })
-             .env("TEST_MIRI", self.config.test_miri.to_string());
-
+             .env("TEST_MIRI", self.config.test_miri.to_string())
+             .env("RUSTC_ERROR_METADATA_DST", self.extended_error_dir());
         if let Some(n) = self.config.rust_codegen_units {
             cargo.env("RUSTC_CODEGEN_UNITS", n.to_string());
         }
diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs
index 714c01aa504..cc9be3cec34 100644
--- a/src/bootstrap/check.rs
+++ b/src/bootstrap/check.rs
@@ -975,7 +975,8 @@ impl Step for ErrorIndex {
         build.run(builder.tool_cmd(Tool::ErrorIndex)
                     .arg("markdown")
                     .arg(&output)
-                    .env("CFG_BUILD", &build.build));
+                    .env("CFG_BUILD", &build.build)
+                    .env("RUSTC_ERROR_METADATA_DST", build.extended_error_dir()));
 
         markdown_test(builder, compiler, &output);
     }
diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs
index 3c12cfc4c7f..832da24c994 100644
--- a/src/bootstrap/doc.rs
+++ b/src/bootstrap/doc.rs
@@ -671,7 +671,8 @@ impl Step for ErrorIndex {
         index.arg(out.join("error-index.html"));
 
         // FIXME: shouldn't have to pass this env var
-        index.env("CFG_BUILD", &build.build);
+        index.env("CFG_BUILD", &build.build)
+             .env("RUSTC_ERROR_METADATA_DST", build.extended_error_dir());
 
         build.run(&mut index);
     }
diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
index d6dc44034a7..948bf29bbac 100644
--- a/src/bootstrap/lib.rs
+++ b/src/bootstrap/lib.rs
@@ -718,6 +718,11 @@ impl Build {
         self.config.python.as_ref().unwrap()
     }
 
+    /// Temporary directory that extended error information is emitted to.
+    fn extended_error_dir(&self) -> PathBuf {
+        self.out.join("tmp/extended-error-metadata")
+    }
+
     /// Tests whether the `compiler` compiling for `target` should be forced to
     /// use a stage1 compiler instead.
     ///
diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs
index becaf78f7ec..44f23c11b04 100644
--- a/src/librustc/lib.rs
+++ b/src/librustc/lib.rs
@@ -175,4 +175,5 @@ fn noop() {
 
 
 // Build the diagnostics array at the end so that the metadata includes error use sites.
+#[cfg(not(stage0))] // remove after the next snapshot
 __build_diagnostic_array! { librustc, DIAGNOSTICS }
diff --git a/src/librustc_const_eval/lib.rs b/src/librustc_const_eval/lib.rs
index 9d636b48bd0..b4563f6cf2e 100644
--- a/src/librustc_const_eval/lib.rs
+++ b/src/librustc_const_eval/lib.rs
@@ -56,4 +56,5 @@ pub fn provide(providers: &mut Providers) {
 }
 
 // Build the diagnostics array at the end so that the metadata includes error use sites.
+#[cfg(not(stage0))] // remove after the next snapshot
 __build_diagnostic_array! { librustc_const_eval, DIAGNOSTICS }
diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs
index 5fa82365928..223c602ccd3 100644
--- a/src/librustc_driver/lib.rs
+++ b/src/librustc_driver/lib.rs
@@ -1268,6 +1268,14 @@ fn exit_on_err() -> ! {
     panic!();
 }
 
+#[cfg(stage0)]
+pub fn diagnostics_registry() -> errors::registry::Registry {
+    use errors::registry::Registry;
+
+    Registry::new(&[])
+}
+
+#[cfg(not(stage0))]
 pub fn diagnostics_registry() -> errors::registry::Registry {
     use errors::registry::Registry;
 
diff --git a/src/librustc_metadata/lib.rs b/src/librustc_metadata/lib.rs
index a65ddcecf88..18117533c18 100644
--- a/src/librustc_metadata/lib.rs
+++ b/src/librustc_metadata/lib.rs
@@ -58,4 +58,5 @@ pub mod cstore;
 pub mod dynamic_lib;
 pub mod locator;
 
+#[cfg(not(stage0))] // remove after the next snapshot
 __build_diagnostic_array! { librustc_metadata, DIAGNOSTICS }
diff --git a/src/librustc_mir/lib.rs b/src/librustc_mir/lib.rs
index 4556a8ecc4b..e9e7e688f1f 100644
--- a/src/librustc_mir/lib.rs
+++ b/src/librustc_mir/lib.rs
@@ -79,4 +79,5 @@ pub fn provide(providers: &mut Providers) {
     providers.const_eval = interpret::const_eval_provider;
 }
 
+#[cfg(not(stage0))] // remove after the next snapshot
 __build_diagnostic_array! { librustc_mir, DIAGNOSTICS }
diff --git a/src/librustc_passes/lib.rs b/src/librustc_passes/lib.rs
index 9a150abea66..754c3bbd074 100644
--- a/src/librustc_passes/lib.rs
+++ b/src/librustc_passes/lib.rs
@@ -45,6 +45,7 @@ mod mir_stats;
 pub mod no_asm;
 pub mod static_recursion;
 
+#[cfg(not(stage0))] // remove after the next snapshot
 __build_diagnostic_array! { librustc_passes, DIAGNOSTICS }
 
 pub fn provide(providers: &mut Providers) {
diff --git a/src/librustc_plugin/lib.rs b/src/librustc_plugin/lib.rs
index c0f830f1fbe..38df5986ce2 100644
--- a/src/librustc_plugin/lib.rs
+++ b/src/librustc_plugin/lib.rs
@@ -82,4 +82,5 @@ pub mod registry;
 pub mod load;
 pub mod build;
 
+#[cfg(not(stage0))] // remove after the next snapshot
 __build_diagnostic_array! { librustc_plugin, DIAGNOSTICS }
diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs
index bb0a4be49c2..d1dc54e7c3a 100644
--- a/src/librustc_privacy/lib.rs
+++ b/src/librustc_privacy/lib.rs
@@ -1725,4 +1725,5 @@ fn privacy_access_levels<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
     Rc::new(visitor.access_levels)
 }
 
+#[cfg(not(stage0))] // remove after the next snapshot
 __build_diagnostic_array! { librustc_privacy, DIAGNOSTICS }
diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs
index b49d9d2c7cf..f7d1c88fbc8 100644
--- a/src/librustc_resolve/lib.rs
+++ b/src/librustc_resolve/lib.rs
@@ -4089,4 +4089,5 @@ pub enum MakeGlobMap {
     No,
 }
 
+#[cfg(not(stage0))] // remove after the next snapshot
 __build_diagnostic_array! { librustc_resolve, DIAGNOSTICS }
diff --git a/src/librustc_trans/lib.rs b/src/librustc_trans/lib.rs
index c4849c621e8..039dd94465d 100644
--- a/src/librustc_trans/lib.rs
+++ b/src/librustc_trans/lib.rs
@@ -328,4 +328,5 @@ pub struct CrateInfo {
     used_crates_dynamic: Vec<(CrateNum, LibSource)>,
 }
 
+#[cfg(not(stage0))] // remove after the next snapshot
 __build_diagnostic_array! { librustc_trans, DIAGNOSTICS }
diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs
index 0b2f59abf4f..1dc98bc7a00 100644
--- a/src/librustc_typeck/lib.rs
+++ b/src/librustc_typeck/lib.rs
@@ -380,4 +380,5 @@ pub fn hir_trait_to_predicates<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, hir_trait:
     (principal, projections)
 }
 
+#[cfg(not(stage0))] // remove after the next snapshot
 __build_diagnostic_array! { librustc_typeck, DIAGNOSTICS }
diff --git a/src/libsyntax/diagnostics/metadata.rs b/src/libsyntax/diagnostics/metadata.rs
index 5f06475919f..dc01a79190b 100644
--- a/src/libsyntax/diagnostics/metadata.rs
+++ b/src/libsyntax/diagnostics/metadata.rs
@@ -14,9 +14,10 @@
 //! currently always a crate name.
 
 use std::collections::BTreeMap;
-use std::path::PathBuf;
+use std::env;
 use std::fs::{remove_file, create_dir_all, File};
 use std::io::Write;
+use std::path::PathBuf;
 use std::error::Error;
 use rustc_serialize::json::as_json;
 
@@ -24,9 +25,6 @@ use syntax_pos::{Span, FileName};
 use ext::base::ExtCtxt;
 use diagnostics::plugin::{ErrorMap, ErrorInfo};
 
-// Default metadata directory to use for extended error JSON.
-const ERROR_METADATA_PREFIX: &'static str = "tmp/extended-errors";
-
 /// JSON encodable/decodable version of `ErrorInfo`.
 #[derive(PartialEq, RustcDecodable, RustcEncodable)]
 pub struct ErrorMetadata {
@@ -59,7 +57,10 @@ impl ErrorLocation {
 ///
 /// See `output_metadata`.
 pub fn get_metadata_dir(prefix: &str) -> PathBuf {
-    PathBuf::from(ERROR_METADATA_PREFIX).join(prefix)
+    env::var_os("RUSTC_ERROR_METADATA_DST")
+        .map(PathBuf::from)
+        .expect("env var `RUSTC_ERROR_METADATA_DST` isn't set")
+        .join(prefix)
 }
 
 /// Map `name` to a path in the given directory: <directory>/<name>.json
diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs
index 0b51f2e9814..d7f7ff554db 100644
--- a/src/libsyntax/lib.rs
+++ b/src/libsyntax/lib.rs
@@ -151,4 +151,5 @@ pub mod ext {
 #[cfg(test)]
 mod test_snippet;
 
+#[cfg(not(stage0))] // remove after the next snapshot
 __build_diagnostic_array! { libsyntax, DIAGNOSTICS }