about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNick Cameron <nrc@ncameron.org>2018-08-27 09:39:08 +1200
committerGitHub <noreply@github.com>2018-08-27 09:39:08 +1200
commitd456161b678d20257587e82c8ddc6dbb41739d18 (patch)
tree80b5dc6b5714e2b6cb972a8f125e70ee8d92ecf8
parent454a20ac011dae62c34e4d9e0590c869a6a2f017 (diff)
parent78a0cde5bfb337af1812b06a73819cbb5ad61f06 (diff)
Merge pull request #2966 from topecongiro/issue-2953
Format in-place expression like assignment 
-rw-r--r--src/expr.rs6
-rw-r--r--src/lib.rs1
-rw-r--r--tests/target/obsolete_in_place.rs9
3 files changed, 13 insertions, 3 deletions
diff --git a/src/expr.rs b/src/expr.rs
index fdea683df0a..74639c6ef63 100644
--- a/src/expr.rs
+++ b/src/expr.rs
@@ -338,8 +338,10 @@ pub fn format_expr(
                 ))
             }
         }
-        // FIXME(#2743)
-        ast::ExprKind::ObsoleteInPlace(..) => unimplemented!(),
+        ast::ExprKind::ObsoleteInPlace(ref lhs, ref rhs) => lhs
+            .rewrite(context, shape)
+            .map(|s| s + " <-")
+            .and_then(|lhs| rewrite_assign_rhs(context, lhs, &**rhs, shape)),
         ast::ExprKind::Async(capture_by, _node_id, ref block) => {
             let mover = if capture_by == ast::CaptureBy::Value {
                 "move "
diff --git a/src/lib.rs b/src/lib.rs
index 89dcf6f5ff3..7ebb967a494 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -8,7 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(tool_attributes)]
 #![feature(decl_macro)]
 #![allow(unused_attributes)]
 #![feature(type_ascription)]
diff --git a/tests/target/obsolete_in_place.rs b/tests/target/obsolete_in_place.rs
new file mode 100644
index 00000000000..3f364c1aecd
--- /dev/null
+++ b/tests/target/obsolete_in_place.rs
@@ -0,0 +1,9 @@
+// #2953
+
+macro_rules! demo {
+    ($a:ident <- $b:expr) => {};
+}
+
+fn main() {
+    demo!(i <- 0);
+}