matches_codepattern,
"matches_codepattern",
pprust::to_string(|s| fake_print_crate(s, &krate)),
- "macro_rules! zz((zz$zz:zz$(zz $zz:zz)zz+=>(zz$(zz$zz$zz)+)));".to_string());
+ "macro_rules! zz{(zz$zz:zz$(zz $zz:zz)zz+=>(zz$(zz$zz$zz)+))}".to_string());
})
}
}
convert_dollar_crate: bool,
span: Span,
) {
+ if delim == DelimToken::Brace {
+ self.cbox(INDENT_UNIT);
+ }
if let Some(path) = path {
self.print_path(path, false, 0);
}
self.word("!");
}
if let Some(ident) = ident {
- self.space();
+ self.nbsp();
self.print_ident(ident);
- self.space();
}
match delim {
- DelimToken::Paren => self.popen(),
- DelimToken::Bracket => self.word("["),
- DelimToken::NoDelim => self.word(" "),
DelimToken::Brace => {
- self.head("");
- self.bopen();
+ if path.is_some() || has_bang || ident.is_some() {
+ self.nbsp();
+ }
+ self.word("{");
+ if !tts.is_empty() {
+ self.space();
+ }
}
+ _ => self.word(token_kind_to_string(&token::OpenDelim(delim))),
}
self.ibox(0);
self.print_tts(tts, convert_dollar_crate);
self.end();
match delim {
- DelimToken::Paren => self.pclose(),
- DelimToken::Bracket => self.word("]"),
- DelimToken::NoDelim => self.word(" "),
DelimToken::Brace => self.bclose(span),
+ _ => self.word(token_kind_to_string(&token::CloseDelim(delim))),
}
}
// pretty-mode:expanded
// pp-exact:cast-lt.pp
-macro_rules! negative {($ e : expr) => {$ e < 0 } }
+macro_rules! negative { ($ e : expr) => { $ e < 0 } }
fn main() { (1 as i32) < 0; }
--- /dev/null
+// pp-exact
+
+#![feature(rustc_attrs)]
+
+macro_rules! mac { ($ ($ tt : tt) *) => () }
+
+mac! {
+ struct S { field1 : u8 , field2 : u16 , } impl Clone for S
+ {
+ fn clone () -> S
+ {
+ panic ! () ;
+
+ }
+ }
+}
+
+mac! {
+ a
+ (aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa
+ aaaaaaaa aaaaaaaa) a
+ [aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa
+ aaaaaaaa aaaaaaaa] a
+ {
+ aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa
+ aaaaaaaa aaaaaaaa aaaaaaaa
+ } a
+}
+
+mac!(aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa
+ aaaaaaaa aaaaaaaa);
+mac![aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa
+ aaaaaaaa aaaaaaaa];
+mac! {
+ aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa
+ aaaaaaaa aaaaaaaa
+}
+
+#[rustc_dummy(aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa
+ aaaaaaaa aaaaaaaa aaaaaaaa)]
+#[rustc_dummy[aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa
+ aaaaaaaa aaaaaaaa aaaaaaaa]]
+#[rustc_dummy {
+ aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa
+ aaaaaaaa aaaaaaaa
+ }]
+#[rustc_dummy =
+ "aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa"]
+fn main() { }
// pretty-compare-only
// pp-exact
-fn main() { b!{ } c }
+fn main() { b! { } c }
}
fn _9() {
- macro_rules!
- stmt_mac
- {() => {let _ = () ; } }
+ macro_rules! stmt_mac { () => { let _ = () ; } }
#[rustc_dummy]
stmt_mac!();
#[rustc_dummy]
- stmt_mac!{ };
+ stmt_mac! { };
#[rustc_dummy]
stmt_mac![];
#[rustc_dummy]
- stmt_mac!{ }
+ stmt_mac! { }
let _ = ();
}
-macro_rules! expr_mac {() => {() } }
+macro_rules! expr_mac { () => { () } }
fn _10() {
let _ = #[rustc_dummy] expr_mac!();
let _ = #[rustc_dummy] expr_mac![];
- let _ = #[rustc_dummy] expr_mac!{ };
+ let _ = #[rustc_dummy] expr_mac! { };
}
fn _11() {
|| #[rustc_dummy] return;
let _ = #[rustc_dummy] expr_mac!();
let _ = #[rustc_dummy] expr_mac![];
- let _ = #[rustc_dummy] expr_mac!{ };
+ let _ = #[rustc_dummy] expr_mac! { };
let _ = #[rustc_dummy] Foo{#![rustc_dummy] data: (),};
let _ = #[rustc_dummy] Foo{#![rustc_dummy] ..s};
let _ = #[rustc_dummy] Foo{#![rustc_dummy] data: (), ..s};
// minimal junk
-#![feature(no_core)]
-#![no_core]
+#![feature /* 0#0 */(no_core)]
+#![no_core /* 0#0 */]
-macro_rules! foo /* 60#0 */(( $ x : ident ) => { y + $ x });
+macro_rules /* 0#0 */! foo /* 0#0 */ { ($ x : ident) => { y + $ x } }
-fn bar /* 62#0 */() { let x /* 59#2 */ = 1; y /* 61#4 */ + x /* 59#5 */ }
+fn bar /* 0#0 */() { let x /* 0#0 */ = 1; y /* 0#1 */ + x /* 0#0 */ }
-fn y /* 61#0 */() { }
+fn y /* 0#0 */() { }
assert_eq!(column!(), 16);
assert_eq!(indirect_line!(), 19);
assert!((file!().ends_with("syntax-extension-source-utils.rs")));
- assert_eq!(stringify!((2*3) + 5).to_string(), "( 2 * 3 ) + 5".to_string());
+ assert_eq!(stringify!((2*3) + 5).to_string(), "(2 * 3) + 5".to_string());
assert!(include!("syntax-extension-source-utils-files/includeme.\
fragment").to_string()
== "victory robot 6".to_string());
// The Windows tests are wrapped in an extra module for some reason
assert!((m1::m2::where_am_i().ends_with("m1::m2")));
- assert_eq!((36, "( 2 * 3 ) + 5"), (line!(), stringify!((2*3) + 5)));
+ assert_eq!((36, "(2 * 3) + 5"), (line!(), stringify!((2*3) + 5)));
}
|
::: <::ping::ping macros>:1:1
|
-LL | () => {pong ! () ; }
- | --------------------
- | | |
- | | in this macro invocation
+LL | () => { pong ! () ; }
+ | ---------------------
+ | | |
+ | | in this macro invocation
| in this expansion of `ping!`
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error`
|
::: <::ping::deep macros>:1:1
|
-LL | () => {foo ! () ; }
- | -------------------
- | | |
- | | in this macro invocation (#2)
+LL | () => { foo ! () ; }
+ | --------------------
+ | | |
+ | | in this macro invocation (#2)
| in this expansion of `deep!` (#1)
|
::: <::ping::foo macros>:1:1
|
-LL | () => {bar ! () ; }
- | -------------------
- | | |
- | | in this macro invocation (#3)
+LL | () => { bar ! () ; }
+ | --------------------
+ | | |
+ | | in this macro invocation (#3)
| in this expansion of `foo!` (#2)
|
::: <::ping::bar macros>:1:1
|
-LL | () => {ping ! () ; }
- | --------------------
- | | |
- | | in this macro invocation (#4)
+LL | () => { ping ! () ; }
+ | ---------------------
+ | | |
+ | | in this macro invocation (#4)
| in this expansion of `bar!` (#3)
|
::: <::ping::ping macros>:1:1
|
-LL | () => {pong ! () ; }
- | --------------------
- | | |
- | | in this macro invocation (#5)
+LL | () => { pong ! () ; }
+ | ---------------------
+ | | |
+ | | in this macro invocation (#5)
| in this expansion of `ping!` (#4)
error: aborting due to 3 previous errors
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: expanding `println! { "Hello, World!" }`
- = note: to `{$crate :: io :: _print (format_args_nl ! ("Hello, World!")) ; }`
+ = note: to `{ $crate :: io :: _print (format_args_nl ! ("Hello, World!")) ; }`
-fn main () {let y : u32 = "z" ; {let x : u32 = "y" ; } }
+fn main () { let y : u32 = "z" ; { let x : u32 = "y" ; } }