File tree Expand file tree Collapse file tree 3 files changed +31
-6
lines changed Expand file tree Collapse file tree 3 files changed +31
-6
lines changed Original file line number Diff line number Diff line change 2
2
refs/heads/master: 3bbcac322669cff3abde5be937cc4ec3860f3985
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
4
refs/heads/snap-stage3: a6d9689399d091c3265f00434a69c551a61c28dc
5
- refs/heads/try: afd6196d7b87401d20dc5149c6955e2c9758657f
5
+ refs/heads/try: e94465c053b06a5e4e0394812a12f4f6e027a98e
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8
8
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
Original file line number Diff line number Diff line change @@ -37,10 +37,14 @@ pub fn expand_expr(extsbox: @mut SyntaxEnv,
37
37
// entry-point for all syntax extensions.
38
38
expr_mac( ref mac) => {
39
39
match ( * mac) . node {
40
- // Token-tree macros, these will be the only case when we're
41
- // finished transitioning.
40
+ // Token-tree macros:
42
41
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
+ }
44
48
/* using idents and token::special_idents would make the
45
49
the macro names be hygienic */
46
50
let extname = cx. parse_sess ( ) . interner . get ( pth. idents [ 0 ] ) ;
@@ -319,8 +323,12 @@ pub fn expand_stmt(extsbox: @mut SyntaxEnv,
319
323
}
320
324
_ => return orig(s, sp, fld)
321
325
};
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
+ }
324
332
let extname = cx. parse_sess ( ) . interner . get ( pth. idents [ 0 ] ) ;
325
333
let ( fully_expanded, sp) = match ( * extsbox) . find ( & extname) {
326
334
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