diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2025-09-02 17:08:57 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-02 17:08:57 +0200 |
| commit | 8408bca60502a2364b6104192089d27b2b6223fd (patch) | |
| tree | af817ab7e059c6501bc4ba0d328d509970b480c8 | |
| parent | 15cde9c505df79ce071858b67e63fbb98512f88e (diff) | |
| parent | d8df6312d5b3290c6976e5b55f5ae8344cab1bb4 (diff) | |
| download | rust-8408bca60502a2364b6104192089d27b2b6223fd.tar.gz rust-8408bca60502a2364b6104192089d27b2b6223fd.zip | |
Rollup merge of #146094 - mohe2015:patch-2, r=lcnr
Make `Parser::parse_for_head` public for rustfmt usage Similar to https://github.com/rust-lang/rust/pull/138511, I want to add [dioxus rsx](https://dioxuslabs.com/learn/0.6/reference/rsx) formatting to [my rustfmt fork](https://github.com/tucant/rustfmt) and it would be much easier if that method would be public. Thanks.
| -rw-r--r-- | compiler/rustc_parse/src/parser/expr.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index 7de4f6efd0b..9b09cbba7af 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -2910,7 +2910,8 @@ impl<'a> Parser<'a> { } } - fn parse_for_head(&mut self) -> PResult<'a, (Box<Pat>, Box<Expr>)> { + // Public to use it for custom `for` expressions in rustfmt forks like https://github.com/tucant/rustfmt + pub fn parse_for_head(&mut self) -> PResult<'a, (Box<Pat>, Box<Expr>)> { let begin_paren = if self.token == token::OpenParen { // Record whether we are about to parse `for (`. // This is used below for recovery in case of `for ( $stuff ) $block` |
