Skip to content

Commit 9adc9b5

Browse files
authored
Merge pull request rust-lang#175 from Havvy/fix-72
Say what traits that function items impl by default.
2 parents 422cbb0 + e367a33 commit 9adc9b5

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

src/expressions/call-expr.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
A _call expression_ consists of an expression followed by a parenthesized
1111
expression-list. It invokes a function, providing zero or more input variables.
1212
If the function eventually returns, then the expression completes. For
13-
[non-function types](types.html#function-item-types), the expression f(...) uses the
14-
method on one of the `std::ops::Fn`, `std::ops::FnMut` or `std::ops::FnOnce`
15-
traits, which differ in whether they take the type by reference, mutable
16-
reference, or take ownership respectively. An automatic borrow will be taken if
17-
needed. Rust will also automatically dereference `f` as required. Some examples
18-
of call expressions:
13+
[non-function types](types.html#function-item-types), the expression f(...) uses
14+
the method on one of the [`std::ops::Fn`], [`std::ops::FnMut`] or
15+
[`std::ops::FnOnce`] traits, which differ in whether they take the type by
16+
reference, mutable reference, or take ownership respectively. An automatic
17+
borrow will be taken if needed. Rust will also automatically dereference `f` as
18+
required. Some examples of call expressions:
1919

2020
```rust
2121
# fn add(x: i32, y: i32) -> i32 { 0 }
@@ -93,6 +93,9 @@ fn main() {
9393

9494
Refer to [RFC 132] for further details and motivations.
9595

96+
[`std::ops::Fn`]: ../std/ops/trait.Fn.html
97+
[`std::ops::FnMut`]: ../std/ops/trait.FnMut.html
98+
[`std::ops::FnOnce`]: ../std/ops/trait.FnOnce.html
9699
[RFC 132]: https://github.com/rust-lang/rfcs/blob/master/text/0132-ufcs.md
97100

98101
[_Expression_]: expressions.html

src/types.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,9 @@ let foo_ptr_2 = if want_i32 {
334334
};
335335
```
336336

337+
All function items implement [Fn], [FnMut], [FnOnce], [Copy], [Clone], [Send],
338+
and [Sync].
339+
337340
## Function pointer types
338341

339342
Function pointer types, written using the `fn` keyword, refer to a function
@@ -583,6 +586,13 @@ impl Printable for String {
583586

584587
The notation `&self` is a shorthand for `self: &Self`.
585588

589+
[Fn]: ../std/ops/trait.Fn.html
590+
[FnMut]: ../std/ops/trait.FnMut.html
591+
[FnOnce]: ../std/ops/trait.FnOnce.html
592+
[Copy]: special-types-and-traits.html#copy
593+
[Clone]: special-types-and-traits.html#clone
594+
[Send]: special-types-and-traits.html#send
595+
[Sync]: special-types-and-traits.html#sync
586596
[`Vec<T>`]: ../std/vec/struct.Vec.html
587597
[dynamically sized type]: dynamically-sized-types.html
588598
[dynamically sized types]: dynamically-sized-types.html

0 commit comments

Comments
 (0)