File tree 2 files changed +33
-5
lines changed
2 files changed +33
-5
lines changed Original file line number Diff line number Diff line change @@ -2630,8 +2630,7 @@ impl<'a> Parser<'a> {
2630
2630
// A tuple index may not have a suffix
2631
2631
self . expect_no_suffix ( sp, "tuple index" , suf) ;
2632
2632
2633
- let dot_span = self . prev_span ;
2634
- hi = self . span ;
2633
+ let idx_span = self . span ;
2635
2634
self . bump ( ) ;
2636
2635
2637
2636
let invalid_msg = "invalid tuple or struct index" ;
@@ -2646,9 +2645,8 @@ impl<'a> Parser<'a> {
2646
2645
n. to_string ( ) ) ;
2647
2646
err. emit ( ) ;
2648
2647
}
2649
- let id = respan ( dot_span. to ( hi) , n) ;
2650
- let field = self . mk_tup_field ( e, id) ;
2651
- e = self . mk_expr ( lo. to ( hi) , field, ThinVec :: new ( ) ) ;
2648
+ let field = self . mk_tup_field ( e, respan ( idx_span, n) ) ;
2649
+ e = self . mk_expr ( lo. to ( idx_span) , field, ThinVec :: new ( ) ) ;
2652
2650
}
2653
2651
None => {
2654
2652
let prev_span = self . prev_span ;
Original file line number Diff line number Diff line change
1
+ // Copyright 2017 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
+ // ignore-pretty pretty-printing is unhygienic
12
+
13
+ #![ feature( decl_macro) ]
14
+ #![ allow( unused) ]
15
+
16
+ mod foo {
17
+ pub macro m( $s: tt, $i: tt) {
18
+ $s. $i
19
+ }
20
+ }
21
+
22
+ mod bar {
23
+ struct S ( i32 ) ;
24
+ fn f ( ) {
25
+ let s = S ( 0 ) ;
26
+ :: foo:: m!( s, 0 ) ;
27
+ }
28
+ }
29
+
30
+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments