Uh oh!
There was an error while loading. Please reload this page.
Prevent rustdoc feature doctests - #64741
Conversation
7e7ab2b to
bf41529CompareThere was a problem hiding this comment.
.filter(..).cloned() seems cleaner here.
There was a problem hiding this comment.
I continue to be deeply confused why we're altering test_args here.
test_args is the array of arguments that's passed to test::test_main -- that's way too late for cfg to matter, I believe, and test_main certainly is not a compiler.
Can you at least check manually that this works? A comment that explains how this works (e.g., why is this applying to cfg, despite not mentioning cfg at all?) would also be good.
There was a problem hiding this comment.
I just thought about it when you said something was wrong in this implementation the other day: it's incorrect since I don't check the cfg. However, test_args are passed to each code sample rustdoc compiles and run. Therefore, it seems accurate to me to have this check here. However I need to fix it.
There was a problem hiding this comment.
But... they're not? These are not the arguments to rustc. These are the arguments to the test 'binary'. I would expect you to never find a --cfg in these arguments; they're not (AFAICT) used at all for compilation. Right now the code is removing a test filter for rustdoc -- not a cfg gate or anything like that.
There was a problem hiding this comment.
Then I completely misunderstood this part of the code... I'll take a step back and check what I missed...
d19f3f3 to
b69ae4aCompareGuillaumeGomez
commented
Sep 25, 2019
Indeed, I wasn't looking at the good place at all... Thanks a lot for catching up my error @Mark-Simulacrum ! |
There was a problem hiding this comment.
This also feels like the wrong place :)
I would expect us to not add the rustdoc cfg ourselves -- looking at it, I guess here -- not remove it later on. We don't want to remove it if the user has passed it.
There was a problem hiding this comment.
That's a good point I didn't think about... Checking more globally why we even need to do this. However, I think we need it at some point to check for the documentation build (not the tests build). I'm looking around to confirm it.
b69ae4a to
e4e674bCompareGuillaumeGomez
commented
Sep 25, 2019
@Mark-Simulacrum Just like you suggested, instead of adding it into the options directly, I removed it from there and add it before the doc build. Sorry about all the fuss... |
GuillaumeGomez
commented
Sep 30, 2019
ping @Mark-Simulacrum |
Mark-Simulacrum
commented
Sep 30, 2019
@bors r+ |
bors
commented
Sep 30, 2019
📌 Commit e4e674bec91e364f290ab8b708d960a292d2678a has been approved by |
ollie27
commented
Sep 30, 2019
Shouldn't Line 67 in bf8491e @bors r- We need tests for this, a // build-pass// compile-flags:--test// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"#![feature(doc_cfg)]// Make sure `cfg(rustdoc)` is set when finding doctests but not inside the doctests./// ```/// #![feature(doc_cfg)]/// assert!(!cfg!(rustdoc));/// ```#[cfg(rustdoc)]pubstructFoo; |
Mark-Simulacrum
commented
Sep 30, 2019
r? @ollie27 I assumed that setting it in core would've done that... |
GuillaumeGomez
commented
Sep 30, 2019
I did as well since we use this one for it. Adding the test. |
e4e674b to
57faf0fCompareGuillaumeGomez
commented
Sep 30, 2019
@ollie27 It seems like the test passed whereas I didn't change the code. Did we misunderstood your message? |
ollie27
commented
Sep 30, 2019
If you look at the stdout it shows that it didn't actually run the doctest. It should say "running 1 test". |
GuillaumeGomez
commented
Oct 1, 2019
Oh I see! Indeed, good catch! |
57faf0f to
366fdebCompareGuillaumeGomez
commented
Oct 1, 2019
Now we have it as well. |
QuietMisdreavus
commented
Oct 3, 2019
bors
commented
Oct 3, 2019
📌 Commit 366fdeb has been approved by |
…ure-doctests, r=QuietMisdreavus Prevent rustdoc feature doctests Part of rust-lang#61351 cc @ollie27
…ure-doctests, r=QuietMisdreavus Prevent rustdoc feature doctests Part of rust-lang#61351 cc @ollie27
…ure-doctests, r=QuietMisdreavus Prevent rustdoc feature doctests Part of rust-lang#61351 cc @ollie27
…ure-doctests, r=QuietMisdreavus Prevent rustdoc feature doctests Part of rust-lang#61351 cc @ollie27
Rollup of 11 pull requests Successful merges: - #61879 (Stabilize todo macro) - #64675 (Deprecate `#![plugin]` & `#[plugin_registrar]`) - #64690 (proc_macro API: Expose `macro_rules` hygiene) - #64706 (add regression test for #60218) - #64741 (Prevent rustdoc feature doctests) - #64842 (Disallow Self in type param defaults of ADTs) - #65004 (Replace mentions of IRC with Discord) - #65018 (Set RUST_BACKTRACE=0 in tests that include a backtrace in stderr) - #65055 (Add long error explanation for E0556) - #65056 (Make visit projection iterative) - #65057 (typo: fix typo in E0392) Failed merges: r? @ghost
Part of #61351
cc @ollie27