Skip to content

Type parameters have slightly different method resolution #168

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 9, 2017
Merged
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
5 changes: 4 additions & 1 deletion src/expressions/method-call-expr.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ let log_pi = pi.unwrap_or(1.0).log(2.72);

When resolving method calls on an expression of type `A`, Rust will use the
following order, only looking at methods that are
[visible](visibility-and-privacy.html) and traits that are in scope:
[visible](visibility-and-privacy.html). If the type of `A` is a type parameter
or `Self` in a trait definitition then steps 2-4 first consider traits from
bounds on the type paramter, then the traits that are in scope. For other
types, only the traits that are in scope are considered.

1. Inherent methods, with receiver of type `A`, `&A`, `&mut A`.
1. Trait methods with receiver of type `A`.
Expand Down