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

feat: expand procedural attribute macros #9128

Merged
merged 4 commits into from
Jun 3, 2021
Merged

feat: expand procedural attribute macros #9128

merged 4 commits into from
Jun 3, 2021

Conversation

jonas-schievink
Copy link
Contributor

@jonas-schievink jonas-schievink commented Jun 3, 2021

This adds experimental support for attribute macros. They can be enabled by setting rust-analyzer.experimental.procAttrMacros to true.

Known issues:

Closes #8971
Fixes #8964 / la10736/rstest#120
Fixes #2984
Fixes #5412
Fixes #6029
Fixes #6687

#6740 is still not fixed – we now expand #[proc_macro_hack], but fail to expand the resulting proc_macro_call!() macro.

@jonas-schievink jonas-schievink changed the title [WIP] feat: expand procedural attribute macros feat: expand procedural attribute macros Jun 3, 2021
@jonas-schievink jonas-schievink marked this pull request as ready for review June 3, 2021 14:11
@jonas-schievink
Copy link
Contributor Author

bors r+

bors bot added a commit that referenced this pull request Jun 3, 2021
9128: feat: expand procedural attribute macros r=jonas-schievink a=jonas-schievink

This adds experimental support for attribute macros. They can be enabled by setting `rust-analyzer.experimental.procAttrMacros` to `true`.

Known issues:
* Tokens aren't remapped, presumably because we edit the input syntax tree (this causes IDE features to not work inside items with attribute macros on them)
* Macro errors aren't reported correctly

Closes #8971
Fixes #8964 / la10736/rstest#120
Fixes #2984
Fixes #5412
Fixes #6029
Fixes #6687

#6740 is still not fixed – we now expand `#[proc_macro_hack]`, but fail to expand the resulting `proc_macro_call!()` macro.

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
@bors
Copy link
Contributor

bors bot commented Jun 3, 2021

Build failed:

@jonas-schievink
Copy link
Contributor Author

bors r+

@bors
Copy link
Contributor

bors bot commented Jun 3, 2021

Build succeeded:

@bors bors bot merged commit 1415367 into rust-lang:master Jun 3, 2021
@jonas-schievink jonas-schievink deleted the expand-attr-macros branch June 3, 2021 16:24
@matklad
Copy link
Member

matklad commented Jun 3, 2021

🥳

@paxelpixel
Copy link

fixes my issue with webassembly book ty vm

japaric added a commit to japaric/lsp-mode that referenced this pull request Aug 20, 2021
this config flag was added in rust-lang/rust-analyzer#9128

when enabled, the existing `lsp-rust-analyzer-expand-macro` function will also
expand proc macro attributes

as this is an experimental feature, the default value of the setting is nil
brotzeit pushed a commit to emacs-lsp/lsp-mode that referenced this pull request Aug 21, 2021
this config flag was added in rust-lang/rust-analyzer#9128

when enabled, the existing `lsp-rust-analyzer-expand-macro` function will also
expand proc macro attributes

as this is an experimental feature, the default value of the setting is nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants