Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Travis Cross <[email protected]>
  • Loading branch information
chorman0773 and traviscross authored Dec 11, 2024
1 parent f44a829 commit da42d7c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/expressions.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ Explicitly, the assignee expressions are:
fields).
- [Unit structs][_StructExpression_].

r[expr.place-value.parentehesis]
r[expr.place-value.parenthesis]
Arbitrary parenthesisation is permitted inside assignee expressions.

### Moved and copied types
Expand Down
2 changes: 1 addition & 1 deletion src/expressions/grouped-expr.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ r[expr.paren.place-or-value]
Unlike other expressions, parenthesized expressions are both [place expressions and value expressions][place].
When the enclosed operand is a place expression, it is a place expression and when the enclosed operand is a value expression, it is a value expression.

r[expr.paren.overridew-precedence]
r[expr.paren.override-precedence]
Parentheses can be used to explicitly modify the precedence order of subexpressions within an expression.

An example of a parenthesized expression:
Expand Down
8 changes: 4 additions & 4 deletions src/expressions/method-call-expr.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ When looking up a method call, the receiver may be automatically dereferenced or
This requires a more complex lookup process than for other functions, since there may be a number of possible methods to call.
The following procedure is used:

r[expr.method.candidate-recievers]
r[expr.method.candidate-receivers]
The first step is to build a list of candidate receiver types.
Obtain these by repeatedly [dereferencing][dereference] the receiver expression's type, adding each type encountered to the list, then finally attempting an [unsized coercion] at the end, and adding the result type if that is successful.

r[expr.method.candidate-recievers-refs]
r[expr.method.candidate-receivers-refs]
Then, for each candidate `T`, add `&T` and `&mut T` to the list immediately after `T`.

For instance, if the receiver has type `Box<[i32;2]>`, then the candidate types will be `Box<[i32;2]>`, `&Box<[i32;2]>`, `&mut Box<[i32;2]>`, `[i32; 2]` (by dereferencing), `&[i32; 2]`, `&mut [i32; 2]`, `[i32]` (by unsized coercion), `&[i32]`, and finally `&mut [i32]`.
Expand Down Expand Up @@ -69,14 +69,14 @@ Then, for each candidate type `T`, search for a [visible] method with a receiver
> }
> ```
r[expr.method.ambiguious-target]
r[expr.method.ambiguous-target]
If this results in multiple possible candidates, then it is an error, and the receiver must be [converted][disambiguate call] to an appropriate receiver type to make the method call.
r[expr.method.constraint]
This process does not take into account the mutability or lifetime of the receiver, or whether a method is `unsafe`.
Once a method is looked up, if it can't be called for one (or more) of those reasons, the result is a compiler error.
r[expr.method.ambiguious-search]
r[expr.method.ambiguous-search]
If a step is reached where there is more than one possible method, such as where generic methods or traits are considered the same, then it is a compiler error.
These cases require a [disambiguating function call syntax] for method and function invocation.
Expand Down

0 comments on commit da42d7c

Please sign in to comment.