You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have read all the tree-sitter docs if it relates to using the parser
I have searched the existing issues of tree-sitter-rust
Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)
No response
Describe the bug
This grammar successfully parses the following code:
mod tests {pubfnexecute(){}#[cfg(feature = "tracing")]}
This code is incorrect because #[cfg(feature = "tracing")] is an outer attribute, which needs to be followed by the element it is applied to. This is indeed rejected by rustc:
error: expected item after attributes
--> test.rs:3:5
|
3 | #[cfg(feature = "tracing")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 1 previous error
A correct version would be:
mod tests {#[cfg(feature = "tracing")]pubfnexecute(){}}
In this example, we expect the attribute and function declaration to be bundled together, and not treated as two independent children of the module, as is currently the case.
Steps To Reproduce/Bad Parse Tree
See above.
Expected Behavior/Parse Tree
Correctly bundling outer attributes with the syntactic element they apply to.
Repro
mod tests {pubfnexecute(){}#[cfg(feature = "tracing")]}
The text was updated successfully, but these errors were encountered:
Did you check existing issues?
Tree-Sitter CLI Version, if relevant (output of
tree-sitter --version
)No response
Describe the bug
This grammar successfully parses the following code:
This code is incorrect because
#[cfg(feature = "tracing")]
is an outer attribute, which needs to be followed by the element it is applied to. This is indeed rejected by rustc:A correct version would be:
In this example, we expect the attribute and function declaration to be bundled together, and not treated as two independent children of the module, as is currently the case.
Steps To Reproduce/Bad Parse Tree
See above.
Expected Behavior/Parse Tree
Correctly bundling outer attributes with the syntactic element they apply to.
Repro
The text was updated successfully, but these errors were encountered: