Skip to content

feature_gate::MacroVisitor misses macro invocations nested in macro invocations #22234

Closed
@pnkfelix

Description

@pnkfelix

Today, this program is correctly rejected:

fn main() {
    unsafe {
        let x = asm!("");
        println!("hi {:?}", x);
    }
}

due to a missing #![feature(asm)]

Unfortunately, this variant program is accepted by the compiler:

fn main() {
    unsafe {
        println!("hi {:?}", asm!(""));
    }
}

The reason (I think) is that the fn visit_mac in feature_gate::MacroVisitor needs to recursively invoke the visitor on the expression inputs to the macro.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-syntaxextArea: Syntax extensionsP-mediumMedium priority

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions