From 64feba03d76641a8eb290f3f8409d6be04b3fe11 Mon Sep 17 00:00:00 2001 From: Val Vanderschaegen Date: Fri, 13 May 2016 12:01:45 -0700 Subject: [PATCH] Updated based on CR feedback. --- src/doc/book/closures.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/doc/book/closures.md b/src/doc/book/closures.md index 7bfe67f4c8b0..e690f4edd47d 100644 --- a/src/doc/book/closures.md +++ b/src/doc/book/closures.md @@ -334,7 +334,7 @@ fn call_with_ref(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(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.