Skip to content

Commit 9f0b3ef

Browse files
committed
---
yaml --- r: 94044 b: refs/heads/try c: e2d192c h: refs/heads/master v: v3
1 parent 9233df4 commit 9f0b3ef

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 0da105a8b7b6b1e0568e8ff20f6ff4b13cc7ecc2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d3e57dca68fde4effdda3e4ae2887aa535fcd6
5-
refs/heads/try: 0dc9f6277939a661011a07fbc88f0f0449ac276c
5+
refs/heads/try: e2d192c9f4baa6bf8c4f930e4225d969c7595551
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/doc/rust.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3225,6 +3225,32 @@ let bo: Binop = add;
32253225
x = bo(5,7);
32263226
~~~~
32273227

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+
32283254
### Object types
32293255

32303256
Every trait item (see [traits](#traits)) defines a type with the same name as the trait.

branches/try/src/librustdoc/core.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ fn get_ast_and_resolve(cpath: &Path,
5151
binary: @"rustdoc",
5252
maybe_sysroot: Some(@os::self_exe_path().unwrap().dir_path()),
5353
addl_lib_search_paths: @mut libs,
54+
outputs: ~[driver::session::OutputDylib],
5455
.. (*rustc::driver::session::basic_options()).clone()
5556
};
5657

0 commit comments

Comments
 (0)