File tree Expand file tree Collapse file tree 3 files changed +28
-1
lines changed Expand file tree Collapse file tree 3 files changed +28
-1
lines changed Original file line number Diff line number Diff line change 2
2
refs/heads/master: 0da105a8b7b6b1e0568e8ff20f6ff4b13cc7ecc2
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
4
refs/heads/snap-stage3: a6d3e57dca68fde4effdda3e4ae2887aa535fcd6
5
- refs/heads/try: 0dc9f6277939a661011a07fbc88f0f0449ac276c
5
+ refs/heads/try: e2d192c9f4baa6bf8c4f930e4225d969c7595551
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 @@ -3225,6 +3225,32 @@ let bo: Binop = add;
3225
3225
x = bo(5,7);
3226
3226
~~~~
3227
3227
3228
+ ### Closure types
3229
+
3230
+ The type of a closure mapping an input of type ` A ` to an output of type ` B ` is ` |A| -> B ` . A closure with no arguments or return values has type ` || ` .
3231
+
3232
+
3233
+ An example of creating and calling a closure:
3234
+
3235
+ ``` rust
3236
+ let captured_var = 10 ;
3237
+
3238
+ let closure_no_args = || println! (" captured_var={}" , captured_var );
3239
+
3240
+ let closure_args = | arg : int | -> int {
3241
+ println! (" captured_var={}, arg={}" , captured_var , arg );
3242
+ arg // Note lack of semicolon after 'arg'
3243
+ };
3244
+
3245
+ fn call_closure (c1 : || , c2 : | int | -> int ) {
3246
+ c1 ();
3247
+ c2 (2 );
3248
+ }
3249
+
3250
+ call_closure (closure_no_args , closure_args );
3251
+
3252
+ ```
3253
+
3228
3254
### Object types
3229
3255
3230
3256
Every trait item (see [ traits] ( #traits ) ) defines a type with the same name as the trait.
Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ fn get_ast_and_resolve(cpath: &Path,
51
51
binary : @"rustdoc",
52
52
maybe_sysroot : Some ( @os:: self_exe_path ( ) . unwrap ( ) . dir_path ( ) ) ,
53
53
addl_lib_search_paths : @mut libs,
54
+ outputs : ~[ driver:: session:: OutputDylib ] ,
54
55
.. ( * rustc:: driver:: session:: basic_options ( ) ) . clone ( )
55
56
} ;
56
57
You can’t perform that action at this time.
0 commit comments