rust-dev-tools / dev-tools-team

resources for the Rust dev-tools team
42 stars 9 forks source link

"doctests working group" for T-rustdoc? #43

Open QuietMisdreavus opened 5 years ago

QuietMisdreavus commented 5 years ago

There's been a lot of activity in trying to improve doctests recently. Most notably, a couple contributors outside the Rustdoc Team have really stepped up to help out: @euclio and @rep-nop. It would be cool to coordinate improvements to doctests so we can plan out our changes and not step on each other's toes.

(I'll try to fill this thread with some ideas that i remember seeing or wanting, but full discussion may have to wait until the All-Hands on February 4-8 so i have dedicated time to think about it. In the meantime, feel free to pitch ideas here!)

GuillaumeGomez commented 5 years ago

👍

euclio commented 5 years ago

I'd like to remove the panic from doc test error handling. Currently, if you have a doc test that fails or panics, you get output with 2 panics in it:

running 1 test
test src/lib.rs - Foo (line 1) ... FAILED

failures:

---- src/lib.rs - Foo (line 1) stdout ----
thread 'src/lib.rs - Foo (line 1)' panicked at 'test executable failed:

thread 'main' panicked at 'explicit panic', src/lib.rs:3:1
note: Run with `RUST_BACKTRACE=1` for a backtrace.

', librustdoc/test.rs:367:17
note: Run with `RUST_BACKTRACE=1` for a backtrace.

failures:
    src/lib.rs - Foo (line 1)

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out
QuietMisdreavus commented 5 years ago

A couple large items that i can think of:

cramertj commented 5 years ago

cc @rtsuk

cramertj commented 5 years ago

This will require a sort of two-phase model, where compilation and execution are handled separately.

Yes, I also need this because I want to be able to cross-compile doctests and run them on a different platform from the host compiler.

QuietMisdreavus commented 5 years ago

Yes, I also need this because I want to be able to cross-compile doctests and run them on a different platform from the host compiler.

Right, and this is quite close to being possible once the --persist-doctests flag is ready, though it will compile each doctest separately. Creating the "single executable" model is another layer on top of that, where we'll have to separate the compilation and execution in the code itself, rather than just skipping execution if we cross-compile the doctest.

repnop commented 5 years ago

Sounds pretty reasonable to me :+1:

I'd be more than happy to tackle some of the remaining text-based stuff you mention since I've already done it once!