mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
aebbe6bb5f
delegation: support self ty propagation for functions in free to trait reuse This PR adds support for self types specified in free to trait reuse. Up to this point we always generated `Self` despite the fact whether self type was specified or not. Now we use it in signature inheritance. Moreover we no more generate `Self` for static methods. Part of rust-lang/rust#118212. ```rust trait Trait<T> { fn foo<const B: bool>(&self) {} fn bar() {} } impl<T> Trait<T> for usize {} reuse <usize as Trait>::foo; // Desugaring (no `Self` as usize is specified) fn foo<T, const B: bool>(self: &usize) { <usize as Trait::<T>>::foo::<B>(self) } reuse Trait::bar; // Desugaring (no `Self` as static method) fn bar<T>() { Trait::<T>::bar(); //~ERROR: type annotations needed } ``` r? @petrochenkov