Closed
Description
I made some documentation tests for my crate, but forgot to add a space after the pound sign (#
) like the following example:
//! ...
//! ## Iterating over the PDB Hierarchy
//!
//! ```rust
//! #use pdbtbx;
//! #let (mut pdb, _errors) = pdbtbx::open("example-pdbs/1ubq.pdb", pdbtbx::StrictnessLevel::Medium).unwrap();
//! // Iterating over all levels
//! for model in pdb.models() {
//! ...
I was unaware that there should be a space after the pound sign, so I was quite startled by the resulting error message (other passed tests excluded):
Doc-tests pdbtbx
running 2 tests
test src\lib.rs - (line 64) ... FAILED
test src\lib.rs - (line 26) ... ok
failures:
---- src\lib.rs - (line 64) stdout ----
error: expected one of `!` or `[`, found keyword `use`
--> src\lib.rs:65:2
|
4 | #use pdbtbx;
| ^^^ expected one of `!` or `[`
error: aborting due to previous error
After looking up the correct syntax in the rustdoc book I could easily solve it. But I assume this is not the best error message to provide to users.
Meta
rustc --version --verbose
:
rustc 1.50.0 (cb75ad5db 2021-02-10)
binary: rustc
commit-hash: cb75ad5db02783e8b0222fee363c5f63f7e2cf5b
commit-date: 2021-02-10
host: x86_64-pc-windows-msvc
release: 1.50.0
I am not entirely sure this is supposed to be a Bug Report
but it did not really fit into any of the other categories as well. If I can do anything more to help please let me know.