Skip to content

Consider making RUSTC_LOG=warn the default (instead of just error). #76824

Closed
@eddyb

Description

@eddyb

We don't use error!/warn!/info! a lot, but they come in handy for "debugging rustc without a debug-assertions build" situations, e.g. we use info! to show the function being codegen'd (as it's low-overhead and really helpful for e.g. LLVM crashes).

While info! makes sense for off-by-default debugging helpers like that, error!/warn! seem closer to user-facing diagnostics, where the main difference is them being usable outside of code which has access to a Session (either due to running before the Session is created, or just in dependencies that have access to log/tracing but not any rustc-specific diagnostics APIs).

However, one surprising aspect is only error! is enabled by default, while warn! is not, meaning that, with the current defaults, one is forced to choose between error! (which would output the word "error" which sounds more dire than "warning") or warn! (which may never be seen by an user).


My usecase for warn! is in the upcoming -Z self-profile support for using hardware performance counters (which needs to be implemented in the separate measureme project), e.g. this warn! instructs the user to open an issue if they have an unrecognized (newer) CPU, but there's nothing preventing -Z self-profile from working (if the newer CPUs aren't drastically different), so showing "error" seems quite inappropriate.

Sadly, I don't think log env_logger itself will change this behavior, so even if we change RUSTC_LOG's default, measureme might still have to use the less-appropriate error! if it wants to account for being used in other projects.

cc @Mark-Simulacrum @gdhuper @hawkw

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions