summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser/expr.rs
diff options
context:
space:
mode:
authorMoritz Hedtke <Moritz.Hedtke@t-online.de>2025-03-14 18:50:41 +0100
committerMoritz Hedtke <Moritz.Hedtke@t-online.de>2025-03-14 19:55:55 +0100
commit66c49c73ee16c02e7b01c4c22070b92410318a5f (patch)
tree338bc023993cc2737bd6c12a29da624598fe3a14 /compiler/rustc_parse/src/parser/expr.rs
parentf7b43542838f0a4a6cfdb17fbeadf45002042a77 (diff)
downloadrust-66c49c73ee16c02e7b01c4c22070b92410318a5f.tar.gz
rust-66c49c73ee16c02e7b01c4c22070b92410318a5f.zip
Make `Parser::parse_expr_cond` public.
This allows usage in rustfmt and rustfmt forks.
Diffstat (limited to 'compiler/rustc_parse/src/parser/expr.rs')
-rw-r--r--compiler/rustc_parse/src/parser/expr.rs3
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)?;