diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-11-24 03:16:57 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-11-24 03:16:57 +0100 |
| commit | d845e6fc8d293cf8cf0c0ac987b9c917a1eb6fab (patch) | |
| tree | b9f05528a4a6e990c566649ca3924e892a005fb4 /src/liballoc | |
| parent | ad808d95c4839caedc2be76d0ed059dc920ab4b6 (diff) | |
| parent | 31fc42b7f778accb21db8daaf0f0e725948c9d6d (diff) | |
| download | rust-d845e6fc8d293cf8cf0c0ac987b9c917a1eb6fab.tar.gz rust-d845e6fc8d293cf8cf0c0ac987b9c917a1eb6fab.zip | |
Rollup merge of #64856 - jonhoo:format-temporaries, r=sfackler
Scope format! temporaries This places the temporaries that `format!` generates to refer to its arguments (through `&dyn Trait`) in a short-lived scope surrounding just the invocation of `format!`. This enables `format!` to be used in generators without the temporaries preventing the generator from being `Send` (due to `dyn Trait` not being `Sync`). See rust-lang/rust#64477 for details.
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/macros.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/liballoc/macros.rs b/src/liballoc/macros.rs index 2f2cdc39c63..422d3486f92 100644 --- a/src/liballoc/macros.rs +++ b/src/liballoc/macros.rs @@ -98,5 +98,8 @@ macro_rules! vec { #[macro_export] #[stable(feature = "rust1", since = "1.0.0")] macro_rules! format { - ($($arg:tt)*) => ($crate::fmt::format($crate::__export::format_args!($($arg)*))) + ($($arg:tt)*) => {{ + let res = $crate::fmt::format($crate::__export::format_args!($($arg)*)); + res + }} } |
