Skip to content

rustc stack overflow with self-recursive concat! macro #84632

Closed
@Nemo157

Description

@Nemo157

I tried this code:

#[macro_export]
macro_rules! n {() => (concat!("", n!()))}

fn main () {
    n!();
}

I expected to see this happen: An error message about exceeding some recursion limit

Instead, this happened:

thread 'rustc' has overflowed its stack
fatal runtime error: stack overflow

Meta

Tested on stable 1.51.0 + 1.53.0-nightly (2021-04-26 9684258936dabda2ba49)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-bugCategory: This is a bug.I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.P-mediumMedium priorityglacierICE tracked in rust-lang/glacier.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions