Skip to content

Commit be79258

Browse files
committed
auto merge of #5651 : luqmana/rust/incoming, r=thestinger
Change fn() -> &fn().
2 parents 686f448 + d617030 commit be79258

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

doc/tutorial.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1539,9 +1539,9 @@ for spawning [tasks][tasks].
15391539

15401540
Rust closures have a convenient subtyping property: you can pass any kind of
15411541
closure (as long as the arguments and return types match) to functions
1542-
that expect a `fn()`. Thus, when writing a higher-order function that
1542+
that expect a `&fn()`. Thus, when writing a higher-order function that
15431543
only calls its function argument, and does nothing else with it, you
1544-
should almost always declare the type of that argument as `fn()`. That way,
1544+
should almost always declare the type of that argument as `&fn()`. That way,
15451545
callers may pass any kind of closure.
15461546

15471547
~~~~

0 commit comments

Comments
 (0)