@@ -1328,7 +1328,7 @@ native mod kernel32 { }
1328
1328
The ` link_name ` attribute allows the default library naming behavior to
1329
1329
be overriden by explicitly specifying the name of the library.
1330
1330
1331
- ~~~
1331
+ ~~~ {.xfail-test}
1332
1332
#[link_name = "crypto"]
1333
1333
native mod mycrypto { }
1334
1334
~~~
@@ -2714,11 +2714,11 @@ order specified by the tuple type.
2714
2714
2715
2715
An example of a tuple type and its use:
2716
2716
2717
- ~~~~ {.xfail-test}
2717
+ ~~~~
2718
2718
type pair = (int,str);
2719
2719
let p: pair = (10,"hello");
2720
2720
let (a, b) = p;
2721
- assert (b == "world") ;
2721
+ assert b != "world";
2722
2722
~~~~
2723
2723
2724
2724
### Vector types
@@ -2741,8 +2741,8 @@ behaviour supports idiomatic in-place "growth" of a mutable slot holding a
2741
2741
vector:
2742
2742
2743
2743
2744
- ~~~~ {.xfail-test}
2745
- let v: mutable [int] = [1, 2, 3];
2744
+ ~~~~
2745
+ let mut v: [int] = [1, 2, 3];
2746
2746
v += [4, 5, 6];
2747
2747
~~~~
2748
2748
@@ -2796,12 +2796,12 @@ consists of a sequence of input slots, an optional set of
2796
2796
2797
2797
An example of a ` fn ` type:
2798
2798
2799
- ~~~~~~~~ {.xfail-test}
2799
+ ~~~~~~~~
2800
2800
fn add(x: int, y: int) -> int {
2801
2801
ret x + y;
2802
2802
}
2803
2803
2804
- let int x = add(5,7);
2804
+ let x = add(5,7);
2805
2805
2806
2806
type binop = fn(int,int) -> int;
2807
2807
let bo: binop = add;
@@ -2879,9 +2879,11 @@ has a set of points before and after it in the implied control flow.
2879
2879
2880
2880
For example, this code:
2881
2881
2882
- ~~~~~~~~ {.xfail-test}
2883
- s = "hello, world";
2884
- print(s);
2882
+ ~~~~~~~~
2883
+ # let s;
2884
+
2885
+ s = "hello, world";
2886
+ io::println(s);
2885
2887
~~~~~~~~
2886
2888
2887
2889
Consists of 2 statements, 3 expressions and 12 points:
@@ -2904,8 +2906,11 @@ Consists of 2 statements, 3 expressions and 12 points:
2904
2906
Whereas this code:
2905
2907
2906
2908
2907
- ~~~~~~~~ {.xfail-test}
2908
- print(x() + y());
2909
+ ~~~~~~~~
2910
+ # fn x() -> str { "" }
2911
+ # fn y() -> str { "" }
2912
+
2913
+ io::println(x() + y());
2909
2914
~~~~~~~~
2910
2915
2911
2916
Consists of 1 statement, 7 expressions and 14 points:
@@ -3200,19 +3205,12 @@ let x: @int = @10;
3200
3205
let x: ~int = ~10;
3201
3206
~~~~~~~~
3202
3207
3203
- Some operations implicitly dereference boxes. Examples of such @dfn {implicit
3204
- dereference} operations are:
3205
-
3206
- * arithmetic operators (` x + y - z ` )
3207
- * field selection (` x.y.z ` )
3208
-
3209
-
3210
- An example of an implicit-dereference operation performed on box values:
3208
+ Some operations (such as field selection) implicitly dereference boxes. An
3209
+ example of an @dfn {implicit dereference} operation performed on box values:
3211
3210
3212
- ~~~~~~~~ {.xfail-test}
3213
- let x: @int = @10;
3214
- let y: @int = @12;
3215
- assert (x + y == 22);
3211
+ ~~~~~~~~
3212
+ let x = @{y: 10};
3213
+ assert x.y == 10;
3216
3214
~~~~~~~~
3217
3215
3218
3216
Other operations act on box values as single-word-sized address values. For
@@ -3383,20 +3381,17 @@ The result of a `spawn` call is a `core::task::task` value.
3383
3381
3384
3382
An example of a ` spawn ` call:
3385
3383
3386
- ~~~~ {.xfail-test}
3387
- import task::*;
3388
- import comm::*;
3389
-
3390
- let p = port();
3391
- let c = chan(p);
3384
+ ~~~~
3385
+ let po = comm::port();
3386
+ let ch = comm::chan(po);
3392
3387
3393
- spawn {||
3388
+ task:: spawn {||
3394
3389
// let task run, do other things
3395
3390
// ...
3396
- send(c , true);
3391
+ comm:: send(ch , true);
3397
3392
};
3398
3393
3399
- let result = recv(p );
3394
+ let result = comm:: recv(po );
3400
3395
~~~~
3401
3396
3402
3397
@@ -3408,10 +3403,10 @@ channel's outgoing buffer.
3408
3403
3409
3404
An example of a send:
3410
3405
3411
- ~~~~ {.xfail-test}
3412
- import comm::* ;
3413
- let c: chan<str> = ... ;
3414
- send(c , "hello, world");
3406
+ ~~~~
3407
+ let po = comm::port() ;
3408
+ let ch = comm::chan(po) ;
3409
+ comm:: send(ch , "hello, world");
3415
3410
~~~~
3416
3411
3417
3412
@@ -3424,10 +3419,11 @@ time the port deques a value to return, and un-blocks the receiving task.
3424
3419
3425
3420
An example of a * receive* :
3426
3421
3427
- ~~~~~~~~ {.xfail-test}
3428
- import comm::*;
3429
- let p: port<str> = ...;
3430
- let s = recv(p);
3422
+ ~~~~~~~~
3423
+ # let po = comm::port();
3424
+ # let ch = comm::chan(po);
3425
+ # comm::send(ch, "");
3426
+ let s = comm::recv(po);
3431
3427
~~~~~~~~
3432
3428
3433
3429
0 commit comments