Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir_expand/src/proc_macro.rs')
-rw-r--r--crates/hir_expand/src/proc_macro.rs15
1 files changed, 9 insertions, 6 deletions
diff --git a/crates/hir_expand/src/proc_macro.rs b/crates/hir_expand/src/proc_macro.rs
index 27c45f002b..df6c38761c 100644
--- a/crates/hir_expand/src/proc_macro.rs
+++ b/crates/hir_expand/src/proc_macro.rs
@@ -1,9 +1,8 @@
//! Proc Macro Expander stub
use base_db::{CrateId, ProcMacroExpansionError, ProcMacroId, ProcMacroKind};
-use mbe::ExpandResult;
-use crate::db::AstDatabase;
+use crate::{db::AstDatabase, ExpandError, ExpandResult};
#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)]
pub struct ProcMacroExpander {
@@ -37,7 +36,11 @@ impl ProcMacroExpander {
let krate_graph = db.crate_graph();
let proc_macro = match krate_graph[self.krate].proc_macro.get(id.0 as usize) {
Some(proc_macro) => proc_macro,
- None => return ExpandResult::str_err("No proc-macro found.".to_string()),
+ None => {
+ return ExpandResult::only_err(ExpandError::Other(
+ "No proc-macro found.".into(),
+ ))
+ }
};
// Proc macros have access to the environment variables of the invoking crate.
@@ -51,17 +54,17 @@ impl ProcMacroExpander {
{
ExpandResult {
value: tt.clone(),
- err: Some(mbe::ExpandError::Other(text.into())),
+ err: Some(ExpandError::Other(text.into())),
}
}
ProcMacroExpansionError::System(text)
| ProcMacroExpansionError::Panic(text) => {
- ExpandResult::only_err(mbe::ExpandError::Other(text.into()))
+ ExpandResult::only_err(ExpandError::Other(text.into()))
}
},
}
}
- None => ExpandResult::only_err(mbe::ExpandError::UnresolvedProcMacro),
+ None => ExpandResult::only_err(ExpandError::UnresolvedProcMacro),
}
}
}