Skip to content

Investigate if proc-macro crates can use regular crate metadata. #49271

Closed
@michaelwoerister

Description

@michaelwoerister

Currently, proc-macro crates require a lot of special-casing like the following:

pub fn get_def(&self, index: DefIndex) -> Option<Def> {
if !self.is_proc_macro(index) {
self.entry(index).kind.to_def(self.local_def_id(index))
} else {
let kind = self.proc_macros.as_ref().unwrap()[index.to_proc_macro_index()].1.kind();
Some(Def::Macro(self.local_def_id(index), kind))
}
}

I wonder if this is really necessary. It would be preferable if proc-macro crates could be treated as regular crates.

cc @rust-lang/compiler @jseyfried

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-metadataArea: Crate metadataC-enhancementCategory: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions