-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Always compile rustdoc with debug logging enabled when download-rustc
is set
#81932
Conversation
(Looks like this could use a rebase; but I should be able to review 2nd and 3rd commits anyway) |
c2ee7d5
to
39564b1
Compare
Done :) #79540 just got merged 🎉 |
Does it actually take long to compile tracing? What is our win here wall clock wise vs. just always having rustdoc depend on tracing on its own? |
You're right, it doesn't have much effect. It goes (on my machine) from 55 seconds to 60, which seems reasonable given it's a one-time cost. timings.zip However that means that rustdoc will either |
b seems.. eminently reasonable though? If someone is requesting logging in a generic way that (might) include rustc, giving them a warning seems pretty good. We should endeavor to make the warning talk about rustc specifically but IIRC that was hard, so we'll just want to document it in debug-logging's comment in config.toml.example. |
Hmm, ok, that sounds useful. The warning looks like this:
which seems ok - not great, but ok. Unfortunately I can't test much until the beta compiler gets bumped (I get the LLVM linker error from #81930). |
39564b1
to
0acbc55
Compare
I updated this to compile tracing twice unconditionally. It works much better than I expected :) even when both versions are active and have DEBUG logging enabled, you still see each log exactly once. |
This comment has been minimized.
This comment has been minimized.
0acbc55
to
399d5c9
Compare
This comment has been minimized.
This comment has been minimized.
Hmm, so the test failure here is odd. What happened is that
collapse-docs pass, which no longer exists (it was removed in #80261). Rustdoc doesn't actually give a proper diagnostic here; instead it prints an error! log. I think now that tracing is compiled unconditionally, the log is now being emitted by default, because it's at the error level?
Do you think printing error logging by default is a good change? If so, I can just bless the test output. If not I'll look into why it happens, I'm not 100% sure right now. Either way, I think rustdoc shouldn't be using |
I agree that rustdoc should not use error! to report errors to downstream users. That said for presumably an unstable feature that only std uses, if the error is not seen outside tests, I think it'd be fine to just bless, but it'd also be fine to comment out the error! line or adjust the default level. |
Unfortunately this is stable, although it's deprecated: Lines 590 to 595 in 43fc1b3
That said, I don't know anyone using this in practice. For now I'll update the test not to use a removed pass so rustdoc doesn't emit the warning. |
…c` is set Previously, logging at DEBUG or below would always be silenced, because rustc compiles tracing with the `static_max_level_info` feature. That makes sense for release artifacts, but not for developing rustdoc. Instead, this compiles two different versions of tracing: one in the release artifacts, distributed in the sysroot, and a new version compiled by rustdoc. Since `rustc_driver` is always linked to the version of sysroot, this copy/pastes `init_env_logging` into rustdoc. The builds the second version of tracing unconditionally; see the code for details on why.
`src/test/rustdoc-ui/deprecated-attrs.rs` tells rustdoc to run the `collapse-docs` pass, which no longer exists (it was removed in rust-lang#80261). Rustdoc doesn't actually give a proper diagnostic here; instead it prints an `error!` log. Now that tracing is compiled unconditionally, the log is now being emitted by default, because it's at the error level. rustdoc shouldn't be using `error!` logging for diagnostics in the first place, but in the meantime this change gets the testsuite to pass.
@bors r+ Thanks! |
📌 Commit 6dc9934 has been approved by |
…laumeGomez Rollup of 7 pull requests Successful merges: - rust-lang#80734 (check that first arg to `panic!()` in const is `&str`) - rust-lang#81932 (Always compile rustdoc with debug logging enabled when `download-rustc` is set) - rust-lang#82018 (Remove the dummy cache in `DocContext`; delete RenderInfo) - rust-lang#82598 (Check stability and feature attributes in rustdoc) - rust-lang#82655 (Highlight identifier span instead of whole pattern span in `unused` lint) - rust-lang#82662 (Warn about unknown doc attributes) - rust-lang#82676 (Change twice used large const table to static) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
…eGomez Cleanup rustdoc warnings ## Clean up error reporting for deprecated passes Using `error!` here goes all the way back to the original commit, rust-lang#8540. I don't see any reason to use logging; rustdoc should use diagnostics wherever possible. See rust-lang#81932 (comment) for further context. - Use spans for deprecated attributes - Use a proper diagnostic for unknown passes, instead of error logging - Add tests for unknown passes - Improve some wording in diagnostics ## Report that `doc(plugins)` doesn't work using diagnostics instead of `eprintln!` This also adds a test for the output. This was added in rust-lang#52194. I don't see any particular reason not to use diagnostics here, I think it was just missed in rust-lang#50541.
…eGomez Cleanup rustdoc warnings ## Clean up error reporting for deprecated passes Using `error!` here goes all the way back to the original commit, rust-lang#8540. I don't see any reason to use logging; rustdoc should use diagnostics wherever possible. See rust-lang#81932 (comment) for further context. - Use spans for deprecated attributes - Use a proper diagnostic for unknown passes, instead of error logging - Add tests for unknown passes - Improve some wording in diagnostics ## Report that `doc(plugins)` doesn't work using diagnostics instead of `eprintln!` This also adds a test for the output. This was added in rust-lang#52194. I don't see any particular reason not to use diagnostics here, I think it was just missed in rust-lang#50541.
…eGomez Cleanup rustdoc warnings ## Clean up error reporting for deprecated passes Using `error!` here goes all the way back to the original commit, rust-lang#8540. I don't see any reason to use logging; rustdoc should use diagnostics wherever possible. See rust-lang#81932 (comment) for further context. - Use spans for deprecated attributes - Use a proper diagnostic for unknown passes, instead of error logging - Add tests for unknown passes - Improve some wording in diagnostics ## Report that `doc(plugins)` doesn't work using diagnostics instead of `eprintln!` This also adds a test for the output. This was added in rust-lang#52194. I don't see any particular reason not to use diagnostics here, I think it was just missed in rust-lang#50541.
…eGomez Cleanup rustdoc warnings ## Clean up error reporting for deprecated passes Using `error!` here goes all the way back to the original commit, rust-lang#8540. I don't see any reason to use logging; rustdoc should use diagnostics wherever possible. See rust-lang#81932 (comment) for further context. - Use spans for deprecated attributes - Use a proper diagnostic for unknown passes, instead of error logging - Add tests for unknown passes - Improve some wording in diagnostics ## Report that `doc(plugins)` doesn't work using diagnostics instead of `eprintln!` This also adds a test for the output. This was added in rust-lang#52194. I don't see any particular reason not to use diagnostics here, I think it was just missed in rust-lang#50541.
…eGomez Cleanup rustdoc warnings ## Clean up error reporting for deprecated passes Using `error!` here goes all the way back to the original commit, rust-lang#8540. I don't see any reason to use logging; rustdoc should use diagnostics wherever possible. See rust-lang#81932 (comment) for further context. - Use spans for deprecated attributes - Use a proper diagnostic for unknown passes, instead of error logging - Add tests for unknown passes - Improve some wording in diagnostics ## Report that `doc(plugins)` doesn't work using diagnostics instead of `eprintln!` This also adds a test for the output. This was added in rust-lang#52194. I don't see any particular reason not to use diagnostics here, I think it was just missed in rust-lang#50541.
Previously, logging at DEBUG or below would always be silenced, because
rustc compiles tracing with the
static_max_level_info
feature. Thatmakes sense for release artifacts, but not for developing rustdoc.
Instead, this compiles two different versions of tracing: one in the
release artifacts, distributed in the sysroot, and a new version
compiled by rustdoc. Since
rustc_driver
is always linked to theversion of sysroot, this copy/pastes
init_env_logging
into rustdoc.To avoid compiling an unnecessary version of tracing when
download-rustc
isn't set, this adds a newusing-ci-artifacts
feature for rustdoc and passes that feature in bootstrap.
Addresses #81930. This builds on #79540.
r? @Mark-Simulacrum