You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The syntax of a call expression is an expression, called the *function operand*, followed by a parenthesized comma-separated list of expression, called the *argument operands*.
16
+
17
+
r[expr.call.convergence]
12
18
If the function eventually returns, then the expression completes.
13
19
20
+
r[expr.call.trait]
14
21
For [non-function types], the expression `f(...)` uses the method on one of the following traits based on the function operand:
15
22
16
23
-[`Fn`] or [`AsyncFn`] --- shared reference.
17
24
-[`FnMut`] or [`AsyncFnMut`] --- mutable reference.
18
25
-[`FnOnce`] or [`AsyncFnOnce`] --- value.
19
26
27
+
r[expr.call.autoref-deref]
20
28
An automatic borrow will be taken if needed.
21
29
The function operand will also be [automatically dereferenced] as required.
All function calls are sugar for a more explicit [fully-qualified syntax].
45
+
46
+
r[expr.call.desugar.ambiguity]
34
47
Function calls may need to be fully qualified, depending on the ambiguity of a call in light of in-scope items.
35
48
36
49
> **Note**: In the past, the terms "Unambiguous Function Call Syntax", "Universal Function Call Syntax", or "UFCS", have been used in documentation, issues, RFCs, and other community writings.
37
50
> However, these terms lack descriptive power and potentially confuse the issue at hand.
38
51
> We mention them here for searchability's sake.
39
52
53
+
r[expr.call.desugar.limits]
40
54
Several situations often occur which result in ambiguities about the receiver or referent of method or associated function calls.
41
55
These situations may include:
42
56
43
57
* Multiple in-scope traits define methods with the same name for the same types
44
58
* Auto-`deref` is undesirable; for example, distinguishing between methods on a smart pointer itself and the pointer's referent
45
59
* Methods which take no arguments, like [`default()`], and return properties of a type, like [`size_of()`]
46
60
61
+
r[expr.call.desugar.explicit-path]
47
62
To resolve the ambiguity, the programmer may refer to their desired method or function using more specific paths, types, or traits.
0 commit comments