Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/expressions/method-call-expr.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ Then, for each candidate type `T`, search for a [visible] method with a receiver
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.supertrait-shadowing]
As an exception to the above, if all candidates consist of trait methods and one candidate is a subtrait of all other candidates then that candidate is selected instead of causing an ambiguity error.

r[expr.method.receiver-constraints]
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.

Expand Down
2 changes: 2 additions & 0 deletions src/names/name-resolution.md
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,8 @@ r[names.resolution.type-relative]
> [!NOTE]
> This is a placeholder for future expansion about type-dependent resolution.

- Type-relative name resolution of qualified path expressions shares the shadowing behavior documented in r[expr.method.supertrait-shadowing] on method resolution.

[AST]: glossary.ast
[Builtin attributes]: ./preludes.md#r-names.preludes.lang
[Derive helpers]: ../procedural-macros.md#r-macro.proc.derive.attributes
Expand Down