File tree Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change
1
+ // error-pattern:fail
2
+
3
+ fn main ( ) {
4
+ let cheese = "roquefort" ;
5
+ let carrots = @"crunchy";
6
+
7
+ fn ( tasties: @str , macerate : & block( & str ) ) {
8
+ macerate ( * tasties) ;
9
+ } ( carrots, { |& food|
10
+ let mush = food + cheese;
11
+ lambda ( ) {
12
+ let chew = mush + cheese;
13
+ fail "so yummy"
14
+ } ( ) ;
15
+ } ) ;
16
+ }
Original file line number Diff line number Diff line change
1
+ // error-pattern:fail
2
+
3
+ use std;
4
+ import std:: map;
5
+ import std:: uint;
6
+
7
+ fn main ( ) {
8
+ let count = @mutable 0 u;
9
+ let hash = bind fn ( _s: & [ @str] , count: @mutable uint) -> uint {
10
+ * count += 1 u;
11
+ if * count == 10 u {
12
+ fail;
13
+ } else {
14
+ ret * count;
15
+ }
16
+ } ( _, count) ;
17
+
18
+ fn eq ( s : & [ @str ] , t : & [ @str ] ) -> bool {
19
+ ret s == t;
20
+ }
21
+
22
+ let map = map:: mk_hashmap ( hash, eq) ;
23
+ let arr = [ ] ;
24
+ for each i in uint:: range ( 0 u, 10 u) {
25
+ arr += [ @"key stuff"] ;
26
+ map. insert ( arr, arr + [ @"value stuff"] ) ;
27
+ }
28
+ }
You can’t perform that action at this time.
0 commit comments