Skip to content

Commit ee342dc

Browse files
authored
Closure inferred twice (rust-lang#1588)
* closure-inferred-twice * fix-typo * fix-typo
1 parent cab2732 commit ee342dc

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/fn/closures.md

+3
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ fn main() {
3434
println!("function: {}", function(i));
3535
println!("closure_annotated: {}", closure_annotated(i));
3636
println!("closure_inferred: {}", closure_inferred(i));
37+
// Once closure's type has been inferred, it cannot be inferred again with another type.
38+
//println!("cannot reuse closure_inferred with another type: {}", closure_inferred(42i64));
39+
// TODO: uncomment the line above and see the compiler error.
3740
3841
// A closure taking no arguments which returns an `i32`.
3942
// The return type is inferred.

0 commit comments

Comments
 (0)