Skip to content

Cycle error from pretty printer with RUST_LOG #59985

Open
@davidtwco

Description

@davidtwco

(I wasn't able to find any existing discussion, issues or PRs about this, I'd not be surprised if someone had found it already, so my bad if this isn't a new problem)

Yesterday, I was about to take a look into #59494 (the test case for that will trigger this), running that test case with RUST_LOG=rustc::traits makes a cycle error happen instead of the expected ICE. I can get the ICE with just RUST_LOG=rustc::traits::select (IIRC), but not when I include other modules.

The cycle error comes from the pretty printer, in particular this line. I managed to resolve the issue, here's the diff that fixed it - when the pretty printer calls predicates_of for existential types then it ends up calling code with debug logs that print the same type, causing a cycle.

The diff above only bypasses the cycle error when RUST_LOG=rustc::ty::subst,rustc::ty::context,rustc_typeck, I assume it won't when you add more modules. Here's the relevant Zulip topic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-prettyArea: Pretty printing (including `-Z unpretty`)C-bugCategory: This is a bug.I-cycleIssue: A query cycle occurred while none was expectedT-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