diff options
Diffstat (limited to 'src/libsyntax/diagnostics/metadata.rs')
| -rw-r--r-- | src/libsyntax/diagnostics/metadata.rs | 11 |
1 files changed, 6 insertions, 5 deletions
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 |
