Skip to content

Commit d25e350

Browse files
authored
Merge pull request #168 from matthewjasper/traits-for-methods
Type parameters have slightly different method resolution
2 parents d812ea2 + 293ea41 commit d25e350

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/expressions/method-call-expr.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ let log_pi = pi.unwrap_or(1.0).log(2.72);
1616

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

2124
1. Inherent methods, with receiver of type `A`, `&A`, `&mut A`.
2225
1. Trait methods with receiver of type `A`.

0 commit comments

Comments
 (0)