Skip to content

trace_macros no longer shows up after hitting the recursion limit #42710

Closed
@ExpHP

Description

@ExpHP

Got infinite loops in your macros? In the past, trace_macros had your back:

#![recursion_limit="8"]

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

macro_rules! infinite { () => {loops!{}}; }
macro_rules! loops { () => {infinite!{}}; }

infinite!{}

Old behavior:

$ rustup override set nightly-2017-03-01
$ cargo run
   Compiling rec-macro v0.1.0 (file:///home/lampam/rec-macro)
infinite! {  }
loops! {  }
infinite! {  }
loops! {  }
infinite! {  }
loops! {  }
infinite! {  }
loops! {  }
error: recursion limit reached while expanding the macro `infinite`
 --> src/main.rs:7:29
  |
7 | macro_rules! loops { () => {infinite!{}}; }
  |                             ^^^^^^^^^^^
8 | 
9 | infinite!{}
  | ----------- in this macro invocation

error: Could not compile `rec-macro`.

New behavior: (notice: no trace_macros output)

$ rustup override set nightly
$ cargo run
   Compiling rec-macro v0.1.0 (file:///home/lampam/rec-macro)
error: recursion limit reached while expanding the macro `infinite`
 --> src/main.rs:7:29
  |
7 | macro_rules! loops { () => {infinite!{}}; }
  |                             ^^^^^^^^^^^
8 | 
9 | infinite!{}
  | ----------- in this macro invocation
  |
  = help: consider adding a `#![recursion_limit="16"]` attribute to your crate

error: Could not compile `rec-macro`.

To learn more, run the command again with --verbose.

Very few changes have been made to trace_macros in the last century; my money's on this one (a change prompted by discussion here)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions