Skip to content

Commit dc3e2fd

Browse files
committed
Replace "name resolution" with "method selection"
What this RFC had referred to as "name resolution" is actually method selection, as pointed out by compiler-errors, so let's fix this everywhere. In doing this, we remove one of the purported drawbacks of RFC 2845, as it makes less sense as stated after this fix.
1 parent 8df733c commit dc3e2fd

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

text/3624-supertrait-item-shadowing-v2.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# Summary
77
[summary]: #summary
88

9-
When name resolution encounters an ambiguity between two trait methods when both traits are in scope, if one trait is a subtrait of the other then select that method instead of reporting an ambiguity error.
9+
When method selection encounters an ambiguity between two trait methods when both traits are in scope, if one trait is a subtrait of the other then select that method instead of reporting an ambiguity error.
1010

1111
# Motivation
1212
[motivation]: #motivation
@@ -40,7 +40,7 @@ Attempts to stabilize `intersperse` have failed with a large number of regressio
4040
# Proposed solution
4141
[proposed-solution]: #proposed-solution
4242

43-
This RFC proposes to change name resolution to resolve the ambiguity in the following specific circumstances:
43+
This RFC proposes to change method selection to resolve the ambiguity in the following specific circumstances:
4444

4545
- All method candidates are trait methods (inherent methods are already prioritized over trait methods).
4646
- One trait is transitively a subtrait of all other traits in the candidate list.
@@ -63,9 +63,9 @@ If we choose not to accept this RFC then there doesn't seem to be a reasonable p
6363

6464
## Only doing this for specific traits
6565

66-
One possible alternative to a general change to the name resolution rules would be to only do so on a case-by-case basis for specific methods in standard library traits. This could be done by using a perma-unstable `#[shadowable]` attribute specifically on methods like `Iterator::intersperse`.
66+
One possible alternative to a general change to the method selection rules would be to only do so on a case-by-case basis for specific methods in standard library traits. This could be done by using a perma-unstable `#[shadowable]` attribute specifically on methods like `Iterator::intersperse`.
6767

68-
There are both advantages and inconveniences to this approach. While it allows most Rust users to avoid having to think about this issue for most traits, it does make the `Iterator` trait more "magical" in that it doesn't follow the same rules as the rest of the language. Having a consistent rule for how name resolution works is easier to teach people.
68+
There are both advantages and inconveniences to this approach. While it allows most Rust users to avoid having to think about this issue for most traits, it does make the `Iterator` trait more "magical" in that it doesn't follow the same rules as the rest of the language. Having a consistent rule for how method selection works is easier to teach people.
6969

7070
## Preferring the supertrait method instead
7171

@@ -118,10 +118,7 @@ Resolving in favor of `a` is a breaking change; resolving in favor of `b` is not
118118

119119
### RFC 2845
120120

121-
RFC 2845 was a previous attempt to address this problem, but it has several drawbacks:
122-
123-
- It doesn't fully address the problem since it only changes name resolution when trait methods are resolved due to generic bounds. In practice, most of the ambiguity from stabilizing `intersperse` comes from non-generic code.
124-
- It adds a lot of complexity because name resolution depends on the specific trait bounds that have been brought into scope.
121+
RFC 2845 was a previous attempt, but it did not fully address the problem since it only changes method selection when trait methods are resolved due to generic bounds. In practice, most of the ambiguity from stabilizing `intersperse` comes from non-generic code.
125122

126123
# Unresolved questions
127124
[unresolved-questions]: #unresolved-questions

0 commit comments

Comments
 (0)