Skip to content

Commit

Permalink
Rename found_paths to found_path_stems
Browse files Browse the repository at this point in the history
  • Loading branch information
Zalathar committed Oct 18, 2024
1 parent c4c62a5 commit 3f8d87b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/tools/compiletest/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ struct TestCollectorCx {
/// Mutable state used during test collection.
struct TestCollector {
tests: Vec<test::TestDescAndFn>,
found_paths: HashSet<PathBuf>,
found_path_stems: HashSet<PathBuf>,
poisoned: bool,
}

Expand All @@ -573,21 +573,21 @@ pub fn collect_and_make_tests(config: Arc<Config>) -> Vec<test::TestDescAndFn> {

let cx = TestCollectorCx { config, cache, common_inputs_stamp, modified_tests };
let mut collector =
TestCollector { tests: vec![], found_paths: HashSet::new(), poisoned: false };
TestCollector { tests: vec![], found_path_stems: HashSet::new(), poisoned: false };

collect_tests_from_dir(&cx, &mut collector, &cx.config.src_base, &PathBuf::new())
.unwrap_or_else(|reason| {
panic!("Could not read tests from {}: {reason}", cx.config.src_base.display())
});

let TestCollector { tests, found_paths, poisoned } = collector;
let TestCollector { tests, found_path_stems, poisoned } = collector;

if poisoned {
eprintln!();
panic!("there are errors in tests");
}

check_overlapping_tests(&found_paths);
check_for_overlapping_test_paths(&found_path_stems);

tests
}
Expand Down Expand Up @@ -732,7 +732,7 @@ fn collect_tests_from_dir(

// Record the stem of the test file, to check for overlaps later.
let rel_test_path = relative_dir_path.join(file_path.file_stem().unwrap());
collector.found_paths.insert(rel_test_path);
collector.found_path_stems.insert(rel_test_path);

let paths =
TestPaths { file: file_path, relative_dir: relative_dir_path.to_path_buf() };
Expand Down Expand Up @@ -1023,11 +1023,11 @@ fn make_test_closure(
/// To avoid problems, we forbid test names from overlapping in this way.
///
/// See <https://github.com/rust-lang/rust/pull/109509> for more context.
fn check_overlapping_tests(found_paths: &HashSet<PathBuf>) {
fn check_for_overlapping_test_paths(found_path_stems: &HashSet<PathBuf>) {
let mut collisions = Vec::new();
for path in found_paths {
for path in found_path_stems {
for ancestor in path.ancestors().skip(1) {
if found_paths.contains(ancestor) {
if found_path_stems.contains(ancestor) {
collisions.push((path, ancestor));
}
}
Expand Down

0 comments on commit 3f8d87b

Please sign in to comment.