diff options
| author | Val Vanderschaegen <valere.vanderschaegen@gmail.com> | 2016-05-13 12:01:45 -0700 |
|---|---|---|
| committer | Val Vanderschaegen <valere.vanderschaegen@gmail.com> | 2016-05-13 12:01:45 -0700 |
| commit | 64feba03d76641a8eb290f3f8409d6be04b3fe11 (patch) | |
| tree | 584a434f499093f8296b32ced207f2896e0e76c9 | |
| parent | 7da9ea0af48ccf9468863408b449d33c415cbde7 (diff) | |
| download | rust-64feba03d76641a8eb290f3f8409d6be04b3fe11.tar.gz rust-64feba03d76641a8eb290f3f8409d6be04b3fe11.zip | |
Updated based on CR feedback.
| -rw-r--r-- | src/doc/book/closures.md | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/doc/book/closures.md b/src/doc/book/closures.md index 7bfe67f4c8b..e690f4edd47 100644 --- a/src/doc/book/closures.md +++ b/src/doc/book/closures.md @@ -334,7 +334,7 @@ fn call_with_ref<F>(some_closure:F) -> i32 Normally you can specify the lifetime of the parameter to our closure. We could annotate it on the function declaration: -``` +```ignore fn call_with_ref<'a, F>(some_closure:F) -> i32 where F: Fn(&'a 32) -> i32 { ``` @@ -348,12 +348,12 @@ to compile. In order to say that we only need the lifetime to be valid for the invocation scope of the closure we can use Higher-Ranked Trait Bounds with the `for<...>` syntax: -``` +```ignore fn call_with_ref<F>(some_closure:F) -> i32 where F: for<'a> Fn(&'a 32) -> i32 { ``` -This lets the rust compiler find the minimum lifetime to invoke our closure and +This lets the Rust compiler find the minimum lifetime to invoke our closure and satisfy the borrow checker's rules. Our function then compiles and excutes as we expect. |
