From 7c3efcc5bb260234fc163340c9fd7aad3d8d780e Mon Sep 17 00:00:00 2001 From: Chris Wong Date: Wed, 1 Apr 2015 19:48:49 +1300 Subject: [PATCH] Don't reborrow the target of a `write!()` This means passing in e.g. a `Vec` or `String` will work as intended, rather than deref-ing to `&mut [u8]` or `&mut str`. [breaking-change] Closes #23768 --- src/libcore/macros.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs index d5a7c1d6b2647..e867ed3efd908 100644 --- a/src/libcore/macros.rs +++ b/src/libcore/macros.rs @@ -184,7 +184,7 @@ macro_rules! try { /// ``` #[macro_export] macro_rules! write { - ($dst:expr, $($arg:tt)*) => ((&mut *$dst).write_fmt(format_args!($($arg)*))) + ($dst:expr, $($arg:tt)*) => ($dst.write_fmt(format_args!($($arg)*))) } /// Equivalent to the `write!` macro, except that a newline is appended after