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

Edition dependent parser #16324

Open
2 tasks
Veykril opened this issue Jan 9, 2024 · 1 comment
Open
2 tasks

Edition dependent parser #16324

Veykril opened this issue Jan 9, 2024 · 1 comment
Assignees
Labels
A-parser parser issues C-bug Category: bug E-medium

Comments

@Veykril
Copy link
Member

Veykril commented Jan 9, 2024

Our parser currently assumes the latest edition (+ a small hack to be able to parse the standard libraries try macro, although that's not really useful anymore). We should fix this!

This is gonna be 2 main tasks:

  • Making the parser edition aware (and have rust-analyzer just pass the latest edition to it).
  • Make rust-analyzer ask for file parses with the corresponding editions

The first point should be fairly trivial I believe, it's just adding an edition field to the Parser struct and then some special branching and recognizing certain keywords based on edition etc.

The second one is going to be more tricky, as for one, anywhere where we execute the parse query we will have to now supply an edition, similarly we have to do this for whenever we parse a macro expansion. The edition for a normal file parse is gonna be decided by the crate's edition the file belongs to, the edition for a macro parse on the other hand depends on the edition of the crate that the macro definition belongs to (I think).

So with that said, the first point is a rather simple change, the second will be more invasive.

@Urhengulas
Copy link
Contributor

@rustbot claim

bors added a commit that referenced this issue Apr 14, 2024
internal: Thread edition through to parsing/tt-to-syntax-tree routines for macros

Follow up to #16450, cc #16324
lnicola pushed a commit to lnicola/rust that referenced this issue Apr 20, 2024
internal: Thread edition through to parsing/tt-to-syntax-tree routines for macros

Follow up to rust-lang/rust-analyzer#16450, cc rust-lang/rust-analyzer#16324
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-parser parser issues C-bug Category: bug E-medium
Projects
None yet
Development

No branches or pull requests

2 participants