Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

Support attributes in function definitions (parameter attributes) #148

Open
peterhuene opened this issue Nov 14, 2019 · 0 comments
Open

Comments

@peterhuene
Copy link

peterhuene commented Nov 14, 2019

Now that Rust 1.39.0 supports attributes on parameters, the grammar should be updated to allow attributes when parsing function definitions.

Example:

#[attr(foo = "bar")]
fn foo(#[attr(foo = "bar")] p: u32) {
    println!("hi");
}

Notice that "bar" is not highlighted as a string, which is an included pattern in the attribute grammar.

Additionally, parsing breaks when the attribute string has characters that are interpreted as Rust tokens:

#[attr(foo = "bar")]
fn foo(#[attr(foo = "{")] p: u32) {
  println!("hi");
}

Note that here { is being matched as the opening bracket of the function, causing the closing " to be matched as the start of a string (the remainder of the function is considered to be in the string).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant