Для запуска тестов сначала соберите код как библиотеку, а затем скажите rustdoc где найти эту библиотеку, чтобы он мог подключить её к каждому документационному тесту:
$ rustc doc.rs --crate-type lib
$ rustdoc --test --extern doc="libdoc.rlib" doc.rs
• The Rust Book: Making Useful Documentation Comments
• RFC 1574: API Documentation Conventions
• RFC 1946: Relative links to other items from doc comments (intra-rustdoc links)
• Is there any documentation style guide for comments? (reddit)