Skip to content

Commit b3267dc

Browse files
Normalize variants of Passes to standard style
1 parent 2a93442 commit b3267dc

File tree

2 files changed

+12
-15
lines changed

2 files changed

+12
-15
lines changed

src/librustc/session/config.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
//! command line options.
1313
1414
pub use self::EntryFnType::*;
15-
pub use self::Passes::*;
1615
pub use self::DebugInfoLevel::*;
1716

1817
use std::str::FromStr;
@@ -679,15 +678,15 @@ pub enum CrateType {
679678

680679
#[derive(Clone, Hash)]
681680
pub enum Passes {
682-
SomePasses(Vec<String>),
683-
AllPasses,
681+
Some(Vec<String>),
682+
All,
684683
}
685684

686685
impl Passes {
687686
pub fn is_empty(&self) -> bool {
688687
match *self {
689-
SomePasses(ref v) => v.is_empty(),
690-
AllPasses => false,
688+
Passes::Some(ref v) => v.is_empty(),
689+
Passes::All => false,
691690
}
692691
}
693692
}
@@ -822,8 +821,7 @@ macro_rules! options {
822821

823822
#[allow(dead_code)]
824823
mod $mod_set {
825-
use super::{$struct_name, Passes, SomePasses, AllPasses, Sanitizer, Lto,
826-
CrossLangLto};
824+
use super::{$struct_name, Passes, Sanitizer, Lto, CrossLangLto};
827825
use rustc_target::spec::{LinkerFlavor, PanicStrategy, RelroLevel};
828826
use std::path::PathBuf;
829827

@@ -934,13 +932,13 @@ macro_rules! options {
934932
fn parse_passes(slot: &mut Passes, v: Option<&str>) -> bool {
935933
match v {
936934
Some("all") => {
937-
*slot = AllPasses;
935+
*slot = Passes::All;
938936
true
939937
}
940938
v => {
941939
let mut passes = vec![];
942940
if parse_list(&mut passes, v) {
943-
*slot = SomePasses(passes);
941+
*slot = Passes::Some(passes);
944942
true
945943
} else {
946944
false
@@ -1103,7 +1101,7 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
11031101
"extra data to put in each output filename"),
11041102
codegen_units: Option<usize> = (None, parse_opt_uint, [UNTRACKED],
11051103
"divide crate into N units to optimize in parallel"),
1106-
remark: Passes = (SomePasses(Vec::new()), parse_passes, [UNTRACKED],
1104+
remark: Passes = (Passes::Some(Vec::new()), parse_passes, [UNTRACKED],
11071105
"print remarks for these optimization passes (space separated, or \"all\")"),
11081106
no_stack_check: bool = (false, parse_bool, [UNTRACKED],
11091107
"the --no-stack-check flag is deprecated and does nothing"),
@@ -2946,7 +2944,7 @@ mod tests {
29462944
opts.cg.codegen_units = Some(42);
29472945
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
29482946

2949-
opts.cg.remark = super::SomePasses(vec![String::from("pass1"), String::from("pass2")]);
2947+
opts.cg.remark = super::Passes::Some(vec![String::from("pass1"), String::from("pass2")]);
29502948
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
29512949

29522950
opts.cg.save_temps = true;

src/librustc_codegen_llvm/back/write.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ use consts;
2020
use rustc_incremental::{copy_cgu_workproducts_to_incr_comp_cache_dir, in_incr_comp_dir};
2121
use rustc::dep_graph::{WorkProduct, WorkProductId, WorkProductFileKind};
2222
use rustc::middle::cstore::{LinkMeta, EncodedMetadata};
23-
use rustc::session::config::{self, OutputFilenames, OutputType, Passes, SomePasses,
24-
AllPasses, Sanitizer, Lto};
23+
use rustc::session::config::{self, OutputFilenames, OutputType, Passes, Sanitizer, Lto};
2524
use rustc::session::Session;
2625
use rustc::util::nodemap::FxHashMap;
2726
use time_graph::{self, TimeGraph, Timeline};
@@ -461,8 +460,8 @@ unsafe extern "C" fn diagnostic_handler(info: &DiagnosticInfo, user: *mut c_void
461460

462461
llvm::diagnostic::Optimization(opt) => {
463462
let enabled = match cgcx.remark {
464-
AllPasses => true,
465-
SomePasses(ref v) => v.iter().any(|s| *s == opt.pass_name),
463+
Passes::All => true,
464+
Passes::Some(ref v) => v.iter().any(|s| *s == opt.pass_name),
466465
};
467466

468467
if enabled {

0 commit comments

Comments
 (0)