Skip to content

Commit 0099f6b

Browse files
committed
Add some simple tests of how -C prefer-dynamic interacts with dependency tracking.
1 parent 5d77479 commit 0099f6b

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

compiler/rustc_interface/src/tests.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rustc_session::config::{build_configuration, build_session_options, to_crate
88
use rustc_session::config::{rustc_optgroups, ErrorOutputType, ExternLocation, Options, Passes};
99
use rustc_session::config::{CFGuard, ExternEntry, LinkerPluginLto, LtoCli, SwitchWithOptPath};
1010
use rustc_session::config::{
11-
Externs, OutputType, OutputTypes, SymbolManglingVersion, WasiExecModel,
11+
Externs, OutputType, OutputTypes, PreferDynamicSet, SymbolManglingVersion, WasiExecModel,
1212
};
1313
use rustc_session::lint::Level;
1414
use rustc_session::search_paths::SearchPath;
@@ -582,14 +582,24 @@ fn test_codegen_options_tracking_hash() {
582582
tracked!(overflow_checks, Some(true));
583583
tracked!(panic, Some(PanicStrategy::Abort));
584584
tracked!(passes, vec![String::from("1"), String::from("2")]);
585-
tracked!(prefer_dynamic, true);
585+
tracked!(prefer_dynamic, PreferDynamicSet::every_crate());
586586
tracked!(profile_generate, SwitchWithOptPath::Enabled(None));
587587
tracked!(profile_use, Some(PathBuf::from("abc")));
588588
tracked!(relocation_model, Some(RelocModel::Pic));
589589
tracked!(soft_float, true);
590590
tracked!(split_debuginfo, Some(SplitDebuginfo::Packed));
591591
tracked!(target_cpu, Some(String::from("abc")));
592592
tracked!(target_feature, String::from("all the features, all of them"));
593+
594+
// Check that changes to the ordering of input to `-C prefer-dynamic=crate,...`
595+
// does not cause the dependency tracking hash to change.
596+
{
597+
let mut v1 = Options::default();
598+
let mut v2 = Options::default();
599+
v1.cg.prefer_dynamic = PreferDynamicSet::subset(["a", "b"].iter());
600+
v2.cg.prefer_dynamic = PreferDynamicSet::subset(["b", "a"].iter());
601+
assert_same_hash(&v1, &v2);
602+
}
593603
}
594604

595605
#[test]

0 commit comments

Comments
 (0)