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

Closed
2 tasks done
Veykril opened this issue Jan 9, 2024 · 1 comment · Fixed by #17620
Closed
2 tasks done

Edition dependent parser #16324

Veykril opened this issue Jan 9, 2024 · 1 comment · Fixed by #17620
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
@Veykril Veykril assigned Veykril and unassigned Urhengulas Jul 17, 2024
This was referenced Jul 17, 2024
@bors bors closed this as completed in fa3dd33 Jul 19, 2024
lnicola pushed a commit to lnicola/rust that referenced this issue Jul 28, 2024
Edition aware parser

Fixes rust-lang/rust-analyzer#16324 by allowing us to properly thread through the edition to the parser
RalfJung pushed a commit to RalfJung/rust that referenced this issue Aug 1, 2024
Edition aware parser

Fixes rust-lang/rust-analyzer#16324 by allowing us to properly thread through the edition to the parser
github-actions bot pushed a commit to rust-lang/miri that referenced this issue Aug 2, 2024
Edition aware parser

Fixes rust-lang/rust-analyzer#16324 by allowing us to properly thread through the edition to the parser
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

Successfully merging a pull request may close this issue.

2 participants