Skip to content
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

rustc_driver: Enable the WARN log level by default #89634

Merged
merged 8 commits into from
Oct 9, 2021

Conversation

hawkw
Copy link
Contributor

@hawkw hawkw commented Oct 7, 2021

This commit changes the tracing_subscriber initialization in
rustc_driver so that the WARN verbosity level is enabled by default
when the RUSTC_LOG env variable is empty. If the RUSTC_LOG env
variable is set, the filter string in the environment variable is
honored, instead.

Fixes #76824
Closes #89623

cc @eddyb, @oli-obk

This commit changes the `tracing_subscriber` initialization in
`rustc_driver` so that the `WARN` verbosity level is enabled by default
when the `RUSTC_LOG` env variable is empty. If the `RUSTC_LOG` env
variable is set, the filter string in the environment variable is
honored, instead.

Fixes rust-lang#76824
Closes rust-lang#89623

cc @eddyb, @oli-obk
@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @oli-obk (or someone else) soon.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 7, 2021
@hawkw
Copy link
Contributor Author

hawkw commented Oct 7, 2021

This closes PR #89623, because it also makes that change (always enabling tracing even when the filter string environment variable is empty).

@rust-log-analyzer

This comment has been minimized.

@jyn514 jyn514 added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Oct 7, 2021
@rust-log-analyzer

This comment has been minimized.

@jyn514
Copy link
Member

jyn514 commented Oct 7, 2021

@lcnr do you know whether that warn! should be a proper user-facing warning or just an info! log? WARN rustc_mir_dataflow::rustc_peek peek_at: place=_1 doesn't seem very helpful for developers.

@hawkw
Copy link
Contributor Author

hawkw commented Oct 7, 2021

In general, I notice that there are actually a number of WARN-level events that may not be intended as user-facing; @jyn514, I can go through and demote them to INFO-level events if you think that would be correct, but (as I'm not a rustc developer), I'm not sure if I actually know which of these events should be user-facing...

@hawkw
Copy link
Contributor Author

hawkw commented Oct 7, 2021

Okay, I changed the rustc_peek traces to INFO. I also went through and changed a few existing warnings that used, essentially, tracing's structured fields formatting but in textual messages, so that they just emit structured fields.

If these changes aren't desired, I can back them out?

@rust-log-analyzer

This comment has been minimized.

compiler/rustc_mir_dataflow/src/rustc_peek.rs Outdated Show resolved Hide resolved
warn!("peek_at: place={:?}", place);
info!(?place, "peek_at");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @nikomatsakis @pnkfelix Is this expected to be used in nightly builds? If not, can this be debug!/trace!?

compiler/rustc_codegen_ssa/src/back/link.rs Outdated Show resolved Hide resolved
@lcnr
Copy link
Contributor

lcnr commented Oct 7, 2021

@lcnr do you know whether that warn! should be a proper user-facing warning or just an info! log? WARN rustc_mir_dataflow::rustc_peek peek_at: place=_1 doesn't seem very helpful for developers.

I don't remember adding that warn! and also don't think that it is too helpful. Changing that to debug or info seems good to me

Signed-off-by: Eliza Weisman <[email protected]>
@hawkw
Copy link
Contributor Author

hawkw commented Oct 7, 2021

@lcnr do you know whether that warn! should be a proper user-facing warning or just an info! log? WARN rustc_mir_dataflow::rustc_peek peek_at: place=_1 doesn't seem very helpful for developers.

I don't remember adding that warn! and also don't think that it is too helpful. Changing that to debug or info seems good to me

The question of whether it should be debug or info is basically, "should it be enabled in nightlies, or should it be compiled out and only present in debug builds?". I don't have the context to know the answer --- it's info for now, but I can change it to debug if we'd prefer it to be compiled out in nightlies.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@hawkw
Copy link
Contributor Author

hawkw commented Oct 7, 2021

The job x86_64-gnu-llvm-10 failed! Check out the build log: (web) (plain)
Click to see the possible cause of the failure (guessed by this bot)

failures:

---- [ui] ui/consts/const_in_pattern/issue-73431.rs stdout ----
normalized stderr:
WARN rustc_mir_build::thir::pattern::const_to_pat MIR const-checker found novel structural match violation. See #73448.


The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/const_in_pattern/issue-73431/issue-73431.stderr
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/const_in_pattern/issue-73431/issue-73431.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args consts/const_in_pattern/issue-73431.rs`

error: 1 errors occurred comparing output.
status: exit status: 0
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/consts/const_in_pattern/issue-73431.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/const_in_pattern/issue-73431/a" "-Crpath" "-O" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/const_in_pattern/issue-73431/auxiliary"
Some tests failed in compiletest suite=ui mode=ui host=x86_64-unknown-linux-gnu target=x86_64-unknown-linux-gnu
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
WARN rustc_mir_build::thir::pattern::const_to_pat MIR const-checker found novel structural match violation. See #73448.
------------------------------------------




failures:
    [ui] ui/consts/const_in_pattern/issue-73431.rs

test result: FAILED. 12141 passed; 1 failed; 115 ignored; 0 measured; 0 filtered out; finished in 135.44s



command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--suite" "ui" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-10/bin/FileCheck" "--nodejs" "/usr/bin/node" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python3" "--lldb-python" "/usr/bin/python3" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "10.0.0" "--llvm-components" "aarch64 aarch64asmparser aarch64codegen aarch64desc aarch64disassembler aarch64info aarch64utils aggressiveinstcombine all all-targets amdgpu amdgpuasmparser amdgpucodegen amdgpudesc amdgpudisassembler amdgpuinfo amdgpuutils analysis arm armasmparser armcodegen armdesc armdisassembler arminfo armutils asmparser asmprinter avr avrasmparser avrcodegen avrdesc avrdisassembler avrinfo binaryformat bitreader bitstreamreader bitwriter bpf bpfasmparser bpfcodegen bpfdesc bpfdisassembler bpfinfo cfguard codegen core coroutines coverage debuginfocodeview debuginfodwarf debuginfogsym debuginfomsf debuginfopdb demangle dlltooldriver dwarflinker engine executionengine frontendopenmp fuzzmutate globalisel hexagon hexagonasmparser hexagoncodegen hexagondesc hexagondisassembler hexagoninfo instcombine instrumentation interpreter ipo irreader jitlink lanai lanaiasmparser lanaicodegen lanaidesc lanaidisassembler lanaiinfo libdriver lineeditor linker lto mc mca mcdisassembler mcjit mcparser mips mipsasmparser mipscodegen mipsdesc mipsdisassembler mipsinfo mirparser msp430 msp430asmparser msp430codegen msp430desc msp430disassembler msp430info native nativecodegen nvptx nvptxcodegen nvptxdesc nvptxinfo objcarcopts object objectyaml option orcerror orcjit passes perfjitevents powerpc powerpcasmparser powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo profiledata remarks riscv riscvasmparser riscvcodegen riscvdesc riscvdisassembler riscvinfo riscvutils runtimedyld scalaropts selectiondag sparc sparcasmparser sparccodegen sparcdesc sparcdisassembler sparcinfo support symbolize systemz systemzasmparser systemzcodegen systemzdesc systemzdisassembler systemzinfo tablegen target textapi transformutils vectorize webassembly webassemblyasmparser webassemblycodegen webassemblydesc webassemblydisassembler webassemblyinfo windowsmanifest x86 x86asmparser x86codegen x86desc x86disassembler x86info x86utils xcore xcorecodegen xcoredesc xcoredisassembler xcoreinfo xray" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--channel" "nightly" "--color" "always"


Build completed unsuccessfully in 0:14:29

I'm assuming that the solution here is just to update the UI tests to expect that stdout will contain warnings, but I wanted to make sure that was the case.

@eddyb
Copy link
Member

eddyb commented Oct 8, 2021

I'm assuming that the solution here is just to update the UI tests to expect that stdout will contain warnings, but I wanted to make sure that was the case.

I think so. These should probably even be lint warnings, but I don't know for sure.

Signed-off-by: Eliza Weisman <[email protected]>
@oli-obk
Copy link
Contributor

oli-obk commented Oct 8, 2021

@bors r+

@bors
Copy link
Contributor

bors commented Oct 8, 2021

📌 Commit 84fc5db has been approved by oli-obk

@bors bors removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 8, 2021
@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Oct 8, 2021
@oli-obk
Copy link
Contributor

oli-obk commented Oct 8, 2021

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 8, 2021
@bors
Copy link
Contributor

bors commented Oct 8, 2021

⌛ Trying commit 84fc5db with merge 916f0b2c6080aa60cdee9000d44045f7a23022a3...

@bors
Copy link
Contributor

bors commented Oct 8, 2021

☀️ Try build successful - checks-actions
Build commit: 916f0b2c6080aa60cdee9000d44045f7a23022a3 (916f0b2c6080aa60cdee9000d44045f7a23022a3)

@rust-timer
Copy link
Collaborator

Queued 916f0b2c6080aa60cdee9000d44045f7a23022a3 with parent 87df4dd, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (916f0b2c6080aa60cdee9000d44045f7a23022a3): comparison url.

Summary: This benchmark run did not return any relevant changes.

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR led to changes in compiler perf.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf -perf-regression

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Oct 8, 2021
@oli-obk
Copy link
Contributor

oli-obk commented Oct 9, 2021

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Oct 9, 2021

📌 Commit 84fc5db has been approved by oli-obk

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 9, 2021
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Oct 9, 2021
rustc_driver: Enable the `WARN` log level by default

This commit changes the `tracing_subscriber` initialization in
`rustc_driver` so that the `WARN` verbosity level is enabled by default
when the `RUSTC_LOG` env variable is empty. If the `RUSTC_LOG` env
variable is set, the filter string in the environment variable is
honored, instead.

Fixes rust-lang#76824
Closes rust-lang#89623

cc `@eddyb,` `@oli-obk`
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 9, 2021
…askrgr

Rollup of 10 pull requests

Successful merges:

 - rust-lang#88707 (String.split_terminator: Add an example when using a slice of chars)
 - rust-lang#89605 (Fix stabilization version for `bindings_after_at`)
 - rust-lang#89634 (rustc_driver: Enable the `WARN` log level by default)
 - rust-lang#89641 (make #[target_feature] work with `asm` register classes)
 - rust-lang#89678 (Fix minor std::thread documentation typo)
 - rust-lang#89684 (Fix asm docs typo)
 - rust-lang#89687 (Move `read2_abbreviated` function into read2.rs)
 - rust-lang#89693 (Add #[must_use] to stdin/stdout/stderr locks)
 - rust-lang#89694 (Add #[must_use] to string/char transformation methods)
 - rust-lang#89697 (Fix min LLVM version for bpf-types test)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 9d14b65 into rust-lang:master Oct 9, 2021
@rustbot rustbot added this to the 1.57.0 milestone Oct 9, 2021
@hawkw
Copy link
Contributor Author

hawkw commented Oct 9, 2021

🙌

bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 21, 2021
…ulacrum

Don't emit a warning for empty rmeta files.

This avoids displaying a warning when attempting to load an empty rmeta file. Warnings were enabled via rust-lang#89634 which can cause a lot of noise (for example, running `./x.py check`).  rustc generates empty rmeta files for things like binaries, which can happen when checking libraries as unittests.

Closes rust-lang#89795
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider making RUSTC_LOG=warn the default (instead of just error).
10 participants