From 153995c08e79586bf5841f6f5679234e5c9e19ed Mon Sep 17 00:00:00 2001 From: Alex Kuznetsov Date: Mon, 4 Jul 2022 18:54:41 -0500 Subject: [PATCH 1/3] closure-inferred-twice --- src/fn/closures.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/fn/closures.md b/src/fn/closures.md index a0a33efba1..2ac4d27354 100644 --- a/src/fn/closures.md +++ b/src/fn/closures.md @@ -34,6 +34,9 @@ fn main() { println!("function: {}", function(i)); println!("closure_annotated: {}", closure_annotated(i)); println!("closure_inferred: {}", closure_inferred(i)); + // Once inferred, cannot infer another type. + // Uncomment the line below to get a compiler error. + //println!("closure_inferred, but another type: {}", closure_inferred(42i64)); // A closure taking no arguments which returns an `i32`. // The return type is inferred. From 927878ef2fcfd3473c21093d76174a26acc7d61c Mon Sep 17 00:00:00 2001 From: Alex Kuznetsov Date: Wed, 27 Jul 2022 08:53:01 -0500 Subject: [PATCH 2/3] fix-typo --- src/fn/closures.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/fn/closures.md b/src/fn/closures.md index 2ac4d27354..9d578746e4 100644 --- a/src/fn/closures.md +++ b/src/fn/closures.md @@ -34,9 +34,9 @@ fn main() { println!("function: {}", function(i)); println!("closure_annotated: {}", closure_annotated(i)); println!("closure_inferred: {}", closure_inferred(i)); - // Once inferred, cannot infer another type. - // Uncomment the line below to get a compiler error. - //println!("closure_inferred, but another type: {}", closure_inferred(42i64)); + // Once closure's type has been inferred, another type cannot be infered. + //println!("cannot reuse closure_inferred with another type: {}", closure_inferred(42i64)); + // TODO: uncomment the line above and see the compiler error. // A closure taking no arguments which returns an `i32`. // The return type is inferred. From 63e5f6e64012b1fcc24affa6bfd8fa7637b0784f Mon Sep 17 00:00:00 2001 From: Alex Kuznetsov Date: Wed, 27 Jul 2022 08:55:18 -0500 Subject: [PATCH 3/3] fix-typo --- src/fn/closures.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fn/closures.md b/src/fn/closures.md index 9d578746e4..0c1b999efd 100644 --- a/src/fn/closures.md +++ b/src/fn/closures.md @@ -34,7 +34,7 @@ fn main() { println!("function: {}", function(i)); println!("closure_annotated: {}", closure_annotated(i)); println!("closure_inferred: {}", closure_inferred(i)); - // Once closure's type has been inferred, another type cannot be infered. + // Once closure's type has been inferred, it cannot be inferred again with another type. //println!("cannot reuse closure_inferred with another type: {}", closure_inferred(42i64)); // TODO: uncomment the line above and see the compiler error.