Skip to content

Commit f338542

Browse files
authored
Rollup merge of rust-lang#146280 - mohe2015:public-for-rustfmt-forks, r=lqd
Make `LetChainsPolicy` public for rustfmt usage Related to rust-lang#138511. To call `Parser::parse_expr_cond` from [rustfmt forks for custom macro formatting](https://github.com/tucant/rustfmt/blob/30c83df9e1db10007bdd16dafce8a86b404329b2/src/parse/macros/html.rs#L57) you need to pass this enum so it would be nice if it could be public. Thank you.
2 parents 865c99a + 7fada16 commit f338542

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

compiler/rustc_parse/src/parser/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2742,7 +2742,7 @@ impl<'a> Parser<'a> {
27422742
/// The specified `edition` in `let_chains_policy` should be that of the whole `if` construct,
27432743
/// i.e. the same span we use to later decide whether the drop behaviour should be that of
27442744
/// edition `..=2021` or that of `2024..`.
2745-
// 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.
2745+
// Public to use it for custom `if` expressions in rustfmt forks like https://github.com/tucant/rustfmt
27462746
pub fn parse_expr_cond(
27472747
&mut self,
27482748
let_chains_policy: LetChainsPolicy,

compiler/rustc_parse/src/parser/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ use std::{fmt, mem, slice};
2222
use attr_wrapper::{AttrWrapper, UsePreAttrPos};
2323
pub use diagnostics::AttemptLocalParseRecovery;
2424
pub(crate) use expr::ForbiddenLetReason;
25+
// Public to use it for custom `if` expressions in rustfmt forks like https://github.com/tucant/rustfmt
26+
pub use expr::LetChainsPolicy;
2527
pub(crate) use item::{FnContext, FnParseMode};
2628
pub use pat::{CommaRecoveryMode, RecoverColon, RecoverComma};
2729
pub use path::PathStyle;

0 commit comments

Comments
 (0)