Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-expand/src/declarative.rs')
-rw-r--r--crates/hir-expand/src/declarative.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/crates/hir-expand/src/declarative.rs b/crates/hir-expand/src/declarative.rs
index 37084ee8b9..6874336cd2 100644
--- a/crates/hir-expand/src/declarative.rs
+++ b/crates/hir-expand/src/declarative.rs
@@ -31,7 +31,7 @@ impl DeclarativeMacroExpander {
call_id: MacroCallId,
) -> ExpandResult<tt::Subtree> {
let loc = db.lookup_intern_macro_call(call_id);
- let toolchain = &db.crate_graph()[loc.def.krate].toolchain;
+ let toolchain = db.toolchain(loc.def.krate);
let new_meta_vars = toolchain.as_ref().map_or(false, |version| {
REQUIREMENT.get_or_init(|| VersionReq::parse(">=1.76").unwrap()).matches(
&base_db::Version {
@@ -44,9 +44,9 @@ impl DeclarativeMacroExpander {
)
});
match self.mac.err() {
- Some(e) => ExpandResult::new(
+ Some(_) => ExpandResult::new(
tt::Subtree::empty(tt::DelimSpan { open: loc.call_site, close: loc.call_site }),
- ExpandError::other(format!("invalid macro definition: {e}")),
+ ExpandError::MacroDefinition,
),
None => self
.mac
@@ -67,7 +67,7 @@ impl DeclarativeMacroExpander {
krate: CrateId,
call_site: Span,
) -> ExpandResult<tt::Subtree> {
- let toolchain = &db.crate_graph()[krate].toolchain;
+ let toolchain = db.toolchain(krate);
let new_meta_vars = toolchain.as_ref().map_or(false, |version| {
REQUIREMENT.get_or_init(|| VersionReq::parse(">=1.76").unwrap()).matches(
&base_db::Version {
@@ -80,9 +80,9 @@ impl DeclarativeMacroExpander {
)
});
match self.mac.err() {
- Some(e) => ExpandResult::new(
+ Some(_) => ExpandResult::new(
tt::Subtree::empty(tt::DelimSpan { open: call_site, close: call_site }),
- ExpandError::other(format!("invalid macro definition: {e}")),
+ ExpandError::MacroDefinition,
),
None => self.mac.expand(&tt, |_| (), new_meta_vars, call_site).map_err(Into::into),
}
@@ -119,7 +119,7 @@ impl DeclarativeMacroExpander {
_ => None,
}
};
- let toolchain = crate_data.toolchain.as_ref();
+ let toolchain = db.toolchain(def_crate);
let new_meta_vars = toolchain.as_ref().map_or(false, |version| {
REQUIREMENT.get_or_init(|| VersionReq::parse(">=1.76").unwrap()).matches(
&base_db::Version {