Skip to content

Commit cd7c161

Browse files
committed
Add known issue of let binding to format_args doc
1 parent 9d795a6 commit cd7c161

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

library/core/src/macros/mod.rs

+8
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,14 @@ pub(crate) mod builtin {
868868
/// let s = fmt::format(format_args!("hello {}", "world"));
869869
/// assert_eq!(s, format!("hello {}", "world"));
870870
/// ```
871+
///
872+
/// # Lifetime limitation
873+
///
874+
/// Except when no formatting arguments are used,
875+
/// the produced `fmt::Arguments` value borrows temporary values,
876+
/// which means it can only be used within the same expression
877+
/// and cannot be stored for later use.
878+
/// This is a known limitation, see [#92698](https://github.com/rust-lang/rust/issues/92698).
871879
#[stable(feature = "rust1", since = "1.0.0")]
872880
#[cfg_attr(not(test), rustc_diagnostic_item = "format_args_macro")]
873881
#[allow_internal_unsafe]

0 commit comments

Comments
 (0)