mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-08-22 19:34:16 +00:00
Retain types of proc macros and allow attr. macros
This commit is contained in:
parent
e8a19e24ea
commit
fb21a215be
6 changed files with 30 additions and 22 deletions
|
@ -143,9 +143,17 @@ impl CrateDisplayName {
|
|||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct ProcMacroId(pub u32);
|
||||
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
|
||||
pub enum ProcMacroKind {
|
||||
CustomDerive,
|
||||
FuncLike,
|
||||
Attr,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ProcMacro {
|
||||
pub name: SmolStr,
|
||||
pub kind: ProcMacroKind,
|
||||
pub expander: Arc<dyn TokenExpander>,
|
||||
}
|
||||
|
||||
|
@ -198,11 +206,8 @@ impl CrateGraph {
|
|||
display_name: Option<CrateDisplayName>,
|
||||
cfg_options: CfgOptions,
|
||||
env: Env,
|
||||
proc_macro: Vec<(SmolStr, Arc<dyn tt::TokenExpander>)>,
|
||||
proc_macro: Vec<ProcMacro>,
|
||||
) -> CrateId {
|
||||
let proc_macro =
|
||||
proc_macro.into_iter().map(|(name, it)| ProcMacro { name, expander: it }).collect();
|
||||
|
||||
let data = CrateData {
|
||||
root_file_id: file_id,
|
||||
edition,
|
||||
|
|
|
@ -14,7 +14,7 @@ pub use crate::{
|
|||
change::Change,
|
||||
input::{
|
||||
CrateData, CrateDisplayName, CrateGraph, CrateId, CrateName, Dependency, Edition, Env,
|
||||
ProcMacroId, SourceRoot, SourceRootId,
|
||||
ProcMacro, ProcMacroId, ProcMacroKind, SourceRoot, SourceRootId,
|
||||
},
|
||||
};
|
||||
pub use salsa;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue