diff options
Diffstat (limited to 'src/librustc/session/config.rs')
| -rw-r--r-- | src/librustc/session/config.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index 6e0372f009e..7e80139b791 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -528,6 +528,25 @@ impl OutputFilenames { pub fn filestem(&self) -> String { format!("{}{}", self.out_filestem, self.extra) } + + pub fn contains_path(&self, input_path: &PathBuf) -> bool { + let input_path = input_path.canonicalize().ok(); + if input_path.is_none() { + return false + } + match self.single_output_file { + Some(ref output_path) => output_path.canonicalize().ok() == input_path, + None => { + for k in self.outputs.keys() { + let output_path = self.path(k.to_owned()); + if output_path.canonicalize().ok() == input_path { + return true; + } + } + false + } + } + } } pub fn host_triple() -> &'static str { @@ -596,6 +615,12 @@ impl Options { ).map(|(src, dst)| (src.clone(), dst.clone())).collect() ) } + + /// True if there will be an output file generated + pub fn will_create_output_file(&self) -> bool { + !self.debugging_opts.parse_only && // The file is just being parsed + !self.debugging_opts.ls // The file is just being queried + } } // The type of entry function, so |
