Skip to content

Commit

Permalink
Rollup merge of rust-lang#111106 - Stargateur:doc/format_args, r=m-ou-se
Browse files Browse the repository at this point in the history
Add known issue of let binding to format_args doc

Simply add doc about rust-lang#92698.

 `@rustbot` label +T-rustdoc -T-libs

 r? `@GuillaumeGomez`
  • Loading branch information
matthiaskrgr authored Feb 15, 2024
2 parents ee9c7c9 + cd7c161 commit 0238d26
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions library/core/src/macros/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -969,6 +969,14 @@ pub(crate) mod builtin {
/// let s = fmt::format(format_args!("hello {}", "world"));
/// assert_eq!(s, format!("hello {}", "world"));
/// ```
///
/// # Lifetime limitation
///
/// Except when no formatting arguments are used,
/// the produced `fmt::Arguments` value borrows temporary values,
/// which means it can only be used within the same expression
/// and cannot be stored for later use.
/// This is a known limitation, see [#92698](https://github.com/rust-lang/rust/issues/92698).
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "format_args_macro")]
#[allow_internal_unsafe]
Expand Down

0 comments on commit 0238d26

Please sign in to comment.