Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dash (-) in a crate name breaks rustdoc-scrape-examples #10035

Closed
WaffleLapkin opened this issue Nov 4, 2021 · 2 comments · Fixed by #10037
Closed

Dash (-) in a crate name breaks rustdoc-scrape-examples #10035

WaffleLapkin opened this issue Nov 4, 2021 · 2 comments · Fixed by #10037
Labels
C-bug Category: bug

Comments

@WaffleLapkin
Copy link
Member

Problem

When a crate has a dash (-) in its name, the unstable rustdoc-scrape-examples option stops working.

Steps

  1. Create a crate with a dash in it's name: cargo new --lib da-sh && cd da-sh
  2. Add a function to the crate: echo "pub fn f() {}" >> src/lib.rs
  3. Add an example that uses the added function: mkdir examples && echo "fn main() { da_sh::f() }" > examples/e.rs
  4. Run rustdoc: cargo +nightly doc -Zunstable-options -Zrustdoc-scrape-examples=examples --open
  5. Observe documentation of f (example is missing): image
  6. Remove dash from the crate name: sed -i 's/da-sh/dash/' Cargo.toml && sed -i 's/da_sh/dash/' examples/e.rs
  7. Run rustdoc: cargo +nightly doc -Zunstable-options -Zrustdoc-scrape-examples=examples --open
  8. Observe documentation of f (example is present): image

Possible Solution(s)

No response

Notes

I'm not sure if this is an issue with rustdoc or cargo, maybe this issue should be moved to rustdoc repo.

Version

cargo 1.58.0-nightly (94ca096af 2021-10-29)
@WaffleLapkin WaffleLapkin added the C-bug Category: bug label Nov 4, 2021
@Eh2406
Copy link
Contributor

Eh2406 commented Nov 4, 2021

cc @willcrichton

@willcrichton
Copy link
Contributor

Thanks for the concise repro @WaffleLapkin! I just created a PR for the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
3 participants