#Rustdoc: refer to item in another member of workspace

8 messages · Page 1 of 1 (latest)

tardy nexus
#

i have a rust workspace, with a bunch of library crates in the workspace. one of these library crates is the proc-macro-attribute crate, that provides derives for some traits in the other library crates.

.
├── Cargo.toml
├── cas-attrs # proc macro attributes crate, deriving traits...
├── cas-error # ...that are located here
├── cas-eval # ...documentation refers to other types in here
├── ...

how can i refer to the types / traits in cas-error and cas-eval? this is what i've tried doing:

// ./cas-attrs/src/lib.rs

/// A link to the [`ErrorKind`] trait, provided in the `cas_error` crate. Uses [`Value::Number`].
///
/// [`ErrorKind`]: cas_error::ErrorKind
/// [`Value`]: cas_eval::ctxt::Value
#[proc_macro_derive(ErrorKind, attributes(error))]
pub fn error_kind(item: TokenStream) -> TokenStream {
    // ....

after running cargo doc, the resulting links link to nowhere

jaunty oriole
#

You can't do this directly

neat acorn
#

are cas-error and cas-error dev-dependencies of cas-attrs ?

jaunty oriole
#

What you can do is put the documentation on the re-export of the proc macro, instead of the macro itself (assuming you have one)

#

(or use docs.rs URLs)

tardy nexus
#

the reexport of the macro? so the docs go into cas-error / cas-eval instead