]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #35159 - michaelwoerister:incr-comp-implies-orbit, r=nikomatsakis
authorbors <bors@rust-lang.org>
Wed, 3 Aug 2016 03:25:50 +0000 (20:25 -0700)
committerGitHub <noreply@github.com>
Wed, 3 Aug 2016 03:25:50 +0000 (20:25 -0700)
Automatically enable -Zorbit if -Zincremental is specified.

Fixes #34973

r? @nikomatsakis

1  2 
src/librustc/session/config.rs

index 1d839be9f5378964c5c4be185790e8631e845bc2,8f25c597b2dc7bdc0cdb10fcfbeffec6602b0e63..6ed91cdbe18bc3c2551c7dbee48803ba11eabb61
@@@ -330,11 -330,6 +330,11 @@@ impl Options 
              self.debugging_opts.dump_dep_graph ||
              self.debugging_opts.query_dep_graph
      }
 +
 +    pub fn single_codegen_unit(&self) -> bool {
 +        self.incremental.is_none() ||
 +        self.cg.codegen_units == 1
 +    }
  }
  
  // The type of entry function, so
@@@ -463,8 -458,6 +463,8 @@@ macro_rules! options 
          pub const parse_bool: Option<&'static str> = None;
          pub const parse_opt_bool: Option<&'static str> =
              Some("one of: `y`, `yes`, `on`, `n`, `no`, or `off`");
 +        pub const parse_all_bool: Option<&'static str> =
 +            Some("one of: `y`, `yes`, `on`, `n`, `no`, or `off`");
          pub const parse_string: Option<&'static str> = Some("a string");
          pub const parse_opt_string: Option<&'static str> = Some("a string");
          pub const parse_list: Option<&'static str> = Some("a space-separated list of strings");
              }
          }
  
 +        fn parse_all_bool(slot: &mut bool, v: Option<&str>) -> bool {
 +            match v {
 +                Some(s) => {
 +                    match s {
 +                        "n" | "no" | "off" => {
 +                            *slot = false;
 +                        }
 +                        "y" | "yes" | "on" => {
 +                            *slot = true;
 +                        }
 +                        _ => { return false; }
 +                    }
 +
 +                    true
 +                },
 +                None => { *slot = true; true }
 +            }
 +        }
 +
          fn parse_opt_string(slot: &mut Option<String>, v: Option<&str>) -> bool {
              match v {
                  Some(s) => { *slot = Some(s.to_string()); true },
@@@ -681,6 -655,7 +681,6 @@@ options! {CodegenOptions, CodegenSetter
          "panic strategy to compile crate with"),
  }
  
 -
  options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
           build_debugging_options, "Z", "debugging",
           DB_OPTIONS, db_type_desc, dbsetters,
            "dump MIR state at various points in translation"),
      dump_mir_dir: Option<String> = (None, parse_opt_string,
            "the directory the MIR is dumped into"),
 -    orbit: bool = (false, parse_bool,
 +    orbit: bool = (true, parse_all_bool,
            "get MIR where it belongs - everywhere; most importantly, in orbit"),
  }
  
@@@ -1168,7 -1143,15 +1168,15 @@@ pub fn build_session_options(matches: &
          })
      });
  
-     let debugging_opts = build_debugging_options(matches, error_format);
+     let mut debugging_opts = build_debugging_options(matches, error_format);
+     // Incremental compilation only works reliably when translation is done via
+     // MIR, so let's enable -Z orbit if necessary (see #34973).
+     if debugging_opts.incremental.is_some() && !debugging_opts.orbit {
+         early_warn(error_format, "Automatically enabling `-Z orbit` because \
+                                   `-Z incremental` was specified");
+         debugging_opts.orbit = true;
+     }
  
      let parse_only = debugging_opts.parse_only;
      let no_trans = debugging_opts.no_trans;