Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'xtask/src/pgo.rs')
| -rw-r--r-- | xtask/src/pgo.rs | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/xtask/src/pgo.rs b/xtask/src/pgo.rs index 7f7b3311d9..0c6f499811 100644 --- a/xtask/src/pgo.rs +++ b/xtask/src/pgo.rs @@ -53,14 +53,23 @@ pub(crate) fn gather_pgo_profile<'a>( // Merge profiles into a single file let merged_profile = pgo_dir.join("merged.profdata"); - let profile_files = std::fs::read_dir(pgo_dir)?.filter_map(|entry| { - let entry = entry.ok()?; - if entry.path().extension() == Some(OsStr::new("profraw")) { - Some(entry.path().to_str().unwrap().to_owned()) - } else { - None - } - }); + let profile_files = std::fs::read_dir(pgo_dir)? + .filter_map(|entry| { + let entry = entry.ok()?; + if entry.path().extension() == Some(OsStr::new("profraw")) { + Some(entry.path().to_str().unwrap().to_owned()) + } else { + None + } + }) + .collect::<Vec<_>>(); + + if profile_files.is_empty() { + anyhow::bail!( + "rust-analyzer analysis-stats produced no pgo files. This is a bug in rust-analyzer; please file an issue." + ); + } + cmd!(sh, "{llvm_profdata} merge {profile_files...} -o {merged_profile}").run().context( "cannot merge PGO profiles. Do you have the rustup `llvm-tools` component installed?", )?; |