"set the threshold for inlining a function (default: 225)"),
panic: Option<PanicStrategy> = (None, parse_panic_strategy,
[TRACKED], "panic strategy to compile crate with"),
+ incremental: Option<String> = (None, parse_opt_string, [UNTRACKED],
+ "enable incremental compilation"),
}
options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
early_error(error_format, "Value for codegen units must be a positive nonzero integer");
}
- if cg.lto && debugging_opts.incremental.is_some() {
+ let incremental = match (&debugging_opts.incremental, &cg.incremental) {
+ (&Some(ref path1), &Some(ref path2)) => {
+ if path1 != path2 {
+ early_error(error_format,
+ &format!("conflicting paths for `-Z incremental` and \
+ `-C incremental` specified: {} versus {}",
+ path1,
+ path2));
+ } else {
+ Some(path1)
+ }
+ }
+ (&Some(ref path), &None) => Some(path),
+ (&None, &Some(ref path)) => Some(path),
+ (&None, &None) => None,
+ }.map(|m| PathBuf::from(m));
+
+ if cg.lto && incremental.is_some() {
early_error(error_format, "can't perform LTO when compiling incrementally");
}
let crate_name = matches.opt_str("crate-name");
- let incremental = debugging_opts.incremental.as_ref().map(|m| PathBuf::from(m));
-
(Options {
crate_types,
optimize: opt_level,
opts.cg.save_temps = true;
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
+ opts.cg.incremental = Some(String::from("abc"));
+ assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
+
// Make sure changing a [TRACKED] option changes the hash
opts = reference.clone();