Repository: rust
Issue: Tracking Issue for function delegation (`fn_delegation`, RFC 3530)
Labels: T-lang,C-tracking-issue,S-tracking-impl-incomplete,F-fn_delegation,B-experimental

This is a tracking issue for the RFC "Implement function delegation in rustc" (https://github.com/rust-lang/rfcs/pull/3530).
The feature gate for the issue is `#![feature(fn_delegation)]`.

The feature was accepted for experimentation in https://github.com/rust-lang/rust/pull/117978#issuecomment-1823066970.

### About tracking issues

Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however *not* meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.

### Steps

- [ ] Implement the RFC (roughly in the order of priority)
  - [x] https://github.com/rust-lang/rust/pull/118947 Parse syntax and implement basic desugaring
  - [x] https://github.com/rust-lang/rust/pull/122500 Support renaming
  - [x] https://github.com/rust-lang/rust/pull/122500 Support modifiers like `const`, `extern`, `async`
  - [x] https://github.com/rust-lang/rust/pull/123413 Support list delegation ([design](https://github.com/rust-lang/rfcs/pull/3530#issuecomment-2020869823))
  - [x] https://github.com/rust-lang/rust/pull/124135 Support glob delegation and overriding it with explicit definitions ([design](https://github.com/rust-lang/rfcs/pull/3530#issuecomment-2020869823))
  - [x] https://github.com/rust-lang/rust/pull/126699 Support autoref/deref and coercions for the first argument ([design](https://github.com/rust-lang/rust/issues/118212#issuecomment-2160723092))
  - [x] Support inheriting generic parameters ([design](https://github.com/Bryanskiy/posts/blob/master/delegation%20in%20generic%20contexts.md))
    - [x] https://github.com/rust-lang/rust/pull/125929
    - [x] https://github.com/rust-lang/rust/pull/126161
  - [ ] Support providing generic arguments ([design](https://github.com/Bryanskiy/posts/blob/master/delegation%20in%20generic%20contexts.md))
    - [ ] https://github.com/rust-lang/rust/pull/123958
  - [ ] Add implicit `#[inline]` unless specified otherwise
    - [ ] Consider whether some selected attributes need to be inherited
  - [ ] `Self` type mapping ([in RFC](https://github.com/rust-lang/rfcs/blob/923b8e65639de80a93ef2b9770ba1c976c24cf5d/text/0000-fn-delegation.md#self-mapping))
  - [ ] Conversions for arguments and return value in the generated body ([in RFC 1](https://github.com/rust-lang/rfcs/blob/923b8e65639de80a93ef2b9770ba1c976c24cf5d/text/0000-fn-delegation.md#newtype-support), [in RFC 2](https://github.com/rust-lang/rfcs/blob/923b8e65639de80a93ef2b9770ba1c976c24cf5d/text/0000-fn-delegation.md#newtype-support-1))
  - [ ] Delegation for associated constants and types
    - [ ] Support `impl Trait` in traits
  - [ ] One line sugar for glob-delegating a whole trait impl
  - [ ] Support recursive delegation (delegation items referring to other local delegation items)
  - [ ] Support type-relative paths ([old prototype](https://github.com/bryanskiy/rust/tree/delegImpl))
  - [ ] Infer delegation target from the target expr instead of using an explicit path ([in RFC](https://github.com/rust-lang/rfcs/blob/923b8e65639de80a93ef2b9770ba1c976c24cf5d/text/0000-fn-delegation.md#callee-is-inferred-from-target_expr_template))
- [ ] Adjust documentation ([see instructions on rustc-dev-guide][doc-guide])
- [ ] Formatting for new syntax has been added to the [Style Guide] ([nightly-style-procedure])
- [ ] Stabilization PR ([see instructions on rustc-dev-guide][stabilization-guide])

[stabilization-guide]: https://rustc-dev-guide.rust-lang.org/stabilization_guide.html#stabilization-pr
[doc-guide]: https://rustc-dev-guide.rust-lang.org/stabilization_guide.html#documentation-prs
[nightly-style-procedure]: https://github.com/rust-lang/style-team/blob/master/nightly-style-procedure.md 
[Style Guide]: https://github.com/rust-lang/rust/tree/master/src/doc/style-guide

### Unresolved Questions
<!--
Include any open questions that need to be answered before the feature can be
stabilised.
-->

Many of them in the RFC draft.

### Implementation history

https://github.com/rust-lang/rust/pulls?q=is%3Apr+label%3AF-fn_delegation