Skip to content

Commit

Permalink
Closure inferred twice (#1588)
Browse files Browse the repository at this point in the history
* closure-inferred-twice

* fix-typo

* fix-typo
  • Loading branch information
AlexCue987 authored Jul 27, 2022
1 parent cab2732 commit ee342dc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/fn/closures.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ 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, 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.
// A closure taking no arguments which returns an `i32`.
// The return type is inferred.
Expand Down

0 comments on commit ee342dc

Please sign in to comment.