Skip to content

Commit 4f3a968

Browse files
committed
better error message for macros with MOD_SEPs
1 parent dd34178 commit 4f3a968

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/libsyntax/ext/expand.rs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,14 @@ pub fn expand_expr(extsbox: @mut SyntaxEnv,
3838
// entry-point for all syntax extensions.
3939
expr_mac(ref mac) => {
4040
match (*mac).node {
41-
// Token-tree macros, these will be the only case when we're
42-
// finished transitioning.
41+
// Token-tree macros:
4342
mac_invoc_tt(pth, ref tts) => {
44-
assert (vec::len(pth.idents) == 1u);
43+
if (pth.idents.len() > 1u) {
44+
cx.span_fatal(
45+
pth.span,
46+
fmt!("expected macro name without module \
47+
separators, got: '%?'",pth));
48+
}
4549
/* using idents and token::special_idents would make the
4650
the macro names be hygienic */
4751
let extname = cx.parse_sess().interner.get(pth.idents[0]);
@@ -320,8 +324,12 @@ pub fn expand_stmt(extsbox: @mut SyntaxEnv,
320324
}
321325
_ => return orig(s, sp, fld)
322326
};
323-
324-
assert(vec::len(pth.idents) == 1u);
327+
if (pth.idents.len() > 1u) {
328+
cx.span_fatal(
329+
pth.span,
330+
fmt!("expected macro name without module \
331+
separators, got: '%?'",pth));
332+
}
325333
let extname = cx.parse_sess().interner.get(pth.idents[0]);
326334
let (fully_expanded, sp) = match (*extsbox).find(&extname) {
327335
None =>

0 commit comments

Comments
 (0)