Implement function delegation in rustc by petrochenkov · Pull Request #3530 · rust-lang/rfcs

@petrochenkov

added a commit to petrochenkov/rust that referenced this pull request

Nov 16, 2023

@petrochenkov

@petrochenkov

Add a possible use of `#[refine]`
Fix a dead link

@joshtriplett joshtriplett changed the title eRFC: Implement function delegation in rustc Implement function delegation in rustc

Nov 22, 2023

@traviscross traviscross added the T-lang

Relevant to the language team, which will review and decide on the RFC.

label

Nov 22, 2023

petrochenkov added a commit to petrochenkov/rust that referenced this pull request

Nov 23, 2023

@petrochenkov

bors added a commit to rust-lang-ci/rust that referenced this pull request

Nov 23, 2023

@bors

@petrochenkov

RalfJung

bors added a commit to rust-lang-ci/rust that referenced this pull request

May 15, 2024
delegation: Implement list delegation

```rust
reuse prefix::{a, b, c};
```

Using design described in rust-lang/rfcs#3530 (comment) (the lists are desugared at macro expansion time).
List delegations are expanded eagerly when encountered, similarly to `#[cfg]`s, and not enqueued for later resolution/expansion like regular macros or glob delegation (rust-lang#124135).

Part of rust-lang#118212.

jieyouxu added a commit to jieyouxu/rust that referenced this pull request

Jun 19, 2024
delegation: Implement glob delegation

Support delegating to all trait methods in one go.
Overriding globs with explicit definitions is also supported.

The implementation is generally based on the design from rust-lang/rfcs#3530 (comment), but unlike with list delegation in rust-lang#123413 we cannot expand glob delegation eagerly.
We have to enqueue it into the queue of unexpanded macros (most other macros are processed this way too), and then a glob delegation waits in that queue until its trait path is resolved, and enough code expands to generate the identifier list produced from the glob.

Glob delegation is only allowed in impls, and can only point to traits.
Supporting it in other places gives very little practical benefit, but significantly raises the implementation complexity.

Part of rust-lang#118212.

jieyouxu added a commit to jieyouxu/rust that referenced this pull request

Jun 19, 2024
delegation: Implement glob delegation

Support delegating to all trait methods in one go.
Overriding globs with explicit definitions is also supported.

The implementation is generally based on the design from rust-lang/rfcs#3530 (comment), but unlike with list delegation in rust-lang#123413 we cannot expand glob delegation eagerly.
We have to enqueue it into the queue of unexpanded macros (most other macros are processed this way too), and then a glob delegation waits in that queue until its trait path is resolved, and enough code expands to generate the identifier list produced from the glob.

Glob delegation is only allowed in impls, and can only point to traits.
Supporting it in other places gives very little practical benefit, but significantly raises the implementation complexity.

Part of rust-lang#118212.

rust-timer added a commit to rust-lang-ci/rust that referenced this pull request

Jun 19, 2024
Rollup merge of rust-lang#124135 - petrochenkov:deleglob, r=fmease

delegation: Implement glob delegation

Support delegating to all trait methods in one go.
Overriding globs with explicit definitions is also supported.

The implementation is generally based on the design from rust-lang/rfcs#3530 (comment), but unlike with list delegation in rust-lang#123413 we cannot expand glob delegation eagerly.
We have to enqueue it into the queue of unexpanded macros (most other macros are processed this way too), and then a glob delegation waits in that queue until its trait path is resolved, and enough code expands to generate the identifier list produced from the glob.

Glob delegation is only allowed in impls, and can only point to traits.
Supporting it in other places gives very little practical benefit, but significantly raises the implementation complexity.

Part of rust-lang#118212.