Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

:vis matcher can't parse EOF #41949

Open
qnighy opened this issue May 12, 2017 · 1 comment
Open

:vis matcher can't parse EOF #41949

qnighy opened this issue May 12, 2017 · 1 comment
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) C-bug Category: This is a bug. T-lang Relevant to the language team, which will review and decide on the PR/issue.

Comments

@qnighy
Copy link
Contributor

qnighy commented May 12, 2017

Observed behavior

The code below leads to parse error in rustc 1.19.0-nightly (e40beb3af 2017-05-11).

#![feature(macro_vis_matcher)]
macro_rules! foo {
    ($v:vis) => {}
}
fn main() {
    foo!(); //~ ERROR unexpected end of macro invocation
    foo!(pub(in self));
}

Expected behavior

foo!() is expanded correctly.

@Mark-Simulacrum Mark-Simulacrum added the A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) label Jun 22, 2017
@Mark-Simulacrum Mark-Simulacrum added the C-bug Category: This is a bug. label Jul 27, 2017
@Enselic
Copy link
Member

Enselic commented Sep 14, 2023

Triage: Interesting. :vis (stable since Rust 1.30) is optional, but not by itself. Not sure if the current behavior is a bug or a feature.

Playground:

macro_rules! optional_vis {
    ($v:vis const) => {}
}

macro_rules! not_optional_vis {
    ($v:vis) => {}
}

fn main() {
    optional_vis!(pub const);
    optional_vis!(const); // OK!

    not_optional_vis!(pub);
    not_optional_vis!(); //~ ERROR unexpected end of macro invocation

}

@Enselic Enselic added the T-lang Relevant to the language team, which will review and decide on the PR/issue. label Sep 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) C-bug Category: This is a bug. T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants