Skip to content

Commit 8df733c

Browse files
committed
Remove section on type inference
As was pointed out by compiler-errors, some of the details in this section are wrong. More broadly, though, specifying these details goes beyond the purpose of this RFC. These can be worked out later.
1 parent 566bbc9 commit 8df733c

File tree

1 file changed

+0
-19
lines changed

1 file changed

+0
-19
lines changed

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

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -51,25 +51,6 @@ Note that this only happens when *both* traits are in scope since this is requir
5151

5252
We will provide an allow-by-default lint to let users opt in to being notified when an ambiguity is resolved in this way.
5353

54-
### Type inference
55-
56-
This change happens during name resolution and specifically doesn't interact with type inference. Consider this example:
57-
58-
```rust
59-
trait Foo { fn method(&self) {} }
60-
trait Bar: Foo { fn method(&self) {} }
61-
impl<T> Foo for Vec<T> { }
62-
impl<T: Copy> Bar for Vec<T> { }
63-
64-
fn main() {
65-
let x = vec![];
66-
x.method(); // which to call?
67-
x.push(Box::new(22)); // oh, looks like `Foo`
68-
}
69-
```
70-
71-
Today that example will give an ambiguity error because `method` is provided by multiple traits in scope. With this RFC, it will instead always resolve to the subtrait method and then compilation will fail because `Vec` does not implement the `Copy` trait required by `Bar::method`.
72-
7354
# Drawbacks
7455
[drawbacks]: #drawbacks
7556

0 commit comments

Comments
 (0)