mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-04 12:44:40 +00:00
1c235de97d
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.
33 lines
665 B
Rust
33 lines
665 B
Rust
itemmacro!(this, is.not() .formatted(yet));
|
|
|
|
fn main() {
|
|
foo! ( );
|
|
|
|
bar!( a , b , c );
|
|
|
|
baz!(1+2+3, quux. kaas());
|
|
|
|
quux!(AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA, BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB);
|
|
|
|
kaas!(/* comments */ a /* post macro */, b /* another */);
|
|
|
|
trailingcomma!( a , b , c , );
|
|
|
|
noexpr!( i am not an expression, OK? );
|
|
|
|
vec! [ a , b , c];
|
|
|
|
vec! [AAAAAA, AAAAAA, AAAAAA, AAAAAA, AAAAAA, AAAAAA, AAAAAA, AAAAAA, AAAAAA,
|
|
BBBBB, 5, 100-30, 1.33, b, b, b];
|
|
|
|
vec! [a /* comment */];
|
|
|
|
foo(makro!(1, 3));
|
|
|
|
hamkaas!{ () };
|
|
|
|
macrowithbraces! {dont, format, me}
|
|
|
|
x!(fn);
|
|
}
|