File tree Expand file tree Collapse file tree 2 files changed +30
-5
lines changed Expand file tree Collapse file tree 2 files changed +30
-5
lines changed Original file line number Diff line number Diff line change @@ -37,10 +37,14 @@ pub fn expand_expr(extsbox: @mut SyntaxEnv,
3737 // entry-point for all syntax extensions.
3838 expr_mac( ref mac) => {
3939 match ( * mac) . node {
40- // Token-tree macros, these will be the only case when we're
41- // finished transitioning.
40+ // Token-tree macros:
4241 mac_invoc_tt( pth, ref tts) => {
43- assert ( vec:: len ( pth. idents ) == 1 u) ;
42+ if ( pth. idents . len ( ) > 1 u) {
43+ cx. span_fatal (
44+ pth. span ,
45+ fmt ! ( "expected macro name without module \
46+ separators") ) ;
47+ }
4448 /* using idents and token::special_idents would make the
4549 the macro names be hygienic */
4650 let extname = cx. parse_sess ( ) . interner . get ( pth. idents [ 0 ] ) ;
@@ -319,8 +323,12 @@ pub fn expand_stmt(extsbox: @mut SyntaxEnv,
319323 }
320324 _ => return orig(s, sp, fld)
321325 };
322-
323- assert(vec::len(pth.idents) == 1u);
326+ if (pth.idents.len() > 1u) {
327+ cx.span_fatal(
328+ pth.span,
329+ fmt!("expected macro name without module \
330+ separators" ) ) ;
331+ }
324332 let extname = cx. parse_sess ( ) . interner . get ( pth. idents [ 0 ] ) ;
325333 let ( fully_expanded, sp) = match ( * extsbox) . find ( & extname) {
326334 None =>
Original file line number Diff line number Diff line change 1+ // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2+ // file at the top-level directory of this distribution and at
3+ // http://rust-lang.org/COPYRIGHT.
4+ //
5+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+ // option. This file may not be copied, modified, or distributed
9+ // except according to those terms.
10+
11+ // error-pattern:expected macro name without module separators
12+
13+ fn main ( ) {
14+ globnar:: brotz!( ) ;
15+ }
16+
17+
You can’t perform that action at this time.
0 commit comments