Skip to content

Commit

Permalink
Remove some unncessary spaces from pretty-printed tokenstream output
Browse files Browse the repository at this point in the history
In addition to making the output look nicer for all crates, this also
aligns the pretty-printing output with what the `rental` crate expects.
This will allow us to eventually disable a backwards-compat hack in a
follow-up PR.
  • Loading branch information
Aaron1011 committed May 15, 2021
1 parent 1025db8 commit 357c013
Show file tree
Hide file tree
Showing 25 changed files with 176 additions and 53 deletions.
5 changes: 4 additions & 1 deletion compiler/rustc_ast_pretty/src/pprust/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,15 @@ pub fn print_crate<'a>(
// and also addresses some specific regressions described in #63896 and #73345.
fn tt_prepend_space(tt: &TokenTree, prev: &TokenTree) -> bool {
if let TokenTree::Token(token) = prev {
if matches!(token.kind, token::Dot) {
return false;
}
if let token::DocComment(comment_kind, ..) = token.kind {
return comment_kind != CommentKind::Line;
}
}
match tt {
TokenTree::Token(token) => token.kind != token::Comma,
TokenTree::Token(token) => !matches!(token.kind, token::Comma | token::Not | token::Dot),
TokenTree::Delimited(_, DelimToken::Paren, _) => {
!matches!(prev, TokenTree::Token(Token { kind: token::Ident(..), .. }))
}
Expand Down
6 changes: 3 additions & 3 deletions src/test/pretty/ast-stmt-expr-attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,11 @@ fn syntax() {
let _ = #[attr] continue ;
let _ = #[attr] return;
let _ = #[attr] foo!();
let _ = #[attr] foo!(# ! [attr]);
let _ = #[attr] foo!(#! [attr]);
let _ = #[attr] foo![];
let _ = #[attr] foo![# ! [attr]];
let _ = #[attr] foo![#! [attr]];
let _ = #[attr] foo! { };
let _ = #[attr] foo! { # ! [attr] };
let _ = #[attr] foo! { #! [attr] };
let _ = #[attr] Foo{bar: baz,};
let _ = #[attr] Foo{..foo};
let _ = #[attr] Foo{bar: baz, ..foo};
Expand Down
2 changes: 1 addition & 1 deletion src/test/pretty/delimited-token-groups.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ mac! {
{
fn clone() -> S
{
panic ! () ;
panic! () ;

}
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/macros/trace-macro.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ LL | println!("Hello, World!");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: expanding `println! { "Hello, World!" }`
= note: to `{ $crate :: io :: _print($crate :: format_args_nl ! ("Hello, World!")) ; }`
= note: to `{ $crate :: io :: _print($crate :: format_args_nl! ("Hello, World!")) ; }`

12 changes: 6 additions & 6 deletions src/test/ui/macros/trace_faulty_macros.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ LL | my_faulty_macro!();
| ^^^^^^^^^^^^^^^^^^^
|
= note: expanding `my_faulty_macro! { }`
= note: to `my_faulty_macro ! (bcd) ;`
= note: to `my_faulty_macro! (bcd) ;`
= note: expanding `my_faulty_macro! { bcd }`

error: recursion limit reached while expanding `my_recursive_macro!`
Expand All @@ -41,13 +41,13 @@ LL | my_recursive_macro!();
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: expanding `my_recursive_macro! { }`
= note: to `my_recursive_macro ! () ;`
= note: to `my_recursive_macro! () ;`
= note: expanding `my_recursive_macro! { }`
= note: to `my_recursive_macro ! () ;`
= note: to `my_recursive_macro! () ;`
= note: expanding `my_recursive_macro! { }`
= note: to `my_recursive_macro ! () ;`
= note: to `my_recursive_macro! () ;`
= note: expanding `my_recursive_macro! { }`
= note: to `my_recursive_macro ! () ;`
= note: to `my_recursive_macro! () ;`

error: expected expression, found `A { a: a, b: 0, c: _, .. }`
--> $DIR/trace_faulty_macros.rs:16:9
Expand All @@ -73,7 +73,7 @@ LL | let a = pat_macro!();
| ^^^^^^^^^^^^
|
= note: expanding `pat_macro! { }`
= note: to `pat_macro ! (A { a : a, b : 0, c : _, .. }) ;`
= note: to `pat_macro! (A { a : a, b : 0, c : _, .. }) ;`
= note: expanding `pat_macro! { A { a : a, b : 0, c : _, .. } }`
= note: to `A { a: a, b: 0, c: _, .. }`

Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/proc-macro/allowed-attr-stmt-expr.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
span: $DIR/allowed-attr-stmt-expr.rs:57:33: 57:34 (#0),
},
]
PRINT-ATTR INPUT (DISPLAY): #[expect_my_macro_stmt] my_macro ! ("{}", string) ;
PRINT-ATTR INPUT (DISPLAY): #[expect_my_macro_stmt] my_macro! ("{}", string) ;
PRINT-ATTR INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
Expand Down Expand Up @@ -140,7 +140,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
span: $DIR/allowed-attr-stmt-expr.rs:61:28: 61:29 (#0),
},
]
PRINT-ATTR INPUT (DISPLAY): second_make_stmt ! (#[allow(dead_code)] struct Bar { }) ;
PRINT-ATTR INPUT (DISPLAY): second_make_stmt! (#[allow(dead_code)] struct Bar { }) ;
PRINT-ATTR INPUT (DEBUG): TokenStream [
Ident {
ident: "second_make_stmt",
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/proc-macro/attr-complex-fn.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
span: $DIR/attr-complex-fn.rs:19:42: 19:44 (#0),
},
]
PRINT-ATTR INPUT (DISPLAY): impl < T > MyTrait < T > for MyStruct < { true } > { # ! [rustc_dummy] }
PRINT-ATTR INPUT (DISPLAY): impl < T > MyTrait < T > for MyStruct < { true } > { #! [rustc_dummy] }
PRINT-ATTR INPUT (DEBUG): TokenStream [
Ident {
ident: "impl",
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/proc-macro/attr-stmt-expr.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
span: $DIR/attr-stmt-expr.rs:49:33: 49:34 (#0),
},
]
PRINT-ATTR INPUT (DISPLAY): #[expect_my_macro_stmt] my_macro ! ("{}", string) ;
PRINT-ATTR INPUT (DISPLAY): #[expect_my_macro_stmt] my_macro! ("{}", string) ;
PRINT-ATTR INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
Expand Down Expand Up @@ -124,7 +124,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
span: $DIR/attr-stmt-expr.rs:53:28: 53:29 (#0),
},
]
PRINT-ATTR INPUT (DISPLAY): second_make_stmt ! (#[allow(dead_code)] struct Bar { }) ;
PRINT-ATTR INPUT (DISPLAY): second_make_stmt! (#[allow(dead_code)] struct Bar { }) ;
PRINT-ATTR INPUT (DEBUG): TokenStream [
Ident {
ident: "second_make_stmt",
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/proc-macro/auxiliary/attr-stmt-expr-rpass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub fn expect_let(attr: TokenStream, item: TokenStream) -> TokenStream {
#[proc_macro_attribute]
pub fn expect_print_stmt(attr: TokenStream, item: TokenStream) -> TokenStream {
assert!(attr.to_string().is_empty());
assert_eq!(item.to_string(), "println ! (\"{}\", string) ;");
assert_eq!(item.to_string(), "println! (\"{}\", string) ;");
item
}

Expand All @@ -31,7 +31,7 @@ pub fn expect_expr(attr: TokenStream, item: TokenStream) -> TokenStream {
#[proc_macro_attribute]
pub fn expect_print_expr(attr: TokenStream, item: TokenStream) -> TokenStream {
assert!(attr.to_string().is_empty());
assert_eq!(item.to_string(), "println ! (\"{}\", string)");
assert_eq!(item.to_string(), "println! (\"{}\", string)");
item
}

Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/proc-macro/auxiliary/attr-stmt-expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub fn expect_let(attr: TokenStream, item: TokenStream) -> TokenStream {
#[proc_macro_attribute]
pub fn expect_my_macro_stmt(attr: TokenStream, item: TokenStream) -> TokenStream {
assert!(attr.to_string().is_empty());
assert_eq!(item.to_string(), "my_macro ! (\"{}\", string) ;");
assert_eq!(item.to_string(), "my_macro! (\"{}\", string) ;");
item
}

Expand All @@ -31,7 +31,7 @@ pub fn expect_expr(attr: TokenStream, item: TokenStream) -> TokenStream {
#[proc_macro_attribute]
pub fn expect_my_macro_expr(attr: TokenStream, item: TokenStream) -> TokenStream {
assert!(attr.to_string().is_empty());
assert_eq!(item.to_string(), "my_macro ! (\"{}\", string)");
assert_eq!(item.to_string(), "my_macro! (\"{}\", string)");
item
}

Expand Down
6 changes: 3 additions & 3 deletions src/test/ui/proc-macro/cfg-eval-inner.stdout
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
PRINT-ATTR INPUT (DISPLAY): impl Foo <
[u8 ;
{
# ! [rustc_dummy(cursed_inner)] # ! [allow(unused)] struct Inner
{ field : [u8 ; { # ! [rustc_dummy(another_cursed_inner)] 1 }] } 0
}] > { # ! [rustc_dummy(evaluated_attr)] fn bar() { } }
#! [rustc_dummy(cursed_inner)] #! [allow(unused)] struct Inner
{ field : [u8 ; { #! [rustc_dummy(another_cursed_inner)] 1 }] } 0
}] > { #! [rustc_dummy(evaluated_attr)] fn bar() { } }
PRINT-ATTR INPUT (DEBUG): TokenStream [
Ident {
ident: "impl",
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/proc-macro/dollar-crate-issue-62325.stdout
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PRINT-ATTR INPUT (DISPLAY): struct A(identity ! ($crate :: S)) ;
PRINT-ATTR INPUT (DISPLAY): struct A(identity! ($crate :: S)) ;
PRINT-ATTR INPUT (DEBUG): TokenStream [
Ident {
ident: "struct",
Expand Down Expand Up @@ -53,7 +53,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
span: $DIR/dollar-crate-issue-62325.rs:19:35: 19:36 (#4),
},
]
PRINT-ATTR INPUT (DISPLAY): struct B(identity ! ($crate :: S)) ;
PRINT-ATTR INPUT (DISPLAY): struct B(identity! ($crate :: S)) ;
PRINT-ATTR INPUT (DEBUG): TokenStream [
Ident {
ident: "struct",
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/proc-macro/inner-attr-non-inline-mod.stdout
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PRINT-ATTR INPUT (DISPLAY): #[deny(unused_attributes)] mod module_with_attrs { # ! [rustfmt :: skip] }
PRINT-ATTR INPUT (DISPLAY): #[deny(unused_attributes)] mod module_with_attrs { #! [rustfmt :: skip] }
PRINT-ATTR INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
Expand Down
18 changes: 9 additions & 9 deletions src/test/ui/proc-macro/inner-attrs.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
},
]
PRINT-ATTR INPUT (DISPLAY): #[print_target_and_args(second)] fn foo()
{ # ! [print_target_and_args(third)] # ! [print_target_and_args(fourth)] }
{ #! [print_target_and_args(third)] #! [print_target_and_args(fourth)] }
PRINT-ATTR INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
Expand Down Expand Up @@ -121,7 +121,7 @@ PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
},
]
PRINT-ATTR INPUT (DISPLAY): fn foo()
{ # ! [print_target_and_args(third)] # ! [print_target_and_args(fourth)] }
{ #! [print_target_and_args(third)] #! [print_target_and_args(fourth)] }
PRINT-ATTR INPUT (DEBUG): TokenStream [
Ident {
ident: "fn",
Expand Down Expand Up @@ -210,7 +210,7 @@ PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
span: $DIR/inner-attrs.rs:19:30: 19:35 (#0),
},
]
PRINT-ATTR INPUT (DISPLAY): fn foo() { # ! [print_target_and_args(fourth)] }
PRINT-ATTR INPUT (DISPLAY): fn foo() { #! [print_target_and_args(fourth)] }
PRINT-ATTR INPUT (DEBUG): TokenStream [
Ident {
ident: "fn",
Expand Down Expand Up @@ -299,7 +299,7 @@ PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
]
PRINT-ATTR INPUT (DISPLAY): #[print_target_and_args(mod_second)] mod inline_mod
{
# ! [print_target_and_args(mod_third)] # !
#! [print_target_and_args(mod_third)] #!
[print_target_and_args(mod_fourth)]
}
PRINT-ATTR INPUT (DEBUG): TokenStream [
Expand Down Expand Up @@ -412,7 +412,7 @@ PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
]
PRINT-ATTR INPUT (DISPLAY): mod inline_mod
{
# ! [print_target_and_args(mod_third)] # !
#! [print_target_and_args(mod_third)] #!
[print_target_and_args(mod_fourth)]
}
PRINT-ATTR INPUT (DEBUG): TokenStream [
Expand Down Expand Up @@ -498,7 +498,7 @@ PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
span: $DIR/inner-attrs.rs:26:30: 26:39 (#0),
},
]
PRINT-ATTR INPUT (DISPLAY): mod inline_mod { # ! [print_target_and_args(mod_fourth)] }
PRINT-ATTR INPUT (DISPLAY): mod inline_mod { #! [print_target_and_args(mod_fourth)] }
PRINT-ATTR INPUT (DEBUG): TokenStream [
Ident {
ident: "mod",
Expand Down Expand Up @@ -571,7 +571,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
PRINT-DERIVE INPUT (DISPLAY): struct MyDerivePrint
{
field :
[u8 ; { match true { _ => { # ! [rustc_dummy(third)] true } } ; 0 }]
[u8 ; { match true { _ => { #! [rustc_dummy(third)] true } } ; 0 }]
}
PRINT-DERIVE INPUT (DEBUG): TokenStream [
Ident {
Expand Down Expand Up @@ -705,7 +705,7 @@ PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
span: $DIR/inner-attrs.rs:48:29: 48:40 (#0),
},
]
PRINT-ATTR INPUT (DISPLAY): (3, 4, { # ! [cfg_attr(not(FALSE), rustc_dummy(innermost))] 5 }) ;
PRINT-ATTR INPUT (DISPLAY): (3, 4, { #! [cfg_attr(not(FALSE), rustc_dummy(innermost))] 5 }) ;
PRINT-ATTR INPUT (DEBUG): TokenStream [
Group {
delimiter: Parenthesis,
Expand Down Expand Up @@ -819,7 +819,7 @@ PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
span: $DIR/inner-attrs.rs:55:29: 55:40 (#0),
},
]
PRINT-ATTR INPUT (DISPLAY): (3, 4, { # ! [cfg_attr(not(FALSE), rustc_dummy(innermost))] 5 }) ;
PRINT-ATTR INPUT (DISPLAY): (3, 4, { #! [cfg_attr(not(FALSE), rustc_dummy(innermost))] 5 }) ;
PRINT-ATTR INPUT (DEBUG): TokenStream [
Group {
delimiter: Parenthesis,
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/proc-macro/issue-75734-pp-paren.stdout
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PRINT-ATTR INPUT (DISPLAY): fn main() { & | _ : u8 | { } ; mul_2 ! (1 + 1) ; }
PRINT-ATTR INPUT (DISPLAY): fn main() { & | _ : u8 | { } ; mul_2! (1 + 1) ; }
PRINT-ATTR INPUT (DEBUG): TokenStream [
Ident {
ident: "fn",
Expand Down
9 changes: 4 additions & 5 deletions src/test/ui/proc-macro/issue-75930-derive-cfg.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,15 @@ struct Foo < #[cfg(FALSE)] A, B >
#[cfg(FALSE)] true => { },
#[cfg_attr(not(FALSE), allow(warnings))] false => { }, _ => { }
} ; #[print_helper(should_be_removed)] fn removed_fn()
{ # ! [cfg(FALSE)] } #[print_helper(c)] #[cfg(not(FALSE))] fn
kept_fn() { # ! [cfg(not(FALSE))] let my_val = true ; } enum
TupleEnum
{ #! [cfg(FALSE)] } #[print_helper(c)] #[cfg(not(FALSE))] fn
kept_fn() { #! [cfg(not(FALSE))] let my_val = true ; } enum TupleEnum
{
Foo(#[cfg(FALSE)] u8, #[cfg(FALSE)] bool, #[cfg(not(FALSE))] i32,
#[cfg(FALSE)] String, u8)
} struct
TupleStruct(#[cfg(FALSE)] String, #[cfg(not(FALSE))] i32,
#[cfg(FALSE)] bool, u8) ; fn plain_removed_fn()
{ # ! [cfg_attr(not(FALSE), cfg(FALSE))] } 0
{ #! [cfg_attr(not(FALSE), cfg(FALSE))] } 0
}], #[print_helper(d)] fourth : B
}
PRINT-ATTR INPUT (DEBUG): TokenStream [
Expand Down Expand Up @@ -1281,7 +1280,7 @@ PRINT-DERIVE INPUT (DISPLAY): #[print_helper(a)] #[allow(dead_code)] #[print_hel
#[cfg(not(FALSE))] struct Inner ; match true
{ #[allow(warnings)] false => { }, _ => { } } ; #[print_helper(c)]
#[cfg(not(FALSE))] fn kept_fn()
{ # ! [cfg(not(FALSE))] let my_val = true ; } enum TupleEnum
{ #! [cfg(not(FALSE))] let my_val = true ; } enum TupleEnum
{ Foo(#[cfg(not(FALSE))] i32, u8) } struct
TupleStruct(#[cfg(not(FALSE))] i32, u8) ; 0
}], #[print_helper(d)] fourth : B
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PRINT-BANG INPUT (DISPLAY): foo ! { #[fake_attr] mod bar {
PRINT-BANG INPUT (DISPLAY): foo! { #[fake_attr] mod bar {
#![doc = r" Foo"]
} }
PRINT-BANG DEEP-RE-COLLECTED (DISPLAY): foo ! { #[fake_attr] mod bar { # ! [doc = r" Foo"] } }
PRINT-BANG DEEP-RE-COLLECTED (DISPLAY): foo! { #[fake_attr] mod bar { #! [doc = r" Foo"] } }
PRINT-BANG INPUT (DEBUG): TokenStream [
Ident {
ident: "foo",
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/proc-macro/macro-rules-derive-cfg.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ PRINT-DERIVE INPUT (DISPLAY): struct Foo
[bool ;
{
let a = #[rustc_dummy(first)] #[rustc_dummy(second)]
{ # ! [allow(unused)] 30 } ; 0
{ #! [allow(unused)] 30 } ; 0
}]
}
PRINT-DERIVE INPUT (DEBUG): TokenStream [
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/proc-macro/meta-macro-hygiene.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ macro_rules! produce_it
*/ {
() =>
{
meta_macro :: print_def_site ! ($ crate :: dummy ! ()) ;
meta_macro :: print_def_site! ($ crate :: dummy! ()) ;
// `print_def_site!` will respan the `$crate` identifier
// with `Span::def_site()`. This should cause it to resolve
// relative to `meta_macro`, *not* `make_macro` (despite
Expand Down
1 change: 0 additions & 1 deletion src/test/ui/proc-macro/nodelim-groups.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
},
]
PRINT-BANG INPUT (DISPLAY): "hi" "hello".len() + "world".len() (1 + 1)
PRINT-BANG DEEP-RE-COLLECTED (DISPLAY): "hi" "hello" . len() + "world" . len() (1 + 1)
PRINT-BANG INPUT (DEBUG): TokenStream [
Literal {
kind: Str,
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/proc-macro/nonterminal-expansion.stdout
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PRINT-ATTR_ARGS INPUT (DISPLAY): a, line!(), b
PRINT-ATTR_ARGS RE-COLLECTED (DISPLAY): a, line ! (), b
PRINT-ATTR_ARGS RE-COLLECTED (DISPLAY): a, line! (), b
PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
Ident {
ident: "a",
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/proc-macro/nonterminal-token-hygiene.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ macro_rules! outer
*/ {
($ item : item) =>
{
macro inner() { print_bang ! { $ item } } inner ! () ;
macro inner() { print_bang! { $ item } } inner! () ;

} ;
}

struct S /* 0#0 */;
macro inner /* 0#4 */ { () => { print_bang ! { struct S; } } }
macro inner /* 0#4 */ { () => { print_bang! { struct S; } } }

struct S /* 0#5 */;
// OK, not a duplicate definition of `S`
Expand Down
20 changes: 20 additions & 0 deletions src/test/ui/proc-macro/pretty-print-tts.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// check-pass
// aux-build:test-macros.rs
// compile-flags: -Z span-debug

#![feature(rustc_attrs)]

#![no_std] // Don't load unnecessary hygiene information from std
extern crate std;

#[macro_use]
extern crate test_macros;

// Tests the pretty-printing behavior of various (unparsed) tokens
print_bang_consume!({
#![rustc_dummy]
let a = "hello".len();
matches!(a, 5);
});

fn main() {}
Loading

0 comments on commit 357c013

Please sign in to comment.