Skip to content

sigils in front of macro_rules's expr nonterminal can convert a literal to a ~str #11836

Closed
@huonw

Description

@huonw
#[feature(macro_rules)];

macro_rules! foo {
    ($e:expr) => { ~$e }
}

fn main() {
    *foo!(1); // fine
    *foo!("foo"); // error: type ~str cannot be derefenced
}

This would appear to go against Rust's non-textual macros.

(Writing ~($e) in the macro works.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-parserArea: The lexing & parsing of Rust source code to an ASTA-syntaxextArea: Syntax extensions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions