librustc: Give trait methods accessible via fewer autoderefs priority
over inherent methods accessible via more autoderefs. This simplifies the trait matching algorithm. It breaks code like: impl Foo { fn foo(self) { // before this change, this will be called } } impl<'a,'b,'c> Trait for &'a &'b &'c Foo { fn foo(self) { // after this change, this will be called } } fn main() { let x = &(&(&Foo)); x.foo(); } To explicitly indicate that you wish to call the inherent method, perform explicit dereferences. For example: fn main() { let x = &(&(&Foo)); (***x).foo(); } Part of #17282. [breaking-change]
Showing
想要评论请 注册 或 登录