Doc : link to crate inconsistent behaviour

In the doc I want add link to a specific crate using its name with leadings ::.
But the result isn't consistent : for ron and basic-toml the link points to their respective docs.rs page, but for toml and bevy the link points to a sub page (i.e. file:///C:/[...]/test_doc/target/doc/test_doc/::bevy)

//! [`ron`](::ron)
//!
//! [`basic-toml`](::basic_toml)
//!
//! [`toml`](::toml)
//!
//! [`bevy`](::bevy)

I noticed ron and basic-toml define the field documentation in their Cargo.toml file but toml and bevy didn't.

The manifest's references indicates this

If no URL is specified in the manifest file, crates.io will automatically link your crate to the corresponding docs.rs page.

Shouldn't cargo doc also use the doc.rs link if documention field is missing ?

The default behavior of cargo doc is to locally build documentation for every crate in your workspace.

This is not wasted effort; it will build docs specifically

  • for your target platform, which is important for platform specific APIs,
  • with the features you have enabled, and
  • with trait implementations listed across crates in your workspace.

All of these things may be missing from the docs.rs view.

2 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.