Skip to content

trace_macros shows nothing if rustc never actually finishes #51960

Open
@ExpHP

Description

@ExpHP

Observed in #51754, the following main.rs

#![feature(trace_macros)]
trace_macros(true);

macro_rules! there_is_a_bug {
    ( $id:ident: $($tail:tt)* ) => {
        there_is_a_bug! { $($tail:tt)* }
    };
}
fn main() {
    there_is_a_bug! { something: more {} }
}

never shows anything because it never hits an error. The reason that it never hits an error is the focus of #51754, but in summary rustc is performing clones that amount to time spent that is quadratic in the (already exponential) token stream length.

Ideally trace_macros should produce output more strictly. I imagine it currently does not due to however it uses the diagnostics API.

Probably even once #51754 is fixed this example will still show nothing except out of memory (core dumped).

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)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