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
From a code-writer point of view, it'd be nice for t to auto-deref to (*t).bar() to appease the compiler, but I can see that the compiler may not know a whole lot about this.
If we don't get auto-deref here, perhaps a better error message may work. It's a little confusing to see that ~Foo doesn't implement Baz when Foo clearly implements Baz
@cmr we have to see how @nikomatsakis intends to improve method lookup.
Though I have to point out that the X doesn't implement Y error comes from vtable checking which comes after type-checking finishes, and I'm pretty sure it has access to concrete types (without type inference variables at least. region inference isn't resolved until after regionck).
That said, if the type information is available at the time of the method lookup, the vtable error can be prevented by searching for another suitable candidate (but this would also complicate simpler cases).
This actually has nothing to do with auto-deref, but it is addressed by the method lookup algorithm that I'm working on. That is ALMOST ready for publication, just working on the last bits.
Activity
emberian commentedon Apr 7, 2014
cc @eddyb
this would be pretty convenient.
eddyb commentedon Apr 7, 2014
@cmr we have to see how @nikomatsakis intends to improve method lookup.
Though I have to point out that the
X doesn't implement Yerror comes from vtable checking which comes after type-checking finishes, and I'm pretty sure it has access to concrete types (without type inference variables at least. region inference isn't resolved until after regionck).That said, if the type information is available at the time of the method lookup, the vtable error can be prevented by searching for another suitable candidate (but this would also complicate simpler cases).
nikomatsakis commentedon Apr 9, 2014
This actually has nothing to do with auto-deref, but it is addressed by the method lookup algorithm that I'm working on. That is ALMOST ready for publication, just working on the last bits.
japaric commentedon Nov 7, 2014
@alexcrichton updated example is working with a recent version:
I think
Box<T>now derefs to&TalthoughBox<T>doesn't implementDeref<T>(#18624)alexcrichton commentedon Nov 7, 2014
Looks to be so, thanks @japaric! Flagging as needstest.
rollup merge of rust-lang#19780: jakub-/e-needstest
rollup merge of rust-lang#19780: jakub-/e-needstest
Auto merge of rust-lang#10456 - samueltardieu:issue-10450, r=Manishearth
Merge rust-lang#10456