Skip to content

Next steps in macro support #688

Closed
Closed
@matklad

Description

@matklad

The basic infra for macros is in place: hir uses HirFileId which can refer to both usual files and macro expansions.

Now we need to learn how to actually expand macros. We need to handle two kinds of macros: macro by example (macro_rules) and procedural macros. Crates like https://github.com/nrc/proc-macro-rules (thanks @nrc!) should allow us to handle only the second case. Basically, the pipeline should look like

ra::SyntaxNode 
-> proc_macro2::TokenStream 
-> existing macro ecosystem 
-> proc_macro2::TokenStream
-> ra::SyntaxNode

We need to implement only first and last arrow (which might be not easy as it seems because we need hygiene info somewhere).

The next big step after understanding macro_rules would be plugging them into the resolver in a proper recursive way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions