Skip to content

Commit 7c3efcc

Browse files
committed
Don't reborrow the target of a write!()
This means passing in e.g. a `Vec<u8>` or `String` will work as intended, rather than deref-ing to `&mut [u8]` or `&mut str`. [breaking-change] Closes #23768
1 parent d754722 commit 7c3efcc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/libcore/macros.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ macro_rules! try {
184184
/// ```
185185
#[macro_export]
186186
macro_rules! write {
187-
($dst:expr, $($arg:tt)*) => ((&mut *$dst).write_fmt(format_args!($($arg)*)))
187+
($dst:expr, $($arg:tt)*) => ($dst.write_fmt(format_args!($($arg)*)))
188188
}
189189

190190
/// Equivalent to the `write!` macro, except that a newline is appended after

0 commit comments

Comments
 (0)