Running `rustdoc` isn't working

⚓ Rust    📅 2025-05-03    👤 surdeus    👁️ 5      

surdeus

Warning

This post was published 109 days ago. The information described in this article may have changed.

I started going through the Rust Doc book, following along step by step, using Cargo new to create a new docs project directory. Then the tutorial says to run this line:

rustdoc src/lib.rs

and I get the following error:

jtreagan@WillowCreek:~/programming/rust/others/docs$ $ rustdoc src/lib.rs
$: command not found

I thought that was rather strange as I was under the impression that rustdoc installed when I first ran rustup a long, long time ago. Anyway I ran rustup update just to make sure and sure enough rustdocs installed.

// snip
info: removing previous version of component 'rust-docs'
info: removing previous version of component 'rust-std'
info: removing previous version of component 'rustc'
info: removing previous version of component 'rustfmt'
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-docs'
info: installing component 'rust-std'
// snip

Yet I still get that command not found error.

What am I doing wrong?

3 posts - 2 participants

Read full topic

🏷️ rust_feed