Skip to content

Broken links: platform-specific crate doc links to the same platform of a dependency even if it doesn't exist #2684

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

Closed
eugenesvk opened this issue Dec 8, 2024 · 9 comments · Fixed by #2690

Comments

@eugenesvk
Copy link

Example: there is a x86_64-apple-darwin crate that references a dependency that is not platform-specific, those links would refer to the x86_64-apple-darwin category of that dependency even if there is no such category

Source crate: https://docs.rs/osakit/latest/osakit/type.Value.html
Link to serde_json: (click on Value) https://docs.rs/serde_json/1.0.133/x86_64-apple-darwin/serde_json/value/enum.Value.html

But serde_json only has 1 platform, so the proper link would've been https://docs.rs/serde_json/1.0.133/serde_json/enum.Value.html

Think that in such cases maybe docs should redirect to whatever platform is the default for the dep crate?

mdevils/rust-osakit#1

@syphar
Copy link
Member

syphar commented Dec 13, 2024

So, we have a solution in docs.rs for this, from the top of my head:

  • first try the same target
  • then try default target? (not sure )
  • fall back to a search

Which is I think still the best thing to do, because then we only have to check for file existance etc when the user actually clicks on the link.

In your example it seems like the search we are generating is broken, which I need to check.

Image

@eugenesvk
Copy link
Author

then try default target? (not sure )

This would also work in this case, there is only 1 target in serde json, but it seems to be broken as well

@syphar
Copy link
Member

syphar commented Dec 13, 2024

@GuillaumeGomez was there a change in how rustdoc search works here?

@syphar
Copy link
Member

syphar commented Dec 13, 2024

then try default target? (not sure )

This would also work in this case, there is only 1 target in serde json, but it seems to be broken as well

just checked the code, we don't do this, but the search should work.

@GuillaumeGomez
Copy link
Member

@GuillaumeGomez was there a change in how rustdoc search works here?

Not that I know of.

@syphar
Copy link
Member

syphar commented Dec 16, 2024

So, the old behaviour is restored now (#2690).

Generally this touches to very old (and organically grown to the current state) code , needing some refactor.

@eugenesvk
Copy link
Author

Thanks! Maybe when the refactoring phase comes, it could add using the default target before trying to resort to search because search loses type info, eg, in the example above, you wouldn't know that you clicked on "enum Value" unless you read the link, the search would show all "Value"s

@syphar
Copy link
Member

syphar commented Dec 16, 2024

I remember rustdoc search also supports limiting the type you search for, we might just do that :)

@eugenesvk
Copy link
Author

Nice, that would just leave the inconvenience of an extra click, though hopefully you'd only find a single item and then seach enum: value auto-redirects to the result in the original example

Then the only issue is whethe it's worth alerting the use somehow that the platform changed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants