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.
This commit is contained in:
Matthias Krüger 2023-02-21 23:02:01 +01:00 committed by GitHub
commit c21b7f6914
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -588,7 +588,8 @@ fn modified_tests(config: &Config, dir: &Path) -> Result<Vec<PathBuf>, String> {
let full_paths = {
let mut full_paths: Vec<PathBuf> = all_paths
.into_iter()
.map(|f| fs::canonicalize(&f).unwrap().with_extension("").with_extension("rs"))
.map(|f| PathBuf::from(f).with_extension("").with_extension("rs"))
.filter_map(|f| if Path::new(&f).exists() { f.canonicalize().ok() } else { None })
.collect();
full_paths.dedup();
full_paths.sort_unstable();