Skip to content

Commit 2e7afd7

Browse files
committed
Improve diagnostics
1 parent 7f30eef commit 2e7afd7

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/libsyntax/ext/expand.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -272,11 +272,9 @@ fn expand_mac_invoc<T: MacroGenerable>(mac: ast::Mac, span: Span, fld: &mut Macr
272272
let parsed = match opt_parsed {
273273
Some(e) => e,
274274
None => {
275-
fld.cx.span_err(
276-
pth.span,
277-
&format!("non-expression macro in expression position: {}",
278-
extname
279-
));
275+
let msg = format!("non-{kind} macro in {kind} position: {name}",
276+
name = extname, kind = T::kind_name());
277+
fld.cx.span_err(pth.span, &msg);
280278
return None;
281279
}
282280
};

0 commit comments

Comments
 (0)