Skip to content

Commit ab0c7af

Browse files
author
Jorge Aparicio
committed
ignore boxed closure doctests in the guide/reference
1 parent a9ea4d0 commit ab0c7af

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

src/doc/guide-testing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ optimizer to consider the result used and ensures it cannot remove the
536536
computation entirely. This could be done for the example above by adjusting the
537537
`b.iter` call to
538538

539-
```rust
539+
```{rust,ignore}
540540
# struct X; impl X { fn iter<T>(&self, _: || -> T) {} } let b = X;
541541
b.iter(|| {
542542
// note lack of `;` (could also use an explicit `return`).
@@ -548,7 +548,7 @@ Or, the other option is to call the generic `test::black_box` function, which
548548
is an opaque "black box" to the optimizer and so forces it to consider any
549549
argument as used.
550550

551-
```rust
551+
```{rust,ignore}
552552
extern crate test;
553553
554554
# fn main() {

src/doc/guide.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4231,7 +4231,7 @@ arguments, really powerful things are possible.
42314231
42324232
Let's make a closure:
42334233
4234-
```{rust}
4234+
```{rust,ignore}
42354235
let add_one = |x| { 1 + x };
42364236
42374237
println!("The sum of 5 plus 1 is {}.", add_one(5));
@@ -4243,7 +4243,7 @@ binding name and two parentheses, just like we would for a named function.
42434243
42444244
Let's compare syntax. The two are pretty close:
42454245
4246-
```{rust}
4246+
```{rust,ignore}
42474247
let add_one = |x: i32| -> i32 { 1 + x };
42484248
fn add_one (x: i32) -> i32 { 1 + x }
42494249
```
@@ -4256,7 +4256,7 @@ There's one big difference between a closure and named functions, and it's in
42564256
the name: a closure "closes over its environment." What does that mean? It means
42574257
this:
42584258
4259-
```{rust}
4259+
```{rust,ignore}
42604260
fn main() {
42614261
let x = 5;
42624262
@@ -4297,7 +4297,7 @@ now. We'll talk about them more in the "Threads" section of the guide.
42974297
42984298
Closures are most useful as an argument to another function. Here's an example:
42994299
4300-
```{rust}
4300+
```{rust,ignore}
43014301
fn twice(x: i32, f: |i32| -> i32) -> i32 {
43024302
f(x) + f(x)
43034303
}
@@ -4311,14 +4311,14 @@ fn main() {
43114311
43124312
Let's break the example down, starting with `main`:
43134313
4314-
```{rust}
4314+
```{rust,ignore}
43154315
let square = |x: i32| { x * x };
43164316
```
43174317
43184318
We've seen this before. We make a closure that takes an integer, and returns
43194319
its square.
43204320
4321-
```{rust}
4321+
```{rust,ignore}
43224322
# fn twice(x: i32, f: |i32| -> i32) -> i32 { f(x) + f(x) }
43234323
# let square = |x: i32| { x * x };
43244324
twice(5, square); // evaluates to 50
@@ -4342,7 +4342,7 @@ though, and that function takes an `i32` and returns an `i32`. Notice
43424342
how the `|i32| -> i32` syntax looks a lot like our definition of `square`
43434343
above, if we added the return type in:
43444344
4345-
```{rust}
4345+
```{rust,ignore}
43464346
let square = |x: i32| -> i32 { x * x };
43474347
// |i32| -> i32
43484348
```
@@ -4357,7 +4357,7 @@ Finally, `twice` returns an `i32` as well.
43574357
43584358
Okay, let's look at the body of `twice`:
43594359
4360-
```{rust}
4360+
```{rust,ignore}
43614361
fn twice(x: i32, f: |i32| -> i32) -> i32 {
43624362
f(x) + f(x)
43634363
}
@@ -4375,7 +4375,7 @@ this technique a lot.
43754375
If we didn't want to give `square` a name, we could just define it inline.
43764376
This example is the same as the previous one:
43774377
4378-
```{rust}
4378+
```{rust,ignore}
43794379
fn twice(x: i32, f: |i32| -> i32) -> i32 {
43804380
f(x) + f(x)
43814381
}
@@ -4388,7 +4388,7 @@ fn main() {
43884388
A named function's name can be used wherever you'd use a closure. Another
43894389
way of writing the previous example:
43904390
4391-
```{rust}
4391+
```{rust,ignore}
43924392
fn twice(x: i32, f: |i32| -> i32) -> i32 {
43934393
f(x) + f(x)
43944394
}

src/doc/reference.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1559,7 +1559,7 @@ Type parameters can be specified for a trait to make it generic. These appear
15591559
after the trait name, using the same syntax used in [generic
15601560
functions](#generic-functions).
15611561

1562-
```
1562+
``` ignore
15631563
trait Seq<T> {
15641564
fn len(&self) -> uint;
15651565
fn elt_at(&self, n: uint) -> T;
@@ -3217,7 +3217,7 @@ expression's captured environment.
32173217
In this example, we define a function `ten_times` that takes a higher-order
32183218
function argument, and call it with a lambda expression as an argument.
32193219

3220-
```
3220+
``` ignore
32213221
fn ten_times(f: |int|) {
32223222
let mut i = 0;
32233223
while i < 10 {
@@ -3821,7 +3821,7 @@ or `extern`), a sequence of input types and an output type.
38213821

38223822
An example of a `fn` type:
38233823

3824-
```
3824+
``` ignore
38253825
fn add(x: int, y: int) -> int {
38263826
return x + y;
38273827
}
@@ -3849,7 +3849,7 @@ The type of a closure mapping an input of type `A` to an output of type `B` is
38493849

38503850
An example of creating and calling a closure:
38513851

3852-
```rust
3852+
``` ignore
38533853
let captured_var = 10i;
38543854
38553855
let closure_no_args = || println!("captured_var={}", captured_var);

0 commit comments

Comments
 (0)