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
All function calls are sugar for a more explicit [fully-qualified syntax].
28
-
Upon compilation, Rust will desugar all function calls into the explicit form.
29
-
Rust may sometimes require you to qualify function calls with trait, depending on the ambiguity of a call in light of in-scope items.
28
+
Function calls may need to be fully qualified, depending on the ambiguity of a call in light of in-scope items.
30
29
31
30
> **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.
32
31
> However, these terms lack descriptive power and potentially confuse the issue at hand.
Copy file name to clipboardExpand all lines: src/expressions/field-expr.md
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
> _FieldExpression_ :\
5
5
> [_Expression_]`.`[IDENTIFIER]
6
6
7
-
A *field expression* is a [place expression] that evaluates to the location of a field of a type.
7
+
A *field expression* is a [place expression] that evaluates to the location of a field of a [struct] or [union].
8
8
When the operand is [mutable], the field expression is also mutable.
9
9
10
10
The syntax for a field expression is an operand, then a `.`, and finally an [identifier].
@@ -38,12 +38,12 @@ foo().x;
38
38
39
39
## Automatic dereferencing
40
40
41
-
Also, if the type of the operand implements [`Deref`] or [`DerefMut`][`Deref`] depending on whether the operand is [mutable], it is *automatically dereferenced* as many times as necessary to make the field access possible.
41
+
If the type of the operand implements [`Deref`] or [`DerefMut`][`Deref`] depending on whether the operand is [mutable], it is *automatically dereferenced* as many times as necessary to make the field access possible.
42
42
This processes is also called *autoderef* for short.
43
43
44
44
## Borrowing
45
45
46
-
Finally, the fields of a struct or a reference to a struct are treated as separate entities when borrowing.
46
+
The fields of a struct or a reference to a struct are treated as separate entities when borrowing.
47
47
If the struct does not implement [`Drop`] and is stored in a local variable, this also applies to moving out of each of its fields.
48
48
This also does not apply if automatic dereferencing is done though user-defined types other than [`Box`].
49
49
@@ -62,8 +62,8 @@ let d: String = x.f3; // Move out of x.f3
0 commit comments