Skip to content

Commit d243fa1

Browse files
committed
Fix the documentation for move about Fn traits implementations
1 parent d08eb98 commit d243fa1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

library/std/src/keyword_docs.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -943,8 +943,12 @@ mod mod_keyword {}
943943
/// Capture a [closure]'s environment by value.
944944
///
945945
/// `move` converts any variables captured by reference or mutable reference
946-
/// to owned by value variables. The three [`Fn` trait]'s mirror the ways to capture
947-
/// variables, when `move` is used, the closures is represented by the `FnOnce` trait.
946+
/// to owned by value variables.
947+
///
948+
/// Note: `move` closures may still implement [`Fn`] or [`FnMut`], even though
949+
/// they capture variables by `move`. This is because the traits implemented by
950+
/// a closure type are determined by *what* the closure does with captured
951+
/// values, not *how* it captures them.
948952
///
949953
/// ```rust
950954
/// let capture = "hello";

0 commit comments

Comments
 (0)