diff options
| author | bors <bors@rust-lang.org> | 2024-05-12 08:34:32 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-05-12 08:34:32 +0000 |
| commit | 4fd98a4b1b100f5329c6efae18031791f64372d2 (patch) | |
| tree | 197a37c7a58ade9e6ec7004cb8e3ee41bfa9a169 /library/alloc/src | |
| parent | 645bc609d994b6556c9aebbdd810f1d75c3e2206 (diff) | |
| parent | e00f27b7be9084e548f7197325c2f343e8ad27b9 (diff) | |
Auto merge of #125012 - RalfJung:format-error, r=Mark-Simulacrum,workingjubilee
io::Write::write_fmt: panic if the formatter fails when the stream does not fail Follow-up to https://github.com/rust-lang/rust/pull/124954
Diffstat (limited to 'library/alloc/src')
| -rw-r--r-- | library/alloc/src/fmt.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/library/alloc/src/fmt.rs b/library/alloc/src/fmt.rs index d7dc6ae6694..ae44cab8131 100644 --- a/library/alloc/src/fmt.rs +++ b/library/alloc/src/fmt.rs @@ -630,7 +630,9 @@ pub fn format(args: Arguments<'_>) -> string::String { fn format_inner(args: Arguments<'_>) -> string::String { let capacity = args.estimated_capacity(); let mut output = string::String::with_capacity(capacity); - output.write_fmt(args).expect("a formatting trait implementation returned an error"); + output + .write_fmt(args) + .expect("a formatting trait implementation returned an error when the underlying stream did not"); output } |
