]> git.lizzy.rs Git - rust.git/commitdiff
ignore boxed closure doctests in the guide/reference
authorJorge Aparicio <japaricious@gmail.com>
Mon, 5 Jan 2015 13:25:55 +0000 (08:25 -0500)
committerJorge Aparicio <japaricious@gmail.com>
Mon, 5 Jan 2015 22:22:17 +0000 (17:22 -0500)
src/doc/guide-testing.md
src/doc/guide.md
src/doc/reference.md

index 682c89fcc53fcc73bd3646247c970a8f41d2c0eb..dea861ad94604b048ade1680cbaeff241c43ae66 100644 (file)
@@ -536,7 +536,7 @@ optimizer to consider the result used and ensures it cannot remove the
 computation entirely. This could be done for the example above by adjusting the
 `b.iter` call to
 
 computation entirely. This could be done for the example above by adjusting the
 `b.iter` call to
 
-```rust
+```{rust,ignore}
 # struct X; impl X { fn iter<T>(&self, _: || -> T) {} } let b = X;
 b.iter(|| {
     // note lack of `;` (could also use an explicit `return`).
 # struct X; impl X { fn iter<T>(&self, _: || -> T) {} } let b = X;
 b.iter(|| {
     // 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
 is an opaque "black box" to the optimizer and so forces it to consider any
 argument as used.
 
 is an opaque "black box" to the optimizer and so forces it to consider any
 argument as used.
 
-```rust
+```{rust,ignore}
 extern crate test;
 
 # fn main() {
 extern crate test;
 
 # fn main() {
index 2376a9cd2101c1a74c8147fc7b07e92a11588726..9bd17ec33325822af5211cd13d1cb658aa2ebe72 100644 (file)
@@ -4231,7 +4231,7 @@ arguments, really powerful things are possible.
 
 Let's make a closure:
 
 
 Let's make a closure:
 
-```{rust}
+```{rust,ignore}
 let add_one = |x| { 1 + x };
 
 println!("The sum of 5 plus 1 is {}.", add_one(5));
 let add_one = |x| { 1 + x };
 
 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.
 
 Let's compare syntax. The two are pretty close:
 
 
 Let's compare syntax. The two are pretty close:
 
-```{rust}
+```{rust,ignore}
 let add_one = |x: i32| -> i32 { 1 + x };
 fn  add_one   (x: i32) -> i32 { 1 + x }
 ```
 let add_one = |x: i32| -> i32 { 1 + x };
 fn  add_one   (x: i32) -> i32 { 1 + x }
 ```
@@ -4256,7 +4256,7 @@ There's one big difference between a closure and named functions, and it's in
 the name: a closure "closes over its environment." What does that mean? It means
 this:
 
 the name: a closure "closes over its environment." What does that mean? It means
 this:
 
-```{rust}
+```{rust,ignore}
 fn main() {
     let x = 5;
 
 fn main() {
     let x = 5;
 
@@ -4297,7 +4297,7 @@ now. We'll talk about them more in the "Threads" section of the guide.
 
 Closures are most useful as an argument to another function. Here's an example:
 
 
 Closures are most useful as an argument to another function. Here's an example:
 
-```{rust}
+```{rust,ignore}
 fn twice(x: i32, f: |i32| -> i32) -> i32 {
     f(x) + f(x)
 }
 fn twice(x: i32, f: |i32| -> i32) -> i32 {
     f(x) + f(x)
 }
@@ -4311,14 +4311,14 @@ fn main() {
 
 Let's break the example down, starting with `main`:
 
 
 Let's break the example down, starting with `main`:
 
-```{rust}
+```{rust,ignore}
 let square = |x: i32| { x * x };
 ```
 
 We've seen this before. We make a closure that takes an integer, and returns
 its square.
 
 let square = |x: i32| { x * x };
 ```
 
 We've seen this before. We make a closure that takes an integer, and returns
 its square.
 
-```{rust}
+```{rust,ignore}
 # fn twice(x: i32, f: |i32| -> i32) -> i32 { f(x) + f(x) }
 # let square = |x: i32| { x * x };
 twice(5, square); // evaluates to 50
 # fn twice(x: i32, f: |i32| -> i32) -> i32 { f(x) + f(x) }
 # let square = |x: i32| { x * x };
 twice(5, square); // evaluates to 50
@@ -4342,7 +4342,7 @@ though, and that function takes an `i32` and returns an `i32`. Notice
 how the `|i32| -> i32` syntax looks a lot like our definition of `square`
 above, if we added the return type in:
 
 how the `|i32| -> i32` syntax looks a lot like our definition of `square`
 above, if we added the return type in:
 
-```{rust}
+```{rust,ignore}
 let square = |x: i32| -> i32 { x * x };
 //           |i32|    -> i32
 ```
 let square = |x: i32| -> i32 { x * x };
 //           |i32|    -> i32
 ```
@@ -4357,7 +4357,7 @@ Finally, `twice` returns an `i32` as well.
 
 Okay, let's look at the body of `twice`:
 
 
 Okay, let's look at the body of `twice`:
 
-```{rust}
+```{rust,ignore}
 fn twice(x: i32, f: |i32| -> i32) -> i32 {
   f(x) + f(x)
 }
 fn twice(x: i32, f: |i32| -> i32) -> i32 {
   f(x) + f(x)
 }
@@ -4375,7 +4375,7 @@ this technique a lot.
 If we didn't want to give `square` a name, we could just define it inline.
 This example is the same as the previous one:
 
 If we didn't want to give `square` a name, we could just define it inline.
 This example is the same as the previous one:
 
-```{rust}
+```{rust,ignore}
 fn twice(x: i32, f: |i32| -> i32) -> i32 {
     f(x) + f(x)
 }
 fn twice(x: i32, f: |i32| -> i32) -> i32 {
     f(x) + f(x)
 }
@@ -4388,7 +4388,7 @@ fn main() {
 A named function's name can be used wherever you'd use a closure. Another
 way of writing the previous example:
 
 A named function's name can be used wherever you'd use a closure. Another
 way of writing the previous example:
 
-```{rust}
+```{rust,ignore}
 fn twice(x: i32, f: |i32| -> i32) -> i32 {
     f(x) + f(x)
 }
 fn twice(x: i32, f: |i32| -> i32) -> i32 {
     f(x) + f(x)
 }
index d7930285260523858d4164b846cf9a82f39a78cc..512081ac48f4da75d2b10a82d0a50566b6d1ea12 100644 (file)
@@ -1559,7 +1559,7 @@ Type parameters can be specified for a trait to make it generic. These appear
 after the trait name, using the same syntax used in [generic
 functions](#generic-functions).
 
 after the trait name, using the same syntax used in [generic
 functions](#generic-functions).
 
-```
+``` ignore
 trait Seq<T> {
    fn len(&self) -> uint;
    fn elt_at(&self, n: uint) -> T;
 trait Seq<T> {
    fn len(&self) -> uint;
    fn elt_at(&self, n: uint) -> T;
@@ -3217,7 +3217,7 @@ expression's captured environment.
 In this example, we define a function `ten_times` that takes a higher-order
 function argument, and call it with a lambda expression as an argument.
 
 In this example, we define a function `ten_times` that takes a higher-order
 function argument, and call it with a lambda expression as an argument.
 
-```
+``` ignore
 fn ten_times(f: |int|) {
     let mut i = 0;
     while i < 10 {
 fn ten_times(f: |int|) {
     let mut i = 0;
     while i < 10 {
@@ -3821,7 +3821,7 @@ or `extern`), a sequence of input types and an output type.
 
 An example of a `fn` type:
 
 
 An example of a `fn` type:
 
-```
+``` ignore
 fn add(x: int, y: int) -> int {
   return x + y;
 }
 fn add(x: int, y: int) -> int {
   return x + y;
 }
@@ -3849,7 +3849,7 @@ The type of a closure mapping an input of type `A` to an output of type `B` is
 
 An example of creating and calling a closure:
 
 
 An example of creating and calling a closure:
 
-```rust
+``` ignore
 let captured_var = 10i;
 
 let closure_no_args = || println!("captured_var={}", captured_var);
 let captured_var = 10i;
 
 let closure_no_args = || println!("captured_var={}", captured_var);