Skip to content

Commit c21b7f6

Browse files
authored
Rollup merge of #108313 - chenyukang:yukang/fix-only-modified, r=oli-obk
Fix compiletest possible crash in option only-modified `fixed` files maybe removed, `unwrap` will crash in this scenario.
2 parents c292def + 6e34e65 commit c21b7f6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/tools/compiletest/src/main.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,8 @@ fn modified_tests(config: &Config, dir: &Path) -> Result<Vec<PathBuf>, String> {
588588
let full_paths = {
589589
let mut full_paths: Vec<PathBuf> = all_paths
590590
.into_iter()
591-
.map(|f| fs::canonicalize(&f).unwrap().with_extension("").with_extension("rs"))
591+
.map(|f| PathBuf::from(f).with_extension("").with_extension("rs"))
592+
.filter_map(|f| if Path::new(&f).exists() { f.canonicalize().ok() } else { None })
592593
.collect();
593594
full_paths.dedup();
594595
full_paths.sort_unstable();

0 commit comments

Comments
 (0)