Skip to content

Commit df25df1

Browse files
committed
Constify fmt::from_fn
1 parent 1107bba commit df25df1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

library/core/src/fmt/builders.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1227,8 +1227,9 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> {
12271227
/// assert_eq!(format!("{:?}", wrapped), "'a'");
12281228
/// ```
12291229
#[stable(feature = "fmt_from_fn", since = "1.93.0")]
1230+
#[rustc_const_stable(feature = "const_fmt_from_fn", since = "CURRENT_RUSTC_VERSION")]
12301231
#[must_use = "returns a type implementing Debug and Display, which do not have any effects unless they are used"]
1231-
pub fn from_fn<F: Fn(&mut fmt::Formatter<'_>) -> fmt::Result>(f: F) -> FromFn<F> {
1232+
pub const fn from_fn<F: Fn(&mut fmt::Formatter<'_>) -> fmt::Result>(f: F) -> FromFn<F> {
12321233
FromFn(f)
12331234
}
12341235

0 commit comments

Comments
 (0)