File tree Expand file tree Collapse file tree 3 files changed +19
-9
lines changed
branches/try2/src/test/run-pass Expand file tree Collapse file tree 3 files changed +19
-9
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
5
5
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8
- refs/heads/try2: 235ca1801ec8053b7cab46ed6708c382e58df63b
8
+ refs/heads/try2: ee1ee7f463240ebda33d2180dd54be7a5e7f923c
9
9
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
10
10
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
11
11
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
Original file line number Diff line number Diff line change 10
10
11
11
#![ feature( macro_rules) ]
12
12
13
+ // after fixing #9384 and implementing hygiene for match bindings,
14
+ // this now fails because the insertion of the 'y' into the match
15
+ // doesn't cause capture. Making this macro hygienic (as I've done)
16
+ // could very well make this test case completely pointless....
17
+
13
18
enum T {
14
19
A ( int ) ,
15
20
B ( uint )
16
21
}
17
22
18
23
macro_rules! test(
19
- ( $e: expr) => (
24
+ ( $id : ident , $ e: expr) => (
20
25
fn foo( t: T ) -> int {
21
26
match t {
22
- A ( y ) => $e,
23
- B ( y ) => $e
27
+ A ( $id ) => $e,
28
+ B ( $id ) => $e
24
29
}
25
30
}
26
31
)
27
32
)
28
33
29
- test ! ( 10 + ( y as int) )
34
+ test ! ( y , 10 + ( y as int) )
30
35
31
36
pub fn main ( ) {
32
37
foo ( A ( 20 ) ) ;
Original file line number Diff line number Diff line change @@ -15,19 +15,24 @@ enum T {
15
15
B ( f64 )
16
16
}
17
17
18
+ // after fixing #9384 and implementing hygiene for match bindings,
19
+ // this now fails because the insertion of the 'y' into the match
20
+ // doesn't cause capture. Making this macro hygienic (as I've done)
21
+ // could very well make this test case completely pointless....
22
+
18
23
macro_rules! test(
19
- ( $e: expr) => (
24
+ ( $id1 : ident , $id2 : ident , $ e: expr) => (
20
25
fn foo( a: T , b: T ) -> T {
21
26
match ( a, b) {
22
- ( A ( x ) , A ( y ) ) => A ( $e) ,
23
- ( B ( x ) , B ( y ) ) => B ( $e) ,
27
+ ( A ( $id1 ) , A ( $id2 ) ) => A ( $e) ,
28
+ ( B ( $id1 ) , B ( $id2 ) ) => B ( $e) ,
24
29
_ => fail!( )
25
30
}
26
31
}
27
32
)
28
33
)
29
34
30
- test ! ( x + y)
35
+ test ! ( x, y , x + y)
31
36
32
37
pub fn main ( ) {
33
38
foo ( A ( 1 ) , A ( 2 ) ) ;
You can’t perform that action at this time.
0 commit comments