Closed
Description
Doctest test names have changed due to #66364. Doc comments that pass through a macro defined in another crate now seem to report a different span.
lazy_static::lazy_static! {
/// Comments
/// ```
/// assert!(true);
/// ```
static ref FOO: bool = true;
}
running with cargo test --doc
previously looked like this:
test <::lazy_static::__lazy_static_internal macros> - FOO (line 26) ... ok
Now the test names look like this:
test /Users/eric/.cargo/registry/src/github.tiyicn.workers.dev-1ecc6299db9ec823/lazy_static-1.4.0/src/lib.rs - FOO (line 159) ... ok
Frankly, neither are particularly great. It would be nice if the test name used the span from where the macro was invoked, not where it was defined.
rustc 1.43.0-nightly (c20d7eecb 2020-03-11)
Activity
matthiaskrgr commentedon Mar 18, 2020
Centril commentedon Mar 18, 2020
cc @eddyb @petrochenkov
eddyb commentedon Mar 18, 2020
@matthiaskrgr What you're describing is entirely in the opposite direction,
<::std::macros::panic macros>
is the old (and arguably bad) kind ofSpan
that's impossible to get anymore.I've hidden your comment to focus on the reported issue.
eddyb commentedon Mar 18, 2020
@ehuss That makes sense, we have a way to get the outermost invocation, that is used by
file!()
/line!
and#[track_caller]
:We'd just need to use this in
rustdoc
.Centril commentedon Mar 18, 2020
cc @GuillaumeGomez
Centril commentedon Mar 18, 2020
cc @rust-lang/rustdoc
spastorino commentedon Mar 18, 2020
Removed
T-compiler
label, left nomination forT-rustdoc
to decide about this issue.7 remaining items