6897: Basic support for macros 2.0 r=jonas-schievink a=jonas-schievink

This adds support for (built-in-only) macros 2.0, and removes some hacks used for builtin derives, which are declared via macros 2.0 in libcore.

First steps for https://github.com/rust-analyzer/rust-analyzer/issues/2248.

Blocked on https://github.com/rust-analyzer/ungrammar/pull/16.

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
This commit is contained in:
bors[bot] 2020-12-16 16:52:46 +00:00 committed by GitHub
commit 63bbdb31e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 286 additions and 68 deletions

View file

@ -110,8 +110,8 @@ impl HasSource for TypeAlias {
}
}
impl HasSource for MacroDef {
type Ast = ast::MacroRules;
fn source(self, db: &dyn HirDatabase) -> InFile<ast::MacroRules> {
type Ast = ast::Macro;
fn source(self, db: &dyn HirDatabase) -> InFile<ast::Macro> {
InFile {
file_id: self.id.ast_id.expect("MacroDef without ast_id").file_id,
value: self.id.ast_id.expect("MacroDef without ast_id").to_node(db.upcast()),