indexed_docs: Normalize - in crate names to _ when computing rustdoc output path (#16234)

This PR fixes an issue where crate names that included `-`s would not
work properly when indexing them with rustdoc, due to the output
directories using `_` instead of `-`.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-08-14 12:37:02 -04:00 committed by GitHub
parent 8df21f7bcd
commit 8ad7d69378
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -91,7 +91,7 @@ impl IndexedDocsProvider for LocalRustdocProvider {
let item = item.cloned();
async move {
let target_doc_path = cargo_workspace_root.join("target/doc");
let mut local_cargo_doc_path = target_doc_path.join(crate_name.as_ref());
let mut local_cargo_doc_path = target_doc_path.join(crate_name.as_ref().replace('-', "_"));
if !fs.is_dir(&local_cargo_doc_path).await {
let cargo_doc_exists_at_all = fs.is_dir(&target_doc_path).await;