about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChris Wong <lambda.fairy@gmail.com>2015-04-01 19:48:49 +1300
committerChris Wong <lambda.fairy@gmail.com>2015-04-01 19:48:49 +1300
commit7c3efcc5bb260234fc163340c9fd7aad3d8d780e (patch)
tree30ae61277d1f2b5d2e59fde5dd481b72c96b2a26
parentd754722a04b99fdcae0fd97fa2a4395521145ef2 (diff)
downloadrust-7c3efcc5bb260234fc163340c9fd7aad3d8d780e.tar.gz
rust-7c3efcc5bb260234fc163340c9fd7aad3d8d780e.zip
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
-rw-r--r--src/libcore/macros.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs
index d5a7c1d6b26..e867ed3efd9 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