Skip to content

Add a fallback when attribute expansion returns a compile error #10611

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

Closed
Diggsey opened this issue Oct 22, 2021 · 2 comments
Closed

Add a fallback when attribute expansion returns a compile error #10611

Diggsey opened this issue Oct 22, 2021 · 2 comments

Comments

@Diggsey
Copy link

Diggsey commented Oct 22, 2021

See #10520

Since attribute expansion was enabled by default it means that completion doesn't work anymore inside functions annotated with an attribute.

It would be useful if rust-analyzer could detect this case (where the attribute implementation fails to parse the code) and falls back to the old behaviour in that case.

@flodiebold
Copy link
Member

flodiebold commented Oct 22, 2021

That would require rather brittle special-casing, wouldn't result in correct completions in all cases, and would relieve pressure from proc macro authors to actually make their macros error resilient (which is the only correct fix). IMO we shouldn't do it.

(Plus it would make it impossible for the macro to intentionally expand to a compiler error.)

@Veykril
Copy link
Member

Veykril commented Dec 14, 2021

Closing in favor of #11014

@Veykril Veykril closed this as completed Dec 14, 2021
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

No branches or pull requests

3 participants