Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

clear_env_rust_log not working for in-process rustc/cargo #1487

@schomatis

Description

@schomatis

To reproduce:

RUST_LOG=cargo=debug rls --cli

Unsetting RUST_LOG doesn't work when the logger has already been initialized (in the first call to rls), rustc/cargo in-process calls will be guided by the original RUST_LOG value. Out of process calls (e.g., dependencies compilation) do benefit from clear_env_rust_log as the new process initializes its log (e.g., rustc_log::run).

Not sure if there's a way to reconfigure an already initialized log.


Interestingly (and somewhat related to this but not a responsibility of clear_env_rust_log),

RUSTC_LOG=debug rls --cli

produces the rustc log for the in-process (primary packages) compilation. I would have expected those to happen with RUST_LOG (even after the RUST_ to RUSTC_ transition) because clear_env_rust_log uses the same unset env.var mechanism, but they seem to appear (no matter the filter) only with the RUSTC_ variant.

(edit: actually, the output generated in the RUSTC_ case, which contains mostly MIR and codegen information, might not come particularly from in-process rustc calls and I may be confounding sources)

(edit 2: yes, it seems the output is mainly parallel codegen spawned processes, similar to what's described in the first part of the issue)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions