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

Use native #[proc_macro] support if rustc is new enough #21

Closed
wants to merge 1 commit into from
Closed

Use native #[proc_macro] support if rustc is new enough #21

wants to merge 1 commit into from

Conversation

AlexTMjugador
Copy link

@AlexTMjugador AlexTMjugador commented Oct 27, 2021

According to its own readme, the proc-macro-hack crate was superseded by native support for #[proc_macro] in expression position in Rust 1.45. Besides that, proc-macro-hack is known to cause issues with rust-analyzer, a popular language server for Rust. A somewhat important consequence of these issues is that using the const_random macro makes Rust Analyzer yield an spurious "unresolved macro" error, which is annoying.

To improve on this situation without explicitly bumping MSRV, let's use native rustc support when available. This can slightly modify the macro hygiene, although I didn't notice any glaring difference.

Related Rust Analyzer project issues and PRs:
rust-lang/rust-analyzer#7221
rust-lang/rust-analyzer#9128

According to its own readme, the proc-macro-hack crate was superseded
by native support for #[proc_macro] in expression position in Rust 1.45.
Besides that, proc-macro-hack is known to cause issues with
rust-analyzer, a popular language server for Rust. A somewhat important
consequence of these issues is that using the const_random macro makes
Rust Analyzer yield an spurious "unresolved macro" error, which is
annoying.

To improve on this situation without bumping MSRV, let's use native
rustc support when available. This can slightly modify the macro
hygiene, although I didn't notice any glaring difference.

Related Rust Analyzer project issues and PRs:
rust-lang/rust-analyzer#7221
rust-lang/rust-analyzer#9128
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant