I took librustdoc as a base, modified
run_global_ctxt() to call my custom analysis.
When I run it on a single file, it works perfectly:
cargo run -- somefile.rs
However, if I try to run with cargo-doc, I get:
RUST_BACKTRACE=1 RUSTDOC=target/release/cargo-callgraph cargo doc warning: output filename collision. The lib target `crossbeam-utils` in package `crossbeam-utils v0.7.2` has the same output filename as the lib target `crossbeam-utils` in package `crossbeam-utils v0.6.6`. Colliding filename is: /home/robin/dev/cargo-callgraph/target/doc/crossbeam_utils/index.html The targets should have unique names. This is a known bug where multiple crates with the same name use the same path; see <https://github.com/rust-lang/cargo/issues/6313>. Documenting crossbeam-queue v0.1.2 error: could not document `crossbeam-queue` Caused by: could not execute process `/home/robin/dev/cargo-callgraph/target/release/cargo-callgraph --crate-type lib --crate-name crossbeam_queue /home/robin/.cargo/registry/src/github.com-1ecc6299db9ec823/crossbeam-queue-0.1.2/src/lib.rs --cap-lints allow -o /home/robin/dev/cargo-callgraph/target/doc --error-format=json --json=diagnostic-rendered-ansi -L dependency=/home/robin/dev/cargo-callgraph/target/debug/deps --extern crossbeam_utils=/home/robin/dev/cargo-callgraph/target/debug/deps/libcrossbeam_utils-dc839f467baf84df.rmeta --crate-version 0.1.2` (never executed) Caused by: No such file or directory (os error 2)
I don't know how to what is the cause of the error, (
cargo --verbose doc didn't help).
There is a way by using rustup to set where rustdoc binary is, then you use
cargo +local or something along the line. Let me find it again
@Robin Moussu like this:
rustup toolchain link local /path/to/build/$TARGET/stage1
then you can use
cargo +local doc
@Robin Moussu that looks like you forgot to run
cargo build after a change
@GuillaumeGomez that won't help here because the binary isn't called 'rustdoc'
that's what I always used to test things until now, so maybe I just didn't understand the problem XD
Yes, what happened is Robin forked the rustdoc project and is using it to generate callgraphs, not documentation
Oh I see
So he also changed the name, so cargo can't find it anymore, but he still wants to have the info from dependencies, so instead he's tricking cargo into thinking the fork is still rustdoc
It's exactly that. However I did not forgot to
if you run
/home/robin/dev/cargo-callgraph/target/release/cargo-callgraph --help does that work?
@Robin Moussu ^
:face_palm: I did not use the right command from my history… I only build the debug version, and though that I asked the debug version with
personally I use a
run.sh for things like this, where literally all it does is
cargo build && <the run command>
cargo run isn't smart enough for what I want to do
anyway, this means that the original bug I had still exists :sad:
Last updated: Oct 11 2021 at 22:34 UTC