diff --git a/src/visitor.rs b/src/visitor.rs index 86fb1bce9d9..00b2b6c2392 100644 --- a/src/visitor.rs +++ b/src/visitor.rs @@ -382,8 +382,8 @@ impl<'a> FmtVisitor<'a> { self.block_indent); self.push_rewrite(ti.span, rewrite); } - ast::TraitItemKind::Macro(..) => { - // FIXME(#1158) Macros in trait item position + ast::TraitItemKind::Macro(ref mac) => { + self.visit_mac(mac, Some(ti.ident), MacroPosition::Item); } } } diff --git a/tests/source/issue-1158.rs b/tests/source/issue-1158.rs new file mode 100644 index 00000000000..6742e17459e --- /dev/null +++ b/tests/source/issue-1158.rs @@ -0,0 +1,3 @@ +trait T { + itemmacro!(this, is.now() .formatted(yay)); +} diff --git a/tests/target/issue-1158.rs b/tests/target/issue-1158.rs new file mode 100644 index 00000000000..2abfa5a29f2 --- /dev/null +++ b/tests/target/issue-1158.rs @@ -0,0 +1,3 @@ +trait T { + itemmacro!(this, is.now().formatted(yay)); +}