Skip to content

Calling a non-function as a function in a macro causes panic #26237

Closed
@grantslatton

Description

@grantslatton

See http://is.gd/X3gtGi

Code:

macro_rules! macro_panic {
    ($not_a_function:expr, $some_argument:ident) => { 
        $not_a_function($some_argument)
    }   
}

fn main() {
    let mut value_a = 0;
    let mut value_b = 0;
    macro_panic!(value_a, value_b);
}

Output:

error: expected function, found `_`
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: run with `RUST_BACKTRACE=1` for a backtrace

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions