diff options
| author | bors <bors@rust-lang.org> | 2024-05-15 10:35:31 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-05-15 10:35:31 +0000 |
| commit | 3cb0030fe9de01eeacb7c03eeef0c51420798cfb (patch) | |
| tree | 47262ea23428202480e68ed968b4611b9b6ae676 /src | |
| parent | a71c3ffce9ca505af27f43cd3bad7606a72e3ec8 (diff) | |
| parent | c30b41012d474586d407392a6b154e7f19c38b2c (diff) | |
| download | rust-3cb0030fe9de01eeacb7c03eeef0c51420798cfb.tar.gz rust-3cb0030fe9de01eeacb7c03eeef0c51420798cfb.zip | |
Auto merge of #123413 - petrochenkov:delegmulti2, r=fmease
delegation: Implement list delegation
```rust
reuse prefix::{a, b, c};
```
Using design described in https://github.com/rust-lang/rfcs/pull/3530#issuecomment-2020869823 (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 (https://github.com/rust-lang/rust/pull/124135).
Part of https://github.com/rust-lang/rust/issues/118212.
Diffstat (limited to 'src')
| -rw-r--r-- | src/tools/rustfmt/src/items.rs | 4 | ||||
| -rw-r--r-- | src/tools/rustfmt/src/visitor.rs | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/tools/rustfmt/src/items.rs b/src/tools/rustfmt/src/items.rs index e196d1817f3..90e9e58ef9c 100644 --- a/src/tools/rustfmt/src/items.rs +++ b/src/tools/rustfmt/src/items.rs @@ -739,8 +739,8 @@ impl<'a> FmtVisitor<'a> { (_, Const(..)) => Ordering::Greater, (MacCall(..), _) => Ordering::Less, (_, MacCall(..)) => Ordering::Greater, - (Delegation(..), _) => Ordering::Less, - (_, Delegation(..)) => Ordering::Greater, + (Delegation(..), _) | (DelegationMac(..), _) => Ordering::Less, + (_, Delegation(..)) | (_, DelegationMac(..)) => Ordering::Greater, }); let mut prev_kind = None; for (buf, item) in buffer { diff --git a/src/tools/rustfmt/src/visitor.rs b/src/tools/rustfmt/src/visitor.rs index 6209b37004b..e1c7dc35087 100644 --- a/src/tools/rustfmt/src/visitor.rs +++ b/src/tools/rustfmt/src/visitor.rs @@ -586,7 +586,7 @@ impl<'b, 'a: 'b> FmtVisitor<'a> { ); self.push_rewrite(item.span, rewrite); } - ast::ItemKind::Delegation(..) => { + ast::ItemKind::Delegation(..) | ast::ItemKind::DelegationMac(..) => { // TODO: rewrite delegation items once syntax is established. // For now, leave the contents of the Span unformatted. self.push_rewrite(item.span, None) |
