about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMichael Woerister <michaelwoerister@posteo.net>2017-04-25 10:59:29 +0200
committerMichael Woerister <michaelwoerister@posteo.net>2017-04-26 15:44:02 +0200
commiteb6308fc34bf6e88f5af59b0fddbd9af07cdf327 (patch)
tree4416c295d0078b81496304e6e6f0647f93eb40b4 /src
parent39ffea31df73b20d5549330d446713e56e60e801 (diff)
downloadrust-eb6308fc34bf6e88f5af59b0fddbd9af07cdf327.tar.gz
rust-eb6308fc34bf6e88f5af59b0fddbd9af07cdf327.zip
remap-path-prefix: Validate number of commandline arguments passed.
Diffstat (limited to 'src')
-rw-r--r--src/librustc/session/config.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs
index 888ed2a6d18..99c98f85c32 100644
--- a/src/librustc/session/config.rs
+++ b/src/librustc/session/config.rs
@@ -1443,6 +1443,23 @@ pub fn build_session_options_and_crate_config(matches: &getopts::Matches)
         output_types.insert(OutputType::Exe, None);
     }
 
+    let remap_path_prefix_sources = debugging_opts.remap_path_prefix_from.len();
+    let remap_path_prefix_targets = debugging_opts.remap_path_prefix_from.len();
+
+    if remap_path_prefix_targets < remap_path_prefix_sources {
+        for source in &debugging_opts.remap_path_prefix_from[remap_path_prefix_targets..] {
+            early_error(error_format,
+                &format!("option `-Zremap-path-prefix-from='{}'` does not have \
+                         a corresponding `-Zremap-path-prefix-to`", source))
+        }
+    } else if remap_path_prefix_targets > remap_path_prefix_sources {
+        for target in &debugging_opts.remap_path_prefix_to[remap_path_prefix_sources..] {
+            early_error(error_format,
+                &format!("option `-Zremap-path-prefix-to='{}'` does not have \
+                          a corresponding `-Zremap-path-prefix-from`", target))
+        }
+    }
+
     let mut cg = build_codegen_options(matches, error_format);
 
     // Issue #30063: if user requests llvm-related output to one