-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Doctests do not set profile codegen options #6570
Comments
Uses `qadapt::is_active` to work around rust-lang/cargo#6570. Currently assumes that *some* allocation will have happened by the time `fn main()` is called, which is sub-par.
It looks like there are few issues here.
@QuietMisdreavus (or @GuillaumeGomez) it looks like there is some command-line parsing and validation done in |
|
test --release
disagree about debug_assertions
I'm not sure what the current status is of rustdoc handling Cargo's handling of these arguments for rustc is done in a function called S-blocked-external can be removed if we conclude that rustdoc is handling all the options correctly. There is some risk that adding these flags will start breaking some projects (like if they change behavior on debug_assertions). I don't know if that risk is great enough for us to do something different (like maybe doing a crater run?). I'm inclined to just change it and respond if people run into problems, but I'd like to hear what others think. For historical perspective: rustdoc originally did not honor the |
There might also be performance considerations (either positive or negative). Doctests are particularly slow since they essentially require compiling an executable for every test. For some projects with lots of doctests (like the standard library), this can be relatively slow. Compiling doctests with different codegen settings might be faster or slower to compile, and may be faster or slower to execute. I don't think that will be a significant concern, but something I wanted to highlight as something to keep an eye on. |
I can say that personally, I've begun actively avoiding all doc tests, and even ripping out existing doc tests, because they are so slow compared to normal tests. However, assuming your number of doctests doesn't change, then altering the codegen options applied to particular doctests seems unlikely to have a significant effect on compilation time. Any particular doctest is, in general, likely to be extremely small. |
Problem
As currently stands, there's an inconsistency in doctests running with
debug_assertions
on even when code was compiled throughcargo test --release
. I would've expected thatcargo test --release
means that the doctests get compiled in release mode as well, but that doesn't appear to be the case.Steps
Notes
I'm a bit confused on where exactly this issue may need to be filed. It seems related to #5777 and #5218, but because this hits doctests, #4669 and rust-lang/rust#45599 may take precedence. Let me know if I should move.
Output of
cargo version
:cargo 1.32.0 (8610973aa 2019-01-02)
The text was updated successfully, but these errors were encountered: