Skip to content

Commit fb7018b

Browse files
committed
Test that non_default_option is not the default option
Otherwise the test is useless and does nothing. This caught 2 bugs in the test suite.
1 parent ae54ee6 commit fb7018b

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

compiler/rustc_interface/src/tests.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@ fn test_codegen_options_tracking_hash() {
391391

392392
macro_rules! untracked {
393393
($name: ident, $non_default_value: expr) => {
394+
assert_ne!(opts.cg.$name, $non_default_value);
394395
opts.cg.$name = $non_default_value;
395396
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
396397
};
@@ -416,6 +417,7 @@ fn test_codegen_options_tracking_hash() {
416417
macro_rules! tracked {
417418
($name: ident, $non_default_value: expr) => {
418419
opts = reference.clone();
420+
assert_ne!(opts.cg.$name, $non_default_value);
419421
opts.cg.$name = $non_default_value;
420422
assert_ne!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
421423
};
@@ -461,6 +463,7 @@ fn test_debugging_options_tracking_hash() {
461463

462464
macro_rules! untracked {
463465
($name: ident, $non_default_value: expr) => {
466+
assert_ne!(opts.debugging_opts.$name, $non_default_value);
464467
opts.debugging_opts.$name = $non_default_value;
465468
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
466469
};
@@ -471,7 +474,7 @@ fn test_debugging_options_tracking_hash() {
471474
untracked!(ast_json, true);
472475
untracked!(ast_json_noexpand, true);
473476
untracked!(borrowck, String::from("other"));
474-
untracked!(deduplicate_diagnostics, true);
477+
untracked!(deduplicate_diagnostics, false);
475478
untracked!(dep_tasks, true);
476479
untracked!(dont_buffer_diagnostics, true);
477480
untracked!(dump_dep_graph, true);
@@ -515,7 +518,7 @@ fn test_debugging_options_tracking_hash() {
515518
untracked!(self_profile_events, Some(vec![String::new()]));
516519
untracked!(span_debug, true);
517520
untracked!(span_free_formats, true);
518-
untracked!(strip, Strip::None);
521+
untracked!(strip, Strip::Debuginfo);
519522
untracked!(terminal_width, Some(80));
520523
untracked!(threads, 99);
521524
untracked!(time, true);
@@ -532,6 +535,7 @@ fn test_debugging_options_tracking_hash() {
532535
macro_rules! tracked {
533536
($name: ident, $non_default_value: expr) => {
534537
opts = reference.clone();
538+
assert_ne!(opts.debugging_opts.$name, $non_default_value);
535539
opts.debugging_opts.$name = $non_default_value;
536540
assert_ne!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
537541
};

compiler/rustc_session/src/config.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ pub enum InstrumentCoverage {
156156
Off,
157157
}
158158

159-
#[derive(Clone, PartialEq, Hash)]
159+
#[derive(Clone, PartialEq, Hash, Debug)]
160160
pub enum LinkerPluginLto {
161161
LinkerPlugin(PathBuf),
162162
LinkerPluginAuto,
@@ -172,7 +172,7 @@ impl LinkerPluginLto {
172172
}
173173
}
174174

175-
#[derive(Clone, PartialEq, Hash)]
175+
#[derive(Clone, PartialEq, Hash, Debug)]
176176
pub enum SwitchWithOptPath {
177177
Enabled(Option<PathBuf>),
178178
Disabled,
@@ -778,7 +778,7 @@ pub enum CrateType {
778778

779779
impl_stable_hash_via_hash!(CrateType);
780780

781-
#[derive(Clone, Hash)]
781+
#[derive(Clone, Hash, Debug, PartialEq, Eq)]
782782
pub enum Passes {
783783
Some(Vec<String>),
784784
All,

compiler/rustc_session/src/options.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1220,7 +1220,7 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
12201220
// - compiler/rustc_interface/src/tests.rs
12211221
}
12221222

1223-
#[derive(Clone, Hash)]
1223+
#[derive(Clone, Hash, PartialEq, Eq, Debug)]
12241224
pub enum WasiExecModel {
12251225
Command,
12261226
Reactor,

0 commit comments

Comments
 (0)