You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: text/0000-supertrait-item-shadowing-v2.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,11 +30,11 @@ use itertools::Itertools as _;
30
30
31
31
fnfoo() ->implIterator<Item=&'staticstr> {
32
32
"1,2,3".split(",").intersperse("|")
33
-
// ^ This is ambiguious: it could refer to Iterator::intersperse or Itertools::intersperse
33
+
// ^ This is ambiguous: it could refer to Iterator::intersperse or Itertools::intersperse
34
34
}
35
35
```
36
36
37
-
This code actually works today because `intersperse` is an unstable API, which works because the compiler already has [logic](https://github.com/rust-lang/rust/pull/48552) to prefer stable methods over unstable methods when an amiguity occurs.
37
+
This code actually works today because `intersperse` is an unstable API, which works because the compiler already has [logic](https://github.com/rust-lang/rust/pull/48552) to prefer stable methods over unstable methods when an ambiguity occurs.
38
38
39
39
Attempts to stabilize `intersperse` have failed with a large number of regressions [reported by crater](https://github.com/rust-lang/rust/issues/88967) which affect many popular crates. Even if these were to be manually corrected (since ambiguity is considered allowed breakage) we would have to go through this whole process again every time a method from `itertools` is uplifted to the standard library.
40
40
@@ -73,7 +73,7 @@ Today that example will give an ambiguity error because `method` is provided by
73
73
# Drawbacks
74
74
[drawbacks]: #drawbacks
75
75
76
-
This behavior can be surprising: adding a method to a sub-trait can change which function is called in unrelated code. This is mitigated by the which warns users about the potential ambiguity.
76
+
This behavior can be surprising: adding a method to a sub-trait can change which function is called in unrelated code. This is mitigated by the lint which warns users about the potential ambiguity.
@@ -138,7 +138,7 @@ Resolving in favor of `a` is a breaking change; in favor of `b` is not. The only
138
138
### RFC 2845
139
139
140
140
RFC 2845 was a previous attempt to address this problem, but it has several drawbacks:
141
-
- 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 amiguity from stabilizing `intersperse` comes from non-generic code.
141
+
- 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.
142
142
- It adds a lot of complexity because name resolution depends on the specific trait bounds that have been brought into scope.
0 commit comments