Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 92b0f52

Browse files
committedJul 15, 2019
Auto merge of #62667 - petrochenkov:printattr2, r=Mark-Simulacrum
pprust: Improve pretty-printing of delimited token groups The commit "Do not convert attributes into `MetaItem`s for printing" fixes #62628. Other commits fix regressions from abandoning `MetaItem`s, and make formatting for attributes, macro calls, macro definitions and other delimited token groups better and more consistent. r? @Mark-Simulacrum
2 parents 5480b47 + 0cdd18d commit 92b0f52

26 files changed

+350
-254
lines changed
 

‎src/librustc/hir/print.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use syntax::source_map::{SourceMap, Spanned};
44
use syntax::parse::ParseSess;
55
use syntax::print::pp::{self, Breaks};
66
use syntax::print::pp::Breaks::{Consistent, Inconsistent};
7-
use syntax::print::pprust::{Comments, PrintState};
7+
use syntax::print::pprust::{self, Comments, PrintState};
88
use syntax::symbol::kw;
99
use syntax::util::parser::{self, AssocOp, Fixity};
1010
use syntax_pos::{self, BytePos, FileName};
@@ -90,6 +90,15 @@ impl<'a> PrintState<'a> for State<'a> {
9090
fn comments(&mut self) -> &mut Option<Comments<'a>> {
9191
&mut self.comments
9292
}
93+
94+
fn print_ident(&mut self, ident: ast::Ident) {
95+
self.s.word(pprust::ast_ident_to_string(ident, ident.is_raw_guess()));
96+
self.ann.post(self, AnnNode::Name(&ident.name))
97+
}
98+
99+
fn print_generic_args(&mut self, args: &ast::GenericArgs, _colons_before_params: bool) {
100+
span_bug!(args.span(), "AST generic args printed by HIR pretty-printer");
101+
}
93102
}
94103

95104
pub const INDENT_UNIT: usize = 4;
@@ -1442,15 +1451,6 @@ impl<'a> State<'a> {
14421451
self.s.word(i.to_string())
14431452
}
14441453

1445-
pub fn print_ident(&mut self, ident: ast::Ident) {
1446-
if ident.is_raw_guess() {
1447-
self.s.word(format!("r#{}", ident.name));
1448-
} else {
1449-
self.s.word(ident.as_str().to_string());
1450-
}
1451-
self.ann.post(self, AnnNode::Name(&ident.name))
1452-
}
1453-
14541454
pub fn print_name(&mut self, name: ast::Name) {
14551455
self.print_ident(ast::Ident::with_empty_ctxt(name))
14561456
}

‎src/libsyntax/ast.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ pub use crate::symbol::{Ident, Symbol as Name};
66
pub use crate::util::parser::ExprPrecedence;
77

88
use crate::ext::hygiene::{Mark, SyntaxContext};
9-
use crate::parse::token;
9+
use crate::parse::token::{self, DelimToken};
1010
use crate::print::pprust;
1111
use crate::ptr::P;
1212
use crate::source_map::{dummy_spanned, respan, Spanned};
@@ -1298,6 +1298,16 @@ impl Mac_ {
12981298
}
12991299
}
13001300

1301+
impl MacDelimiter {
1302+
crate fn to_token(self) -> DelimToken {
1303+
match self {
1304+
MacDelimiter::Parenthesis => DelimToken::Paren,
1305+
MacDelimiter::Bracket => DelimToken::Bracket,
1306+
MacDelimiter::Brace => DelimToken::Brace,
1307+
}
1308+
}
1309+
}
1310+
13011311
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
13021312
pub struct MacroDef {
13031313
pub tokens: TokenStream,

‎src/libsyntax/mut_visit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1328,7 +1328,7 @@ mod tests {
13281328
matches_codepattern,
13291329
"matches_codepattern",
13301330
pprust::to_string(|s| fake_print_crate(s, &krate)),
1331-
"macro_rules! zz((zz$zz:zz$(zz $zz:zz)zz+=>(zz$(zz$zz$zz)+)));".to_string());
1331+
"macro_rules! zz{(zz$zz:zz$(zz $zz:zz)zz+=>(zz$(zz$zz$zz)+))}".to_string());
13321332
})
13331333
}
13341334
}

‎src/libsyntax/print/pprust.rs

Lines changed: 198 additions & 175 deletions
Large diffs are not rendered by default.

‎src/test/pretty/attr-literals.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
#![feature(rustc_attrs)]
66

77
fn main() {
8-
#![rustc_dummy("hi", 1, 2, 1.012, pi = 3.14, bye, name("John"))]
8+
#![rustc_dummy("hi" , 1 , 2 , 1.012 , pi = 3.14 , bye , name ("John"))]
99
#[rustc_dummy = 8]
1010
fn f() { }
1111

12-
#[rustc_dummy(1, 2, 3)]
12+
#[rustc_dummy(1 , 2 , 3)]
1313
fn g() { }
1414
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Keywords in attribute paths are printed as raw idents,
2+
// but keywords in attribute arguments are not.
3+
4+
// pp-exact
5+
6+
#[rustfmt::r#final(final)]
7+
fn main() { }

‎src/test/pretty/cast-lt.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
// pretty-mode:expanded
99
// pp-exact:cast-lt.pp
1010

11-
macro_rules! negative(( $ e : expr ) => { $ e < 0 });
11+
macro_rules! negative { ($ e : expr) => { $ e < 0 } }
1212

1313
fn main() { (1 as i32) < 0; }
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// pp-exact
2+
3+
#![feature(rustc_attrs)]
4+
5+
macro_rules! mac { ($ ($ tt : tt) *) => () }
6+
7+
mac! {
8+
struct S { field1 : u8 , field2 : u16 , } impl Clone for S
9+
{
10+
fn clone () -> S
11+
{
12+
panic ! () ;
13+
14+
}
15+
}
16+
}
17+
18+
mac! {
19+
a
20+
(aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa
21+
aaaaaaaa aaaaaaaa) a
22+
[aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa
23+
aaaaaaaa aaaaaaaa] a
24+
{
25+
aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa
26+
aaaaaaaa aaaaaaaa aaaaaaaa
27+
} a
28+
}
29+
30+
mac!(aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa
31+
aaaaaaaa aaaaaaaa);
32+
mac![aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa
33+
aaaaaaaa aaaaaaaa];
34+
mac! {
35+
aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa
36+
aaaaaaaa aaaaaaaa
37+
}
38+
39+
#[rustc_dummy(aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa
40+
aaaaaaaa aaaaaaaa aaaaaaaa)]
41+
#[rustc_dummy[aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa
42+
aaaaaaaa aaaaaaaa aaaaaaaa]]
43+
#[rustc_dummy {
44+
aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa
45+
aaaaaaaa aaaaaaaa
46+
}]
47+
#[rustc_dummy =
48+
"aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa"]
49+
fn main() { }

‎src/test/pretty/issue-30731.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
// pretty-compare-only
66
// pp-exact
77

8-
fn main() { b!{ } c }
8+
fn main() { b! { } c }

‎src/test/pretty/issue-4264.pp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929

3030

3131

32-
(($crate::fmt::format as
33-
for<'r> fn(std::fmt::Arguments<'r>) -> std::string::String {std::fmt::format})(((<$crate::fmt::Arguments>::new_v1
32+
((::alloc::fmt::format as
33+
for<'r> fn(std::fmt::Arguments<'r>) -> std::string::String {std::fmt::format})(((<::std::fmt::Arguments>::new_v1
3434
as
3535
fn(&[&str], &[std::fmt::ArgumentV1<'_>]) -> std::fmt::Arguments<'_> {std::fmt::Arguments::<'_>::new_v1})((&([("test"
3636
as

‎src/test/pretty/macro.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// pp-exact
2+
3+
#![feature(decl_macro)]
4+
5+
macro mac { ($ arg : expr) => { $ arg + $ arg } }
6+
7+
fn main() { }

‎src/test/pretty/stmt_expr_attributes.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,29 +111,29 @@ fn _8() {
111111
}
112112

113113
fn _9() {
114-
macro_rules! stmt_mac(( ) => { let _ = ( ) ; });
114+
macro_rules! stmt_mac { () => { let _ = () ; } }
115115

116116
#[rustc_dummy]
117117
stmt_mac!();
118118

119119
#[rustc_dummy]
120-
stmt_mac!{ };
120+
stmt_mac! { };
121121

122122
#[rustc_dummy]
123123
stmt_mac![];
124124

125125
#[rustc_dummy]
126-
stmt_mac!{ }
126+
stmt_mac! { }
127127

128128
let _ = ();
129129
}
130130

131-
macro_rules! expr_mac(( ) => { ( ) });
131+
macro_rules! expr_mac { () => { () } }
132132

133133
fn _10() {
134134
let _ = #[rustc_dummy] expr_mac!();
135135
let _ = #[rustc_dummy] expr_mac![];
136-
let _ = #[rustc_dummy] expr_mac!{ };
136+
let _ = #[rustc_dummy] expr_mac! { };
137137
}
138138

139139
fn _11() {
@@ -236,7 +236,7 @@ fn _11() {
236236
|| #[rustc_dummy] return;
237237
let _ = #[rustc_dummy] expr_mac!();
238238
let _ = #[rustc_dummy] expr_mac![];
239-
let _ = #[rustc_dummy] expr_mac!{ };
239+
let _ = #[rustc_dummy] expr_mac! { };
240240
let _ = #[rustc_dummy] Foo{#![rustc_dummy] data: (),};
241241
let _ = #[rustc_dummy] Foo{#![rustc_dummy] ..s};
242242
let _ = #[rustc_dummy] Foo{#![rustc_dummy] data: (), ..s};
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// minimal junk
2-
#![feature(no_core)]
3-
#![no_core]
2+
#![feature /* 0#0 */(no_core)]
3+
#![no_core /* 0#0 */]
44

5-
macro_rules! foo /* 60#0 */(( $ x : ident ) => { y + $ x });
5+
macro_rules! foo /* 0#0 */ { ($ x : ident) => { y + $ x } }
66

7-
fn bar /* 62#0 */() { let x /* 59#2 */ = 1; y /* 61#4 */ + x /* 59#5 */ }
7+
fn bar /* 0#0 */() { let x /* 0#0 */ = 1; y /* 0#1 */ + x /* 0#0 */ }
88

9-
fn y /* 61#0 */() { }
9+
fn y /* 0#0 */() { }

‎src/test/run-pass/macros/syntax-extension-source-utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub fn main() {
1818
assert_eq!(column!(), 16);
1919
assert_eq!(indirect_line!(), 19);
2020
assert!((file!().ends_with("syntax-extension-source-utils.rs")));
21-
assert_eq!(stringify!((2*3) + 5).to_string(), "( 2 * 3 ) + 5".to_string());
21+
assert_eq!(stringify!((2*3) + 5).to_string(), "(2 * 3) + 5".to_string());
2222
assert!(include!("syntax-extension-source-utils-files/includeme.\
2323
fragment").to_string()
2424
== "victory robot 6".to_string());
@@ -33,5 +33,5 @@ pub fn main() {
3333
// The Windows tests are wrapped in an extra module for some reason
3434
assert!((m1::m2::where_am_i().ends_with("m1::m2")));
3535

36-
assert_eq!((36, "( 2 * 3 ) + 5"), (line!(), stringify!((2*3) + 5)));
36+
assert_eq!((36, "(2 * 3) + 5"), (line!(), stringify!((2*3) + 5)));
3737
}

‎src/test/run-pass/proc-macro/auxiliary/derive-b.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use proc_macro::TokenStream;
1010
#[proc_macro_derive(B, attributes(B, C))]
1111
pub fn derive(input: TokenStream) -> TokenStream {
1212
let input = input.to_string();
13-
assert!(input.contains("#[B [ arbitrary tokens ]]"));
13+
assert!(input.contains("#[B[arbitrary tokens]]"));
1414
assert!(input.contains("struct B {"));
1515
assert!(input.contains("#[C]"));
1616
"".parse().unwrap()

‎src/test/ui/editions/edition-keywords-2015-2018-expansion.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ LL | produces_async! {}
77
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
88
help: you can escape reserved keywords to use them as identifiers
99
|
10-
LL | ( ) => ( pub fn r#async ( ) { } )
11-
| ^^^^^^^
10+
LL | () => (pub fn r#async () { })
11+
| ^^^^^^^
1212

1313
error: aborting due to previous error
1414

‎src/test/ui/editions/edition-keywords-2018-2015-parsing.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ LL | r#async = consumes_async_raw!(async);
3131
| ^^^^^ no rules expected this token in macro call
3232

3333
error: macro expansion ends with an incomplete expression: expected one of `move`, `|`, or `||`
34-
--> <::edition_kw_macro_2015::passes_ident macros>:1:25
34+
--> <::edition_kw_macro_2015::passes_ident macros>:1:22
3535
|
36-
LL | ( $ i : ident ) => ( $ i )
37-
| ^ expected one of `move`, `|`, or `||` here
36+
LL | ($ i : ident) => ($ i)
37+
| ^ expected one of `move`, `|`, or `||` here
3838
|
3939
::: $DIR/edition-keywords-2018-2015-parsing.rs:16:8
4040
|

‎src/test/ui/editions/edition-keywords-2018-2018-expansion.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ LL | produces_async! {}
77
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
88
help: you can escape reserved keywords to use them as identifiers
99
|
10-
LL | ( ) => ( pub fn r#async ( ) { } )
11-
| ^^^^^^^
10+
LL | () => (pub fn r#async () { })
11+
| ^^^^^^^
1212

1313
error: aborting due to previous error
1414

‎src/test/ui/editions/edition-keywords-2018-2018-parsing.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ LL | r#async = consumes_async_raw!(async);
3131
| ^^^^^ no rules expected this token in macro call
3232

3333
error: macro expansion ends with an incomplete expression: expected one of `move`, `|`, or `||`
34-
--> <::edition_kw_macro_2018::passes_ident macros>:1:25
34+
--> <::edition_kw_macro_2018::passes_ident macros>:1:22
3535
|
36-
LL | ( $ i : ident ) => ( $ i )
37-
| ^ expected one of `move`, `|`, or `||` here
36+
LL | ($ i : ident) => ($ i)
37+
| ^ expected one of `move`, `|`, or `||` here
3838
|
3939
::: $DIR/edition-keywords-2018-2018-parsing.rs:16:8
4040
|

‎src/test/ui/macro_backtrace/main.stderr

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ LL | ping!();
2424
|
2525
::: <::ping::ping macros>:1:1
2626
|
27-
LL | ( ) => { pong ! ( ) ; }
28-
| -------------------------
29-
| | |
30-
| | in this macro invocation
27+
LL | () => { pong ! () ; }
28+
| ---------------------
29+
| | |
30+
| | in this macro invocation
3131
| in this expansion of `ping!`
3232

3333
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error`
@@ -44,34 +44,34 @@ LL | deep!();
4444
|
4545
::: <::ping::deep macros>:1:1
4646
|
47-
LL | ( ) => { foo ! ( ) ; }
48-
| ------------------------
49-
| | |
50-
| | in this macro invocation (#2)
47+
LL | () => { foo ! () ; }
48+
| --------------------
49+
| | |
50+
| | in this macro invocation (#2)
5151
| in this expansion of `deep!` (#1)
5252
|
5353
::: <::ping::foo macros>:1:1
5454
|
55-
LL | ( ) => { bar ! ( ) ; }
56-
| ------------------------
57-
| | |
58-
| | in this macro invocation (#3)
55+
LL | () => { bar ! () ; }
56+
| --------------------
57+
| | |
58+
| | in this macro invocation (#3)
5959
| in this expansion of `foo!` (#2)
6060
|
6161
::: <::ping::bar macros>:1:1
6262
|
63-
LL | ( ) => { ping ! ( ) ; }
64-
| -------------------------
65-
| | |
66-
| | in this macro invocation (#4)
63+
LL | () => { ping ! () ; }
64+
| ---------------------
65+
| | |
66+
| | in this macro invocation (#4)
6767
| in this expansion of `bar!` (#3)
6868
|
6969
::: <::ping::ping macros>:1:1
7070
|
71-
LL | ( ) => { pong ! ( ) ; }
72-
| -------------------------
73-
| | |
74-
| | in this macro invocation (#5)
71+
LL | () => { pong ! () ; }
72+
| ---------------------
73+
| | |
74+
| | in this macro invocation (#5)
7575
| in this expansion of `ping!` (#4)
7676

7777
error: aborting due to 3 previous errors

‎src/test/ui/macros/trace-macro.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ LL | println!("Hello, World!");
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
77
= note: expanding `println! { "Hello, World!" }`
8-
= note: to `{ $crate :: io :: _print ( format_args_nl ! ( "Hello, World!" ) ) ; }`
8+
= note: to `{ $crate :: io :: _print (format_args_nl ! ("Hello, World!")) ; }`
99

‎src/test/ui/macros/trace_faulty_macros.stderr

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ LL | my_faulty_macro!();
1717
| ^^^^^^^^^^^^^^^^^^^
1818
|
1919
= note: expanding `my_faulty_macro! { }`
20-
= note: to `my_faulty_macro ! ( bcd ) ;`
20+
= note: to `my_faulty_macro ! (bcd) ;`
2121
= note: expanding `my_faulty_macro! { bcd }`
2222

2323
error: recursion limit reached while expanding the macro `my_recursive_macro`
@@ -38,13 +38,13 @@ LL | my_recursive_macro!();
3838
| ^^^^^^^^^^^^^^^^^^^^^^
3939
|
4040
= note: expanding `my_recursive_macro! { }`
41-
= note: to `my_recursive_macro ! ( ) ;`
41+
= note: to `my_recursive_macro ! () ;`
4242
= note: expanding `my_recursive_macro! { }`
43-
= note: to `my_recursive_macro ! ( ) ;`
43+
= note: to `my_recursive_macro ! () ;`
4444
= note: expanding `my_recursive_macro! { }`
45-
= note: to `my_recursive_macro ! ( ) ;`
45+
= note: to `my_recursive_macro ! () ;`
4646
= note: expanding `my_recursive_macro! { }`
47-
= note: to `my_recursive_macro ! ( ) ;`
47+
= note: to `my_recursive_macro ! () ;`
4848

4949
error: aborting due to 2 previous errors
5050

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
fn main ( ) { let y : u32 = "z" ; { let x : u32 = "y" ; } }
1+
fn main () { let y : u32 = "z" ; { let x : u32 = "y" ; } }

‎src/test/ui/proc-macro/dollar-crate-issue-57089.stdout

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
PRINT-BANG INPUT (DISPLAY): struct M ( $crate :: S ) ;
1+
PRINT-BANG INPUT (DISPLAY): struct M ($crate :: S) ;
22
PRINT-BANG INPUT (DEBUG): TokenStream [
33
Ident {
44
ident: "struct",
@@ -39,7 +39,7 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
3939
},
4040
]
4141
PRINT-ATTR INPUT (DISPLAY): struct A(crate::S);
42-
PRINT-ATTR RE-COLLECTED (DISPLAY): struct A ( $crate :: S ) ;
42+
PRINT-ATTR RE-COLLECTED (DISPLAY): struct A ($crate :: S) ;
4343
PRINT-ATTR INPUT (DEBUG): TokenStream [
4444
Ident {
4545
ident: "struct",

‎src/test/ui/proc-macro/dollar-crate-issue-62325.stdout

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PRINT-ATTR INPUT (DISPLAY): struct A(identity!(crate :: S));
2-
PRINT-ATTR RE-COLLECTED (DISPLAY): struct A ( identity ! ( $crate :: S ) ) ;
2+
PRINT-ATTR RE-COLLECTED (DISPLAY): struct A (identity ! ($crate :: S)) ;
33
PRINT-ATTR INPUT (DEBUG): TokenStream [
44
Ident {
55
ident: "struct",
@@ -55,7 +55,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
5555
},
5656
]
5757
PRINT-ATTR INPUT (DISPLAY): struct B(identity!(::dollar_crate_external :: S));
58-
PRINT-ATTR RE-COLLECTED (DISPLAY): struct B ( identity ! ( $crate :: S ) ) ;
58+
PRINT-ATTR RE-COLLECTED (DISPLAY): struct B (identity ! ($crate :: S)) ;
5959
PRINT-ATTR INPUT (DEBUG): TokenStream [
6060
Ident {
6161
ident: "struct",

‎src/test/ui/proc-macro/dollar-crate.stdout

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
PRINT-BANG INPUT (DISPLAY): struct M ( $crate :: S ) ;
1+
PRINT-BANG INPUT (DISPLAY): struct M ($crate :: S) ;
22
PRINT-BANG INPUT (DEBUG): TokenStream [
33
Ident {
44
ident: "struct",
@@ -39,7 +39,7 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
3939
},
4040
]
4141
PRINT-ATTR INPUT (DISPLAY): struct A(crate::S);
42-
PRINT-ATTR RE-COLLECTED (DISPLAY): struct A ( $crate :: S ) ;
42+
PRINT-ATTR RE-COLLECTED (DISPLAY): struct A ($crate :: S) ;
4343
PRINT-ATTR INPUT (DEBUG): TokenStream [
4444
Ident {
4545
ident: "struct",
@@ -80,7 +80,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
8080
},
8181
]
8282
PRINT-DERIVE INPUT (DISPLAY): struct D(crate::S);
83-
PRINT-DERIVE RE-COLLECTED (DISPLAY): struct D ( $crate :: S ) ;
83+
PRINT-DERIVE RE-COLLECTED (DISPLAY): struct D ($crate :: S) ;
8484
PRINT-DERIVE INPUT (DEBUG): TokenStream [
8585
Ident {
8686
ident: "struct",
@@ -120,7 +120,7 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [
120120
span: #2 bytes(LO..HI),
121121
},
122122
]
123-
PRINT-BANG INPUT (DISPLAY): struct M ( $crate :: S ) ;
123+
PRINT-BANG INPUT (DISPLAY): struct M ($crate :: S) ;
124124
PRINT-BANG INPUT (DEBUG): TokenStream [
125125
Ident {
126126
ident: "struct",
@@ -161,7 +161,7 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
161161
},
162162
]
163163
PRINT-ATTR INPUT (DISPLAY): struct A(::dollar_crate_external::S);
164-
PRINT-ATTR RE-COLLECTED (DISPLAY): struct A ( $crate :: S ) ;
164+
PRINT-ATTR RE-COLLECTED (DISPLAY): struct A ($crate :: S) ;
165165
PRINT-ATTR INPUT (DEBUG): TokenStream [
166166
Ident {
167167
ident: "struct",
@@ -202,7 +202,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
202202
},
203203
]
204204
PRINT-DERIVE INPUT (DISPLAY): struct D(::dollar_crate_external::S);
205-
PRINT-DERIVE RE-COLLECTED (DISPLAY): struct D ( $crate :: S ) ;
205+
PRINT-DERIVE RE-COLLECTED (DISPLAY): struct D ($crate :: S) ;
206206
PRINT-DERIVE INPUT (DEBUG): TokenStream [
207207
Ident {
208208
ident: "struct",

0 commit comments

Comments
 (0)
Please sign in to comment.