diff options
| author | León Orell Valerian Liehr <me@fmease.dev> | 2025-03-15 00:18:26 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-15 00:18:26 +0100 |
| commit | 79775921aace9f7756749f3094cfe353557a8a15 (patch) | |
| tree | 74c4af34714369a19995e2287b5abaeb2f2d32e9 /compiler/rustc_parse/src | |
| parent | 9b8a6771bc99d4e8f49b16d39720ff77301ca331 (diff) | |
| parent | 66c49c73ee16c02e7b01c4c22070b92410318a5f (diff) | |
| download | rust-79775921aace9f7756749f3094cfe353557a8a15.tar.gz rust-79775921aace9f7756749f3094cfe353557a8a15.zip | |
Rollup merge of #138511 - mohe2015:rustc-parse-pub-parse-expr-cond, r=oli-obk
Make `Parser::parse_expr_cond` public This allows usage in rustfmt and rustfmt forks. I'm using this for custom macro formatting, see https://github.com/tucant/rustfmt/blob/30c83df9e1db10007bdd16dafce8a86b404329b2/src/parse/macros/html.rs#L57 It would be great if this could be upstreamed so I don't need to rely on a fork.
Diffstat (limited to 'compiler/rustc_parse/src')
| -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 9b2d562a69e..0774324eae7 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -2588,7 +2588,8 @@ impl<'a> Parser<'a> { } /// Parses the condition of a `if` or `while` expression. - fn parse_expr_cond(&mut self) -> PResult<'a, P<Expr>> { + // Public because it is used in rustfmt forks such as https://github.com/tucant/rustfmt/blob/30c83df9e1db10007bdd16dafce8a86b404329b2/src/parse/macros/html.rs#L57 for custom if expressions. + pub fn parse_expr_cond(&mut self) -> PResult<'a, P<Expr>> { let attrs = self.parse_outer_attributes()?; let (mut cond, _) = self.parse_expr_res(Restrictions::NO_STRUCT_LITERAL | Restrictions::ALLOW_LET, attrs)?; |
