diff options
Diffstat (limited to 'crates/hir_def/src/body.rs')
-rw-r--r-- | crates/hir_def/src/body.rs | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/crates/hir_def/src/body.rs b/crates/hir_def/src/body.rs index 33eb5e78c..92bcc1705 100644 --- a/crates/hir_def/src/body.rs +++ b/crates/hir_def/src/body.rs | |||
@@ -120,18 +120,24 @@ impl Expander { | |||
120 | self.resolve_path_as_macro(db, &path) | 120 | self.resolve_path_as_macro(db, &path) |
121 | }; | 121 | }; |
122 | 122 | ||
123 | let call_id = match macro_call.as_call_id(db, self.crate_def_map.krate, resolver) { | 123 | let mut err = None; |
124 | let call_id = | ||
125 | macro_call.as_call_id_with_errors(db, self.crate_def_map.krate, resolver, &mut |e| { | ||
126 | err.get_or_insert(e); | ||
127 | }); | ||
128 | let call_id = match call_id { | ||
124 | Some(it) => it, | 129 | Some(it) => it, |
125 | None => { | 130 | None => { |
126 | // FIXME: this can mean other things too, but `as_call_id` doesn't provide enough | 131 | if err.is_none() { |
127 | // info. | 132 | eprintln!("no error despite `as_call_id_with_errors` returning `None`"); |
128 | return ExpandResult::only_err(mbe::ExpandError::Other( | 133 | } |
129 | "failed to parse or resolve macro invocation".into(), | 134 | return ExpandResult { value: None, err }; |
130 | )); | ||
131 | } | 135 | } |
132 | }; | 136 | }; |
133 | 137 | ||
134 | let err = db.macro_expand_error(call_id); | 138 | if err.is_none() { |
139 | err = db.macro_expand_error(call_id); | ||
140 | } | ||
135 | 141 | ||
136 | let file_id = call_id.as_file(); | 142 | let file_id = call_id.as_file(); |
137 | 143 | ||