File tree Expand file tree Collapse file tree 4 files changed +21
-17
lines changed Expand file tree Collapse file tree 4 files changed +21
-17
lines changed Original file line number Diff line number Diff line change 2
2
refs/heads/master: c081ffbd1e845687202a975ea2e698b623e5722f
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
4
refs/heads/snap-stage3: 79a2b2eafc3c766cecec8a5f76317693bae9ed17
5
- refs/heads/try: 32840a44295ebcfdd21b73ef4704f6e06b4f6437
5
+ refs/heads/try: e2c09fa3b997e09176d7cca228be2727ba525aa5
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 8
8
// option. This file may not be copied, modified, or distributed
9
9
// except according to those terms.
10
10
11
+ #[ link ( name = "issue2378a" ) ] ;
12
+ #[ crate_type = "lib" ] ;
13
+
11
14
enum maybe < T > { just( T ) , nothing }
12
15
13
- impl copy > for maybe < T > for methods< T {
14
- fn ~ [ ] ( idx: uint) -> T {
16
+ impl < T : Copy > Index < uint , T > for maybe < T > {
17
+ fn index ( & self , idx : & uint ) -> T {
15
18
match self {
16
- just( t) { t }
17
- nothing { fail!( ) ; }
19
+ & just( ref t) => copy * t ,
20
+ & nothing => { fail ! ( ) ; }
18
21
}
19
22
}
20
23
}
Original file line number Diff line number Diff line change 8
8
// option. This file may not be copied, modified, or distributed
9
9
// except according to those terms.
10
10
11
- use issue2378a;
11
+ #[ link ( name = "issue2378b" ) ] ;
12
+ #[ crate_type = "lib" ] ;
13
+
14
+ extern mod issue2378a;
12
15
13
16
use issue2378a:: maybe;
14
- use issue2378a:: methods;
15
17
16
- type two_maybes < T > = { a : maybe < T > , b : maybe < T > } ;
18
+ struct two_maybes < T > { a : maybe < T > , b : maybe < T > }
17
19
18
- impl copy > for two_maybes < T > for methods< T {
19
- fn ~ [ ] ( idx: uint) -> ( T , T ) {
20
- ( self . a [ idx] , self . b [ idx] )
20
+ impl < T : Copy > Index < uint , ( T , T ) > for two_maybes < T > {
21
+ fn index ( & self , idx : & uint ) -> ( T , T ) {
22
+ ( self . a [ * idx] , self . b [ * idx] )
21
23
}
22
24
}
Original file line number Diff line number Diff line change 8
8
// option. This file may not be copied, modified, or distributed
9
9
// except according to those terms.
10
10
11
- // xfail-test -- #2378 unfixed
12
11
// aux-build:issue2378a.rs
13
12
// aux-build:issue2378b.rs
14
13
15
- use issue2378a;
16
- use issue2378b;
14
+ extern mod issue2378a;
15
+ extern mod issue2378b;
17
16
18
- use issue2378a:: { just, methods } ;
19
- use issue2378b:: { methods } ;
17
+ use issue2378a:: { just} ;
18
+ use issue2378b:: { two_maybes } ;
20
19
21
20
pub fn main ( ) {
22
- let x = { a: just ( 3 ) , b: just ( 5 ) } ;
21
+ let x = two_maybes { a : just ( 3 ) , b : just ( 5 ) } ;
23
22
assert ! ( x[ 0 u] == ( 3 , 5 ) ) ;
24
23
}
You can’t perform that action at this time.
0 commit comments