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

Cross-crate links are not always present #2196

Closed
EthanYuan opened this issue Aug 23, 2023 · 4 comments
Closed

Cross-crate links are not always present #2196

EthanYuan opened this issue Aug 23, 2023 · 4 comments
Labels
A-builds Area: Building the documentation for a crate C-bug Category: This is a bug E-medium Effort: This requires a fair amount of work

Comments

@EthanYuan
Copy link

EthanYuan commented Aug 23, 2023

Reporting two examples of missing cross-crate links related to re-exports.

example 1

I noticed that in the documentation for the Script struct in the ckb-jsonrpc-types crate (Script), the H256 type is mentioned. However, the H256 type is not linked to its corresponding documentation page in the ckb-fixed-hash-core crate (H256).

Additional Information:

  • Both of these crates are included in the ckb workspace. When running cargo doc --workspace --no-deps --open from the local ckb path, the correct link for the H256 type can be generated.
  • The H256 type is originally defined in ckb-fixed-hash-core.
  • H256 is re-exported in ckb-fixed-hash (which depends on ckb-fixed-hash-core).
  • H256 is re-exported again in ckb-types (which depends on ckb-fixed-hash).
  • The problematic crate ckb-jsonrpc-types depends on H256 from ckb-types.

example 2

In the documentation for the ChainStore trait in the ckb-store crate (ChainStore), the DBPinnableSlice type and DBIter type are mentioned in required methods get and get_iter. However, the types are not linked to its corresponding documentation pages in the ckb-rocksdb crate (DBPinnableSlice and DBIterator).

Additional Information:

  • When running cargo doc --workspace --open from the local ckb path, the correct link for the DBPinnableSlice type and DBIter type can be generated. However, running cargo doc --workspace --no-deps --open produces the same result as described in the issue (i.e., no links are generated).
  • The DBPinnableSlice type and DBIter type are originally defined in ckb-rocksdb.
  • The DBPinnableSlice type and DBIter type are re-exported in ckb-db (which depends on ckb-rocksdb).
  • The problematic crate ckb-store depends on DBPinnableSlice and DBIter from ckb-db.
@Nemo157
Copy link
Member

Nemo157 commented Aug 24, 2023

Likely to be #1588, cargo doesn't correctly handle transitive dependencies currently.

@EthanYuan
Copy link
Author

EthanYuan commented Aug 25, 2023

Likely to be #1588, cargo doesn't correctly handle transitive dependencies currently.

Thank you for providing more information about transitive dependencies.

I tried the method of explicitly declaring the path below, and the result of using cargo doc locally is that it only serves as a workaround for the annotated documentation, but it doesn't affect the hyperlinks for types in the code.

pub struct Script {
    /// The hash [`H256`] used to match the script code.
    /// 
    /// [`H256`]: https://docs.rs/ckb-fixed-hash-core/0.111.0-rc8/ckb_fixed_hash_core/struct.H256.html
    pub code_hash: H256,
    /// Specifies how to use the `code_hash` to match the script code.
    pub hash_type: ScriptHashType,
    /// Arguments for script.
    pub args: JsonBytes,
}

I look forward to docs.rs being able to address this issue in the near future, to align with the local documentation generation (which is currently working fine).

DerZade added a commit to arma-place/pmtiles-rs that referenced this issue Oct 23, 2023
explicitly link to AsyncRead and AsyncWrite traits of futures crate, since docs.rs cannot resolve the link properly (see rust-lang/docs.rs#2196)
@syphar syphar added C-bug Category: This is a bug E-medium Effort: This requires a fair amount of work A-builds Area: Building the documentation for a crate labels Feb 14, 2024
@Nemo157
Copy link
Member

Nemo157 commented Mar 11, 2024

Since a few nightlies ago this has been fixed (rust-lang/cargo#13481), I queued a rebuild of the latest version and https://docs.rs/ckb-jsonrpc-types/0.114.0/ckb_jsonrpc_types/struct.Script.html now includes a link to H256 in the Fields section too.

@syphar
Copy link
Member

syphar commented Mar 12, 2024

@Nemo157 so this issue can be closed?

@Nemo157 Nemo157 closed this as completed Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-builds Area: Building the documentation for a crate C-bug Category: This is a bug E-medium Effort: This requires a fair amount of work
Projects
None yet
Development

No branches or pull requests

3 participants