Commit Graph

16 Commits

Author SHA1 Message Date
topecongiro
e3eec44690 Return original snippet when macro contains invalid syntax 2017-05-24 07:24:31 +09:00
topecongiro
dc8d3aa23a Update tests 2017-05-23 11:39:31 +09:00
topecongiro
d16a0a399e Implement 'vec![expr; expr]' 2017-05-23 11:32:09 +09:00
Seiichi Uchida
79ba34c607 Use offset_left for rewrite_unary_prefix 2017-05-15 22:55:01 +09:00
Nick Cameron
49e86a1e65 Handle semicolons in macro statements
Fixes #1279
2017-01-18 10:38:46 +13:00
Nick Cameron
846d7ad387 make rustfmt-normalize_comments false by default 2017-01-16 14:50:27 +13:00
Bekh-Ivanov Aleksey
935286755c Stripping trailing commas and spaces from vec! elements (#1219)
* Stripping trailing commas and spaces from `vec!` elements

* Stripping trailing commas and spaces ONLY from `vec!` elements

* Added comment
2016-11-14 17:42:15 +13:00
Philip Craig
c4a7a7108e Preserve macro formatting if we can't rewrite it 2016-10-03 14:14:56 +10:00
Nick Cameron
9188ec0f7f Bail out on recovered errors. (#965)
Closes #915
Closes #930
Closes #931
2016-04-27 21:08:44 +02:00
Marcus Klaas de Vries
50820c6a43 Merge pull request #883 from marcusklaas/macro-with-name
Properly format macro's with an extra ident
2016-03-30 02:03:28 +02:00
Marcus Klaas
9e5c0390a0 Properly format macro's with an extra ident 2016-03-29 23:16:40 +02:00
Marcus Klaas
0e0cf976c9 Fix issues with empty macros with curly braces 2016-03-27 13:44:40 +02:00
Kevin Yeh
7fc70a1753 Add item macro tests 2016-01-24 13:11:18 -06:00
Kevin Yeh
f01ed6f507 Format item macros 2016-01-22 13:43:18 -06:00
Eli Friedman
1c235de97d Fix crash speculatively parsing macro arguments as expressions.
The problem is essentially that if we try to parse a token tree using a
CodeMap different from the one the tree was originally parsed with,
spans become nonsense. Since CodeMaps can't be cloned, we're basically
forced to use the original ParseSess for additional parsing.

Ideally, rustfmt would be a bit more clever and figure out how to parse
macro arguments based on the definition of the macro itself, rather than
just guessing that a particular token sequence looks like an expression,
but this is good enough for now.

Fixes #538.
2015-10-27 23:41:32 -07:00
Marcus Klaas
f751356910 Format macro invocations 2015-09-16 20:26:14 +02:00