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

Scraping examples: works locally but not on docs.rs #2305

Closed
killercup opened this issue Oct 13, 2023 · 11 comments
Closed

Scraping examples: works locally but not on docs.rs #2305

killercup opened this issue Oct 13, 2023 · 11 comments
Labels
C-bug Category: This is a bug T-rustdoc

Comments

@killercup
Copy link
Member

In bevyengine/bevy#9154, I tried adding metadata to have the many examples bevy comes with show up in their API docs.

I have a full reproduction and detailed description of what I tried here: killercup/test-rustdoc-example-scraping-across-workspace-on-docrs#1


This relates to rust-lang/rust#88791

cc @rust-lang/docs-rs

(talked to @GuillaumeGomez about this already)

@killercup killercup added the C-bug Category: This is a bug label Oct 13, 2023
@killercup
Copy link
Member Author

After talking to some folks from @rust-lang/docs-rs, we discovered that no scraped examples are shown for items that are re-exported from other crates. It works for path dependencies.

@GuillaumeGomez
Copy link
Member

This now needs to be moved to cargo as it seems to be a cargo issue from what we could uncover.

@fmease
Copy link
Member

fmease commented Oct 13, 2023

Have you tried minimizing this issue to not rely on Cargo but just on rustc & rustdoc and have failed? Just from reading the issue description, this sounds like a https://github.com/rust-lang/rust/labels/A-cross-crate-reexports issue but I haven't looked much into this issue.

@GuillaumeGomez
Copy link
Member

It works if the crate is specified with path but doesn't when the crate is downloaded from crates.io (the default). That's why we reached this conclusion.

@GuillaumeGomez
Copy link
Member

Moved the issue in docs.rs as it seems to be a docs.rs-specific issue: every crate gets its scraped examples working when documenting them locally. My guess is that maybe we are using a read-only FS when we should not. To be confirmed.

@syphar
Copy link
Member

syphar commented Nov 8, 2023

@GuillaumeGomez from what I remember of the discussion with @killercup , we were able to reproduce this locally, perhaps @Nemo157 knows more?

@GuillaumeGomez
Copy link
Member

That's also what I remember and yet I can't reproduce it locally again. @killercup and I talked about it in killercup/test-rustdoc-example-scraping-across-workspace-on-docrs#1. The surprising part being that the docs.rs command line (with cargo rustdoc) works locally.

@Nemo157
Copy link
Member

Nemo157 commented Nov 8, 2023

Yeah, my recollection is that the difference was that it didn't reproduce in the repository, but only in the published package, not anything to do with what docs.rs does with that package specifically.

@GuillaumeGomez
Copy link
Member

Ok, I'll keep the issue here for the time being and try to check what's going on when we get the crate from crates.io.

@GuillaumeGomez
Copy link
Member

So more information about this (for bevy): when adding back the workspace members:

[workspace]
members = [
  "crates/*",
]

And copying the relevant files locally, the examples are scraped as expected. Next step is to take a look into cargo and figure out why it's even needed in the first place.

@GuillaumeGomez
Copy link
Member

Fixed in rust-lang/cargo#13074.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug T-rustdoc
Projects
None yet
Development

No branches or pull requests

5 participants