rust/compiler/rustc_expand/src
许杰友 Jieyou Xu (Joe) f8ce1cfbf5
Rollup merge of #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 https://github.com/rust-lang/rfcs/pull/3530#issuecomment-2020869823, but unlike with list delegation in https://github.com/rust-lang/rust/pull/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 https://github.com/rust-lang/rust/issues/118212.
2024-06-19 01:51:36 +01:00
..
mbe Remove redundant argument from subdiagnostic method 2024-06-18 15:42:11 +00:00
base.rs Rollup merge of #124135 - petrochenkov:deleglob, r=fmease 2024-06-19 01:51:36 +01:00
build.rs Fix formatting 2024-06-06 20:27:25 -05:00
config.rs Rename buffer_lint_with_diagnostic to buffer_lint 2024-05-21 20:16:39 +00:00
errors.rs delegation: Implement glob delegation 2024-06-14 19:27:51 +03:00
expand.rs delegation: Implement glob delegation 2024-06-14 19:27:51 +03:00
lib.rs Move some tests from rustc_expand to rustc_parse. 2024-05-06 09:06:02 +10:00
mbe.rs Add some comments. 2024-05-23 06:03:17 +10:00
module.rs Make top-level rustc_parse functions fallible. 2024-06-05 10:38:03 +10:00
placeholders.rs Add ErrorGuaranteed to Recovered::Yes and use it more. 2024-05-09 20:12:07 +10:00
proc_macro_server.rs Prefer dcx methods over fields or fields' methods 2024-06-18 13:45:08 +00:00
proc_macro.rs Remove stream_to_parser. 2024-06-05 10:37:59 +10:00