Skip to content

Commit 779b2ce

Browse files
committed
Say what traits that function items impl by default.
Also more links in call-expr.md.
1 parent 818cbdc commit 779b2ce

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
@@ -338,6 +338,9 @@ let foo_ptr_2 = if want_i32 {
338338
};
339339
```
340340

341+
All function items implement [Fn], [FnMut], [FnOnce], [Copy], [Clone], [Send],
342+
and [Sync].
343+
341344
## Function pointer types
342345

343346
Function pointer types, written using the `fn` keyword, refer to a function
@@ -575,6 +578,13 @@ impl Printable for String {
575578

576579
The notation `&self` is a shorthand for `self: &Self`.
577580

581+
[Fn]: ../std/ops/trait.Fn.html
582+
[FnMut]: ../std/ops/trait.FnMut.html
583+
[FnOnce]: ../std/ops/trait.FnOnce.html
584+
[Copy]: special-types-and-traits.html#copy
585+
[Clone]: special-types-and-traits.html#clone
586+
[Send]: special-types-and-traits.html#send
587+
[Sync]: special-types-and-traits.html#sync
578588
[dynamically sized types]: dynamically-sized-types.html
579589
[RFC 599]: https://github.com/rust-lang/rfcs/blob/master/text/0599-default-object-bound.md
580590
[RFC 1156]: https://github.com/rust-lang/rfcs/blob/master/text/1156-adjust-default-object-bounds.md

0 commit comments

Comments
 (0)