about summary refs log tree commit diff
path: root/src/librustc_interface
diff options
context:
space:
mode:
authorNicholas Nethercote <nnethercote@mozilla.com>2020-04-21 10:06:13 +1000
committerNicholas Nethercote <nnethercote@mozilla.com>2020-04-22 22:44:37 +1000
commit4348f31e3bb0ee20825fd304d1638db53201750f (patch)
treec7218efa4b68e6ec41972fb72a3c9402253c5bd6 /src/librustc_interface
parent4bfd62acb12a5e628d28950f9f94c3499216f10c (diff)
Alphabetize the `-C` and `-Z` options.
In the code, test, and docs, because it makes it much easier to find
things.

Other than adding the comments about alphabetical order, this commit
only moves things around.
Diffstat (limited to 'src/librustc_interface')
-rw-r--r--src/librustc_interface/tests.rs186
1 files changed, 109 insertions, 77 deletions
diff --git a/src/librustc_interface/tests.rs b/src/librustc_interface/tests.rs
index 02fad11d9b8..544c512a99e 100644
--- a/src/librustc_interface/tests.rs
+++ b/src/librustc_interface/tests.rs
@@ -374,80 +374,84 @@ fn test_codegen_options_tracking_hash() {
     let reference = Options::default();
     let mut opts = Options::default();
 
-    // Make sure the changing an [UNTRACKED] option leaves the hash unchanged
+    // Make sure that changing an [UNTRACKED] option leaves the hash unchanged.
+    // This list is in alphabetical order.
+
     opts.cg.ar = String::from("abc");
     assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
 
-    opts.cg.linker = Some(PathBuf::from("linker"));
+    opts.cg.codegen_units = Some(42);
     assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
 
-    opts.cg.link_args = vec![String::from("abc"), String::from("def")];
+    opts.cg.extra_filename = String::from("extra-filename");
     assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
 
-    opts.cg.link_dead_code = true;
+    opts.cg.incremental = Some(String::from("abc"));
     assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
 
-    opts.cg.rpath = true;
+    opts.cg.link_args = vec![String::from("abc"), String::from("def")];
     assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
 
-    opts.cg.extra_filename = String::from("extra-filename");
+    opts.cg.link_dead_code = true;
     assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
 
-    opts.cg.codegen_units = Some(42);
+    opts.cg.linker = Some(PathBuf::from("linker"));
     assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
 
     opts.cg.remark = Passes::Some(vec![String::from("pass1"), String::from("pass2")]);
     assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
 
-    opts.cg.save_temps = true;
+    opts.cg.rpath = true;
     assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
 
-    opts.cg.incremental = Some(String::from("abc"));
+    opts.cg.save_temps = true;
     assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
 
-    // Make sure changing a [TRACKED] option changes the hash
+    // Make sure that changing a [TRACKED] option changes the hash.
+    // This list is in alphabetical order.
+
     opts = reference.clone();
-    opts.cg.lto = LtoCli::Fat;
+    opts.cg.code_model = Some(String::from("code model"));
     assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
 
     opts = reference.clone();
-    opts.cg.target_cpu = Some(String::from("abc"));
+    opts.cg.debug_assertions = Some(true);
     assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
 
     opts = reference.clone();
-    opts.cg.target_feature = String::from("all the features, all of them");
+    opts.cg.debuginfo = 0xdeadbeef;
     assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
 
     opts = reference.clone();
-    opts.cg.passes = vec![String::from("1"), String::from("2")];
+    opts.cg.debuginfo = 0xba5eba11;
     assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
 
     opts = reference.clone();
-    opts.cg.llvm_args = vec![String::from("1"), String::from("2")];
+    opts.cg.force_frame_pointers = Some(false);
     assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
 
     opts = reference.clone();
-    opts.cg.overflow_checks = Some(true);
+    opts.cg.inline_threshold = Some(0xf007ba11);
     assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
 
     opts = reference.clone();
-    opts.cg.no_prepopulate_passes = true;
+    opts.cg.linker_plugin_lto = LinkerPluginLto::LinkerPluginAuto;
     assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
 
     opts = reference.clone();
-    opts.cg.no_vectorize_loops = true;
+    opts.cg.llvm_args = vec![String::from("1"), String::from("2")];
     assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
 
     opts = reference.clone();
-    opts.cg.no_vectorize_slp = true;
+    opts.cg.lto = LtoCli::Fat;
     assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
 
     opts = reference.clone();
-    opts.cg.soft_float = true;
+    opts.cg.metadata = vec![String::from("A"), String::from("B")];
     assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
 
     opts = reference.clone();
-    opts.cg.prefer_dynamic = true;
+    opts.cg.no_prepopulate_passes = true;
     assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
 
     opts = reference.clone();
@@ -455,55 +459,55 @@ fn test_codegen_options_tracking_hash() {
     assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
 
     opts = reference.clone();
-    opts.cg.relocation_model = Some(String::from("relocation model"));
+    opts.cg.no_vectorize_loops = true;
     assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
 
     opts = reference.clone();
-    opts.cg.code_model = Some(String::from("code model"));
+    opts.cg.no_vectorize_slp = true;
     assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
 
     opts = reference.clone();
-    opts.debugging_opts.tls_model = Some(String::from("tls model"));
+    opts.cg.overflow_checks = Some(true);
     assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
 
     opts = reference.clone();
-    opts.cg.profile_generate = SwitchWithOptPath::Enabled(None);
-    assert_ne!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
+    opts.cg.panic = Some(PanicStrategy::Abort);
+    assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
 
     opts = reference.clone();
-    opts.cg.profile_use = Some(PathBuf::from("abc"));
-    assert_ne!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
+    opts.cg.passes = vec![String::from("1"), String::from("2")];
+    assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
 
     opts = reference.clone();
-    opts.cg.metadata = vec![String::from("A"), String::from("B")];
+    opts.cg.prefer_dynamic = true;
     assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
 
     opts = reference.clone();
-    opts.cg.debuginfo = 0xdeadbeef;
-    assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
+    opts.cg.profile_generate = SwitchWithOptPath::Enabled(None);
+    assert_ne!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
 
     opts = reference.clone();
-    opts.cg.debuginfo = 0xba5eba11;
-    assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
+    opts.cg.profile_use = Some(PathBuf::from("abc"));
+    assert_ne!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
 
     opts = reference.clone();
-    opts.cg.force_frame_pointers = Some(false);
+    opts.cg.relocation_model = Some(String::from("relocation model"));
     assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
 
     opts = reference.clone();
-    opts.cg.debug_assertions = Some(true);
+    opts.cg.soft_float = true;
     assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
 
     opts = reference.clone();
-    opts.cg.inline_threshold = Some(0xf007ba11);
+    opts.cg.target_cpu = Some(String::from("abc"));
     assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
 
     opts = reference.clone();
-    opts.cg.panic = Some(PanicStrategy::Abort);
+    opts.cg.target_feature = String::from("all the features, all of them");
     assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
 
     opts = reference.clone();
-    opts.cg.linker_plugin_lto = LinkerPluginLto::LinkerPluginAuto;
+    opts.debugging_opts.tls_model = Some(String::from("tls model"));
     assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
 
     opts = reference.clone();
@@ -516,113 +520,141 @@ fn test_debugging_options_tracking_hash() {
     let reference = Options::default();
     let mut opts = Options::default();
 
-    // Make sure the changing an [UNTRACKED] option leaves the hash unchanged
-    opts.debugging_opts.verbose = true;
+    // Make sure that changing an [UNTRACKED] option leaves the hash unchanged.
+    // This list is in alphabetical order.
+
+    opts.debugging_opts.ast_json = true;
     assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
-    opts.debugging_opts.time_passes = true;
+
+    opts.debugging_opts.ast_json_noexpand = true;
     assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
-    opts.debugging_opts.time_llvm_passes = true;
+
+    opts.debugging_opts.borrowck_stats = true;
     assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
-    opts.debugging_opts.input_stats = true;
+
+    opts.debugging_opts.dump_dep_graph = true;
     assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
-    opts.debugging_opts.borrowck_stats = true;
+
+    opts.debugging_opts.dump_mir = Some(String::from("abc"));
     assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
-    opts.debugging_opts.meta_stats = true;
+
+    opts.debugging_opts.dump_mir_dataflow = true;
     assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
-    opts.debugging_opts.print_link_args = true;
+
+    opts.debugging_opts.dump_mir_dir = String::from("abc");
     assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
-    opts.debugging_opts.print_llvm_passes = true;
+
+    opts.debugging_opts.dump_mir_graphviz = true;
     assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
-    opts.debugging_opts.ast_json = true;
+
+    opts.debugging_opts.input_stats = true;
     assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
-    opts.debugging_opts.ast_json_noexpand = true;
+
+    opts.debugging_opts.keep_hygiene_data = true;
     assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
+
     opts.debugging_opts.ls = true;
     assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
-    opts.debugging_opts.save_analysis = true;
+
+    opts.debugging_opts.meta_stats = true;
     assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
-    opts.debugging_opts.print_region_graph = true;
+
+    opts.debugging_opts.no_analysis = true;
     assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
+
     opts.debugging_opts.parse_only = true;
     assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
-    opts.debugging_opts.dump_dep_graph = true;
+
+    opts.debugging_opts.print_link_args = true;
     assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
-    opts.debugging_opts.query_dep_graph = true;
+
+    opts.debugging_opts.print_llvm_passes = true;
     assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
-    opts.debugging_opts.no_analysis = true;
+
+    opts.debugging_opts.print_mono_items = Some(String::from("abc"));
     assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
-    opts.debugging_opts.unstable_options = true;
+
+    opts.debugging_opts.print_region_graph = true;
     assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
-    opts.debugging_opts.trace_macros = true;
+
+    opts.debugging_opts.query_dep_graph = true;
     assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
-    opts.debugging_opts.keep_hygiene_data = true;
+
+    opts.debugging_opts.save_analysis = true;
     assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
-    opts.debugging_opts.print_mono_items = Some(String::from("abc"));
+
+    opts.debugging_opts.time_llvm_passes = true;
     assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
-    opts.debugging_opts.dump_mir = Some(String::from("abc"));
+
+    opts.debugging_opts.time_passes = true;
     assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
-    opts.debugging_opts.dump_mir_dir = String::from("abc");
+
+    opts.debugging_opts.trace_macros = true;
     assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
-    opts.debugging_opts.dump_mir_graphviz = true;
+
+    opts.debugging_opts.unstable_options = true;
     assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
-    opts.debugging_opts.dump_mir_dataflow = true;
+
+    opts.debugging_opts.verbose = true;
     assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
 
-    // Make sure changing a [TRACKED] option changes the hash
+    // Make sure that changing a [TRACKED] option changes the hash.
+    // This list is in alphabetical order.
+
     opts = reference.clone();
-    opts.debugging_opts.asm_comments = true;
+    opts.debugging_opts.allow_features = Some(vec![String::from("lang_items")]);
     assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
 
     opts = reference.clone();
-    opts.debugging_opts.verify_llvm_ir = true;
+    opts.debugging_opts.asm_comments = true;
     assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
 
     opts = reference.clone();
-    opts.debugging_opts.no_landing_pads = true;
+    opts.debugging_opts.fewer_names = true;
     assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
 
     opts = reference.clone();
-    opts.debugging_opts.fewer_names = true;
+    opts.debugging_opts.force_overflow_checks = Some(true);
     assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
 
     opts = reference.clone();
-    opts.debugging_opts.no_codegen = true;
+    opts.debugging_opts.merge_functions = Some(MergeFunctions::Disabled);
     assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
 
     opts = reference.clone();
-    opts.debugging_opts.treat_err_as_bug = Some(1);
+    opts.debugging_opts.mir_opt_level = 3;
     assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
 
     opts = reference.clone();
-    opts.debugging_opts.report_delayed_bugs = true;
+    opts.debugging_opts.no_codegen = true;
     assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
 
     opts = reference.clone();
-    opts.debugging_opts.force_overflow_checks = Some(true);
+    opts.debugging_opts.no_landing_pads = true;
     assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
 
     opts = reference.clone();
-    opts.debugging_opts.show_span = Some(String::from("abc"));
+    opts.debugging_opts.relro_level = Some(RelroLevel::Full);
     assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
 
     opts = reference.clone();
-    opts.debugging_opts.mir_opt_level = 3;
+    opts.debugging_opts.report_delayed_bugs = true;
     assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
 
     opts = reference.clone();
-    opts.debugging_opts.relro_level = Some(RelroLevel::Full);
+    opts.debugging_opts.show_span = Some(String::from("abc"));
     assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
 
     opts = reference.clone();
-    opts.debugging_opts.merge_functions = Some(MergeFunctions::Disabled);
+    opts.debugging_opts.symbol_mangling_version = SymbolManglingVersion::V0;
     assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
 
     opts = reference.clone();
-    opts.debugging_opts.allow_features = Some(vec![String::from("lang_items")]);
+    opts.debugging_opts.treat_err_as_bug = Some(1);
     assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
 
     opts = reference.clone();
-    opts.debugging_opts.symbol_mangling_version = SymbolManglingVersion::V0;
+    opts.debugging_opts.verify_llvm_ir = true;
     assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
 }