Closed
Description
//! ```
//! #![crate_name = "asdf"]
//!
//! println!("yo");
//! ```
$ rustdoc +nightly u.rs --test
running 1 test
test u.rs - (line 1) ... FAILED
failures:
---- u.rs - (line 1) stdout ----
thread 'u.rs - (line 1)' panicked at 'couldn't run the test: No such file or directory (os error 2)', src/librustdoc/test.rs:343:19
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
failures:
u.rs - (line 1)
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out
Based on investigation in rust-lang/rust-by-example#1137 (comment), rustdoc hardcodes the name of the doctest executable to run, but manually setting a #![crate_name]
attribute changes the name of this executable. This causes the above error, because rustdoc is trying to run the wrong executable.