Rollup merge of #146280 - mohe2015:public-for-rustfmt-forks, r=lqd

Make `LetChainsPolicy` public for rustfmt usage

Related to https://github.com/rust-lang/rust/pull/138511. To call `Parser::parse_expr_cond` from [rustfmt forks for custom macro formatting](30c83df9e1/src/parse/macros/html.rs (L57)) you need to pass this enum so it would be nice if it could be public.

Thank you.
This commit is contained in:
Trevor Gross 2025-09-06 14:39:06 -04:00 committed by GitHub
commit f338542c42
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View file

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

View file

@ -22,6 +22,8 @@ use std::{fmt, mem, slice};
use attr_wrapper::{AttrWrapper, UsePreAttrPos};
pub use diagnostics::AttemptLocalParseRecovery;
pub(crate) use expr::ForbiddenLetReason;
// Public to use it for custom `if` expressions in rustfmt forks like https://github.com/tucant/rustfmt
pub use expr::LetChainsPolicy;
pub(crate) use item::{FnContext, FnParseMode};
pub use pat::{CommaRecoveryMode, RecoverColon, RecoverComma};
pub use path::PathStyle;