Skip to content

Commit c776d02

Browse files
committed
Make note of documentation tests and binaries
Fixes #24228
1 parent 5576b05 commit c776d02

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/doc/trpl/documentation.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,10 @@ $ rustdoc --test path/to/my/crate/root.rs
380380
$ cargo test
381381
```
382382

383-
That's right, `cargo test` tests embedded documentation too.
383+
That's right, `cargo test` tests embedded documentation too. However,
384+
`cargo test` will not test binary crates, only library ones. This is
385+
due to the way `rustdoc` works: it links against the library to be tested,
386+
but with a binary, there’s nothing to link to.
384387

385388
There are a few more annotations that are useful to help `rustdoc` do the right
386389
thing when testing your code:

0 commit comments

Comments
 (0)