-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-metadataArea: Crate metadataArea: Crate metadataC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: 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.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Currently, proc-macro crates require a lot of special-casing like the following:
rust/src/librustc_metadata/decoder.rs
Lines 503 to 510 in b176285
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
Labels
A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-metadataArea: Crate metadataArea: Crate metadataC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: 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.Relevant to the compiler team, which will review and decide on the PR/issue.