]> git.lizzy.rs Git - rust.git/commitdiff
Normalize variants of Passes to standard style
authorMark Rousskov <mark.simulacrum@gmail.com>
Thu, 26 Jul 2018 17:22:14 +0000 (11:22 -0600)
committerMark Rousskov <mark.simulacrum@gmail.com>
Sat, 4 Aug 2018 12:53:15 +0000 (06:53 -0600)
src/librustc/session/config.rs
src/librustc_codegen_llvm/back/write.rs

index 27fc5995d735d4b81c63ab54d6b1049bb6b331c1..7d4508e0eea2a96fc14c4029425bf57089dea106 100644 (file)
@@ -12,7 +12,6 @@
 //! command line options.
 
 pub use self::EntryFnType::*;
-pub use self::Passes::*;
 pub use self::DebugInfoLevel::*;
 
 use std::str::FromStr;
@@ -679,15 +678,15 @@ pub enum CrateType {
 
 #[derive(Clone, Hash)]
 pub enum Passes {
-    SomePasses(Vec<String>),
-    AllPasses,
+    Some(Vec<String>),
+    All,
 }
 
 impl Passes {
     pub fn is_empty(&self) -> bool {
         match *self {
-            SomePasses(ref v) => v.is_empty(),
-            AllPasses => false,
+            Passes::Some(ref v) => v.is_empty(),
+            Passes::All => false,
         }
     }
 }
@@ -822,8 +821,7 @@ mod $mod_desc {
 
     #[allow(dead_code)]
     mod $mod_set {
-        use super::{$struct_name, Passes, SomePasses, AllPasses, Sanitizer, Lto,
-                    CrossLangLto};
+        use super::{$struct_name, Passes, Sanitizer, Lto, CrossLangLto};
         use rustc_target::spec::{LinkerFlavor, PanicStrategy, RelroLevel};
         use std::path::PathBuf;
 
@@ -934,13 +932,13 @@ fn parse_opt_uint(slot: &mut Option<usize>, v: Option<&str>) -> bool {
         fn parse_passes(slot: &mut Passes, v: Option<&str>) -> bool {
             match v {
                 Some("all") => {
-                    *slot = AllPasses;
+                    *slot = Passes::All;
                     true
                 }
                 v => {
                     let mut passes = vec![];
                     if parse_list(&mut passes, v) {
-                        *slot = SomePasses(passes);
+                        *slot = Passes::Some(passes);
                         true
                     } else {
                         false
@@ -1103,7 +1101,7 @@ fn parse_cross_lang_lto(slot: &mut CrossLangLto, v: Option<&str>) -> bool {
          "extra data to put in each output filename"),
     codegen_units: Option<usize> = (None, parse_opt_uint, [UNTRACKED],
         "divide crate into N units to optimize in parallel"),
-    remark: Passes = (SomePasses(Vec::new()), parse_passes, [UNTRACKED],
+    remark: Passes = (Passes::Some(Vec::new()), parse_passes, [UNTRACKED],
         "print remarks for these optimization passes (space separated, or \"all\")"),
     no_stack_check: bool = (false, parse_bool, [UNTRACKED],
         "the --no-stack-check flag is deprecated and does nothing"),
@@ -2946,7 +2944,7 @@ fn test_codegen_options_tracking_hash() {
         opts.cg.codegen_units = Some(42);
         assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
 
-        opts.cg.remark = super::SomePasses(vec![String::from("pass1"), String::from("pass2")]);
+        opts.cg.remark = super::Passes::Some(vec![String::from("pass1"), String::from("pass2")]);
         assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
 
         opts.cg.save_temps = true;
index 484d30ab7a5e49c6392618800f856c7732d8dfe8..aec43be0795b17c68e366443049a3c6d596f0c99 100644 (file)
@@ -20,8 +20,7 @@
 use rustc_incremental::{copy_cgu_workproducts_to_incr_comp_cache_dir, in_incr_comp_dir};
 use rustc::dep_graph::{WorkProduct, WorkProductId, WorkProductFileKind};
 use rustc::middle::cstore::{LinkMeta, EncodedMetadata};
-use rustc::session::config::{self, OutputFilenames, OutputType, Passes, SomePasses,
-                             AllPasses, Sanitizer, Lto};
+use rustc::session::config::{self, OutputFilenames, OutputType, Passes, Sanitizer, Lto};
 use rustc::session::Session;
 use rustc::util::nodemap::FxHashMap;
 use time_graph::{self, TimeGraph, Timeline};
@@ -461,8 +460,8 @@ fn drop(&mut self) {
 
         llvm::diagnostic::Optimization(opt) => {
             let enabled = match cgcx.remark {
-                AllPasses => true,
-                SomePasses(ref v) => v.iter().any(|s| *s == opt.pass_name),
+                Passes::All => true,
+                Passes::Some(ref v) => v.iter().any(|s| *s == opt.pass_name),
             };
 
             if enabled {