rust/tests/ui/proc-macro/inner-attrs.stdout

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

968 lines
35 KiB
Plaintext
Raw Normal View History

2021-02-28 13:51:44 -06:00
PRINT-ATTR_ARGS INPUT (DISPLAY): first
PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
Ident {
ident: "first",
span: $DIR/inner-attrs.rs:18:25: 18:30 (#0),
2021-02-28 13:51:44 -06:00
},
]
PRINT-ATTR INPUT (DISPLAY): #[print_target_and_args(second)] fn foo()
Improve `print_tts` by changing `tokenstream::Spacing`. `tokenstream::Spacing` appears on all `TokenTree::Token` instances, both punct and non-punct. Its current usage: - `Joint` means "can join with the next token *and* that token is a punct". - `Alone` means "cannot join with the next token *or* can join with the next token but that token is not a punct". The fact that `Alone` is used for two different cases is awkward. This commit augments `tokenstream::Spacing` with a new variant `JointHidden`, resulting in: - `Joint` means "can join with the next token *and* that token is a punct". - `JointHidden` means "can join with the next token *and* that token is a not a punct". - `Alone` means "cannot join with the next token". This *drastically* improves the output of `print_tts`. For example, this: ``` stringify!(let a: Vec<u32> = vec![];) ``` currently produces this string: ``` let a : Vec < u32 > = vec! [] ; ``` With this PR, it now produces this string: ``` let a: Vec<u32> = vec![] ; ``` (The space after the `]` is because `TokenTree::Delimited` currently doesn't have spacing information. The subsequent commit fixes this.) The new `print_tts` doesn't replicate original code perfectly. E.g. multiple space characters will be condensed into a single space character. But it's much improved. `print_tts` still produces the old, uglier output for code produced by proc macros. Because we have to translate the generated code from `proc_macro::Spacing` to the more expressive `token::Spacing`, which results in too much `proc_macro::Along` usage and no `proc_macro::JointHidden` usage. So `space_between` still exists and is used by `print_tts` in conjunction with the `Spacing` field. This change will also help with the removal of `Token::Interpolated`. Currently interpolated tokens are pretty-printed nicely via AST pretty printing. `Token::Interpolated` removal will mean they get printed with `print_tts`. Without this change, that would result in much uglier output for code produced by decl macro expansions. With this change, AST pretty printing and `print_tts` produce similar results. The commit also tweaks the comments on `proc_macro::Spacing`. In particular, it refers to "compound tokens" rather than "multi-char operators" because lifetimes aren't operators.
2023-08-07 20:43:44 -05:00
{ #![print_target_and_args(third)] #![print_target_and_args(fourth)] }
PRINT-ATTR DEEP-RE-COLLECTED (DISPLAY): #[print_target_and_args(second)] fn foo()
{ #! [print_target_and_args(third)] #! [print_target_and_args(fourth)] }
2021-02-28 13:51:44 -06:00
PRINT-ATTR INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
spacing: Alone,
span: $DIR/inner-attrs.rs:19:1: 19:2 (#0),
2021-02-28 13:51:44 -06:00
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "print_target_and_args",
span: $DIR/inner-attrs.rs:19:3: 19:24 (#0),
2021-02-28 13:51:44 -06:00
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "second",
span: $DIR/inner-attrs.rs:19:25: 19:31 (#0),
2021-02-28 13:51:44 -06:00
},
],
span: $DIR/inner-attrs.rs:19:24: 19:32 (#0),
2021-02-28 13:51:44 -06:00
},
],
span: $DIR/inner-attrs.rs:19:2: 19:33 (#0),
2021-02-28 13:51:44 -06:00
},
Ident {
ident: "fn",
span: $DIR/inner-attrs.rs:20:1: 20:3 (#0),
2021-02-28 13:51:44 -06:00
},
Ident {
ident: "foo",
span: $DIR/inner-attrs.rs:20:4: 20:7 (#0),
2021-02-28 13:51:44 -06:00
},
Group {
delimiter: Parenthesis,
stream: TokenStream [],
span: $DIR/inner-attrs.rs:20:7: 20:9 (#0),
2021-02-28 13:51:44 -06:00
},
Group {
delimiter: Brace,
stream: TokenStream [
Punct {
ch: '#',
spacing: Joint,
span: $DIR/inner-attrs.rs:21:5: 21:6 (#0),
2021-02-28 13:51:44 -06:00
},
Punct {
ch: '!',
spacing: Alone,
span: $DIR/inner-attrs.rs:21:6: 21:7 (#0),
2021-02-28 13:51:44 -06:00
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "print_target_and_args",
span: $DIR/inner-attrs.rs:21:8: 21:29 (#0),
2021-02-28 13:51:44 -06:00
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "third",
span: $DIR/inner-attrs.rs:21:30: 21:35 (#0),
2021-02-28 13:51:44 -06:00
},
],
span: $DIR/inner-attrs.rs:21:29: 21:36 (#0),
2021-02-28 13:51:44 -06:00
},
],
span: $DIR/inner-attrs.rs:21:7: 21:37 (#0),
2021-02-28 13:51:44 -06:00
},
Punct {
ch: '#',
spacing: Joint,
span: $DIR/inner-attrs.rs:22:5: 22:6 (#0),
2021-02-28 13:51:44 -06:00
},
Punct {
ch: '!',
spacing: Alone,
span: $DIR/inner-attrs.rs:22:6: 22:7 (#0),
2021-02-28 13:51:44 -06:00
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "print_target_and_args",
span: $DIR/inner-attrs.rs:22:8: 22:29 (#0),
2021-02-28 13:51:44 -06:00
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "fourth",
span: $DIR/inner-attrs.rs:22:30: 22:36 (#0),
2021-02-28 13:51:44 -06:00
},
],
span: $DIR/inner-attrs.rs:22:29: 22:37 (#0),
2021-02-28 13:51:44 -06:00
},
],
span: $DIR/inner-attrs.rs:22:7: 22:38 (#0),
2021-02-28 13:51:44 -06:00
},
],
span: $DIR/inner-attrs.rs:20:10: 23:2 (#0),
2021-02-28 13:51:44 -06:00
},
]
PRINT-ATTR_ARGS INPUT (DISPLAY): second
PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
Ident {
ident: "second",
span: $DIR/inner-attrs.rs:19:25: 19:31 (#0),
2021-02-28 13:51:44 -06:00
},
]
PRINT-ATTR INPUT (DISPLAY): fn foo()
Improve `print_tts` by changing `tokenstream::Spacing`. `tokenstream::Spacing` appears on all `TokenTree::Token` instances, both punct and non-punct. Its current usage: - `Joint` means "can join with the next token *and* that token is a punct". - `Alone` means "cannot join with the next token *or* can join with the next token but that token is not a punct". The fact that `Alone` is used for two different cases is awkward. This commit augments `tokenstream::Spacing` with a new variant `JointHidden`, resulting in: - `Joint` means "can join with the next token *and* that token is a punct". - `JointHidden` means "can join with the next token *and* that token is a not a punct". - `Alone` means "cannot join with the next token". This *drastically* improves the output of `print_tts`. For example, this: ``` stringify!(let a: Vec<u32> = vec![];) ``` currently produces this string: ``` let a : Vec < u32 > = vec! [] ; ``` With this PR, it now produces this string: ``` let a: Vec<u32> = vec![] ; ``` (The space after the `]` is because `TokenTree::Delimited` currently doesn't have spacing information. The subsequent commit fixes this.) The new `print_tts` doesn't replicate original code perfectly. E.g. multiple space characters will be condensed into a single space character. But it's much improved. `print_tts` still produces the old, uglier output for code produced by proc macros. Because we have to translate the generated code from `proc_macro::Spacing` to the more expressive `token::Spacing`, which results in too much `proc_macro::Along` usage and no `proc_macro::JointHidden` usage. So `space_between` still exists and is used by `print_tts` in conjunction with the `Spacing` field. This change will also help with the removal of `Token::Interpolated`. Currently interpolated tokens are pretty-printed nicely via AST pretty printing. `Token::Interpolated` removal will mean they get printed with `print_tts`. Without this change, that would result in much uglier output for code produced by decl macro expansions. With this change, AST pretty printing and `print_tts` produce similar results. The commit also tweaks the comments on `proc_macro::Spacing`. In particular, it refers to "compound tokens" rather than "multi-char operators" because lifetimes aren't operators.
2023-08-07 20:43:44 -05:00
{ #![print_target_and_args(third)] #![print_target_and_args(fourth)] }
PRINT-ATTR DEEP-RE-COLLECTED (DISPLAY): fn foo()
{ #! [print_target_and_args(third)] #! [print_target_and_args(fourth)] }
2021-02-28 13:51:44 -06:00
PRINT-ATTR INPUT (DEBUG): TokenStream [
Ident {
ident: "fn",
span: $DIR/inner-attrs.rs:20:1: 20:3 (#0),
2021-02-28 13:51:44 -06:00
},
Ident {
ident: "foo",
span: $DIR/inner-attrs.rs:20:4: 20:7 (#0),
2021-02-28 13:51:44 -06:00
},
Group {
delimiter: Parenthesis,
stream: TokenStream [],
span: $DIR/inner-attrs.rs:20:7: 20:9 (#0),
2021-02-28 13:51:44 -06:00
},
Group {
delimiter: Brace,
stream: TokenStream [
Punct {
ch: '#',
spacing: Joint,
span: $DIR/inner-attrs.rs:21:5: 21:6 (#0),
2021-02-28 13:51:44 -06:00
},
Punct {
ch: '!',
spacing: Alone,
span: $DIR/inner-attrs.rs:21:6: 21:7 (#0),
2021-02-28 13:51:44 -06:00
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "print_target_and_args",
span: $DIR/inner-attrs.rs:21:8: 21:29 (#0),
2021-02-28 13:51:44 -06:00
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "third",
span: $DIR/inner-attrs.rs:21:30: 21:35 (#0),
2021-02-28 13:51:44 -06:00
},
],
span: $DIR/inner-attrs.rs:21:29: 21:36 (#0),
2021-02-28 13:51:44 -06:00
},
],
span: $DIR/inner-attrs.rs:21:7: 21:37 (#0),
2021-02-28 13:51:44 -06:00
},
Punct {
ch: '#',
spacing: Joint,
span: $DIR/inner-attrs.rs:22:5: 22:6 (#0),
2021-02-28 13:51:44 -06:00
},
Punct {
ch: '!',
spacing: Alone,
span: $DIR/inner-attrs.rs:22:6: 22:7 (#0),
2021-02-28 13:51:44 -06:00
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "print_target_and_args",
span: $DIR/inner-attrs.rs:22:8: 22:29 (#0),
2021-02-28 13:51:44 -06:00
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "fourth",
span: $DIR/inner-attrs.rs:22:30: 22:36 (#0),
2021-02-28 13:51:44 -06:00
},
],
span: $DIR/inner-attrs.rs:22:29: 22:37 (#0),
2021-02-28 13:51:44 -06:00
},
],
span: $DIR/inner-attrs.rs:22:7: 22:38 (#0),
2021-02-28 13:51:44 -06:00
},
],
span: $DIR/inner-attrs.rs:20:10: 23:2 (#0),
2021-02-28 13:51:44 -06:00
},
]
PRINT-ATTR_ARGS INPUT (DISPLAY): third
PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
Ident {
ident: "third",
span: $DIR/inner-attrs.rs:21:30: 21:35 (#0),
2021-02-28 13:51:44 -06:00
},
]
Improve `print_tts` by changing `tokenstream::Spacing`. `tokenstream::Spacing` appears on all `TokenTree::Token` instances, both punct and non-punct. Its current usage: - `Joint` means "can join with the next token *and* that token is a punct". - `Alone` means "cannot join with the next token *or* can join with the next token but that token is not a punct". The fact that `Alone` is used for two different cases is awkward. This commit augments `tokenstream::Spacing` with a new variant `JointHidden`, resulting in: - `Joint` means "can join with the next token *and* that token is a punct". - `JointHidden` means "can join with the next token *and* that token is a not a punct". - `Alone` means "cannot join with the next token". This *drastically* improves the output of `print_tts`. For example, this: ``` stringify!(let a: Vec<u32> = vec![];) ``` currently produces this string: ``` let a : Vec < u32 > = vec! [] ; ``` With this PR, it now produces this string: ``` let a: Vec<u32> = vec![] ; ``` (The space after the `]` is because `TokenTree::Delimited` currently doesn't have spacing information. The subsequent commit fixes this.) The new `print_tts` doesn't replicate original code perfectly. E.g. multiple space characters will be condensed into a single space character. But it's much improved. `print_tts` still produces the old, uglier output for code produced by proc macros. Because we have to translate the generated code from `proc_macro::Spacing` to the more expressive `token::Spacing`, which results in too much `proc_macro::Along` usage and no `proc_macro::JointHidden` usage. So `space_between` still exists and is used by `print_tts` in conjunction with the `Spacing` field. This change will also help with the removal of `Token::Interpolated`. Currently interpolated tokens are pretty-printed nicely via AST pretty printing. `Token::Interpolated` removal will mean they get printed with `print_tts`. Without this change, that would result in much uglier output for code produced by decl macro expansions. With this change, AST pretty printing and `print_tts` produce similar results. The commit also tweaks the comments on `proc_macro::Spacing`. In particular, it refers to "compound tokens" rather than "multi-char operators" because lifetimes aren't operators.
2023-08-07 20:43:44 -05:00
PRINT-ATTR INPUT (DISPLAY): fn foo() { #![print_target_and_args(fourth)] }
PRINT-ATTR DEEP-RE-COLLECTED (DISPLAY): fn foo() { #! [print_target_and_args(fourth)] }
2021-02-28 13:51:44 -06:00
PRINT-ATTR INPUT (DEBUG): TokenStream [
Ident {
ident: "fn",
span: $DIR/inner-attrs.rs:20:1: 20:3 (#0),
2021-02-28 13:51:44 -06:00
},
Ident {
ident: "foo",
span: $DIR/inner-attrs.rs:20:4: 20:7 (#0),
2021-02-28 13:51:44 -06:00
},
Group {
delimiter: Parenthesis,
stream: TokenStream [],
span: $DIR/inner-attrs.rs:20:7: 20:9 (#0),
2021-02-28 13:51:44 -06:00
},
Group {
delimiter: Brace,
stream: TokenStream [
Punct {
ch: '#',
spacing: Joint,
span: $DIR/inner-attrs.rs:22:5: 22:6 (#0),
2021-02-28 13:51:44 -06:00
},
Punct {
ch: '!',
spacing: Alone,
span: $DIR/inner-attrs.rs:22:6: 22:7 (#0),
2021-02-28 13:51:44 -06:00
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "print_target_and_args",
span: $DIR/inner-attrs.rs:22:8: 22:29 (#0),
2021-02-28 13:51:44 -06:00
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "fourth",
span: $DIR/inner-attrs.rs:22:30: 22:36 (#0),
2021-02-28 13:51:44 -06:00
},
],
span: $DIR/inner-attrs.rs:22:29: 22:37 (#0),
2021-02-28 13:51:44 -06:00
},
],
span: $DIR/inner-attrs.rs:22:7: 22:38 (#0),
2021-02-28 13:51:44 -06:00
},
],
span: $DIR/inner-attrs.rs:20:10: 23:2 (#0),
2021-02-28 13:51:44 -06:00
},
]
PRINT-ATTR_ARGS INPUT (DISPLAY): fourth
PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
Ident {
ident: "fourth",
span: $DIR/inner-attrs.rs:22:30: 22:36 (#0),
2021-02-28 13:51:44 -06:00
},
]
2021-12-01 13:45:14 -06:00
PRINT-ATTR INPUT (DISPLAY): fn foo() {}
2021-02-28 13:51:44 -06:00
PRINT-ATTR INPUT (DEBUG): TokenStream [
Ident {
ident: "fn",
span: $DIR/inner-attrs.rs:20:1: 20:3 (#0),
2021-02-28 13:51:44 -06:00
},
Ident {
ident: "foo",
span: $DIR/inner-attrs.rs:20:4: 20:7 (#0),
2021-02-28 13:51:44 -06:00
},
Group {
delimiter: Parenthesis,
stream: TokenStream [],
span: $DIR/inner-attrs.rs:20:7: 20:9 (#0),
2021-02-28 13:51:44 -06:00
},
Group {
delimiter: Brace,
stream: TokenStream [],
span: $DIR/inner-attrs.rs:20:10: 23:2 (#0),
2021-02-28 13:51:44 -06:00
},
]
PRINT-ATTR_ARGS INPUT (DISPLAY): mod_first
PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
Ident {
ident: "mod_first",
span: $DIR/inner-attrs.rs:25:25: 25:34 (#0),
},
]
PRINT-ATTR INPUT (DISPLAY): #[print_target_and_args(mod_second)] mod inline_mod
Improve `print_tts` by changing `tokenstream::Spacing`. `tokenstream::Spacing` appears on all `TokenTree::Token` instances, both punct and non-punct. Its current usage: - `Joint` means "can join with the next token *and* that token is a punct". - `Alone` means "cannot join with the next token *or* can join with the next token but that token is not a punct". The fact that `Alone` is used for two different cases is awkward. This commit augments `tokenstream::Spacing` with a new variant `JointHidden`, resulting in: - `Joint` means "can join with the next token *and* that token is a punct". - `JointHidden` means "can join with the next token *and* that token is a not a punct". - `Alone` means "cannot join with the next token". This *drastically* improves the output of `print_tts`. For example, this: ``` stringify!(let a: Vec<u32> = vec![];) ``` currently produces this string: ``` let a : Vec < u32 > = vec! [] ; ``` With this PR, it now produces this string: ``` let a: Vec<u32> = vec![] ; ``` (The space after the `]` is because `TokenTree::Delimited` currently doesn't have spacing information. The subsequent commit fixes this.) The new `print_tts` doesn't replicate original code perfectly. E.g. multiple space characters will be condensed into a single space character. But it's much improved. `print_tts` still produces the old, uglier output for code produced by proc macros. Because we have to translate the generated code from `proc_macro::Spacing` to the more expressive `token::Spacing`, which results in too much `proc_macro::Along` usage and no `proc_macro::JointHidden` usage. So `space_between` still exists and is used by `print_tts` in conjunction with the `Spacing` field. This change will also help with the removal of `Token::Interpolated`. Currently interpolated tokens are pretty-printed nicely via AST pretty printing. `Token::Interpolated` removal will mean they get printed with `print_tts`. Without this change, that would result in much uglier output for code produced by decl macro expansions. With this change, AST pretty printing and `print_tts` produce similar results. The commit also tweaks the comments on `proc_macro::Spacing`. In particular, it refers to "compound tokens" rather than "multi-char operators" because lifetimes aren't operators.
2023-08-07 20:43:44 -05:00
{ #![print_target_and_args(mod_third)] #![print_target_and_args(mod_fourth)] }
PRINT-ATTR DEEP-RE-COLLECTED (DISPLAY): #[print_target_and_args(mod_second)] mod inline_mod
{
#! [print_target_and_args(mod_third)] #!
[print_target_and_args(mod_fourth)]
}
PRINT-ATTR INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
spacing: Alone,
span: $DIR/inner-attrs.rs:26:1: 26:2 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "print_target_and_args",
span: $DIR/inner-attrs.rs:26:3: 26:24 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "mod_second",
span: $DIR/inner-attrs.rs:26:25: 26:35 (#0),
},
],
span: $DIR/inner-attrs.rs:26:24: 26:36 (#0),
},
],
span: $DIR/inner-attrs.rs:26:2: 26:37 (#0),
},
Ident {
ident: "mod",
span: $DIR/inner-attrs.rs:27:1: 27:4 (#0),
},
Ident {
ident: "inline_mod",
span: $DIR/inner-attrs.rs:27:5: 27:15 (#0),
},
Group {
delimiter: Brace,
stream: TokenStream [
Punct {
ch: '#',
spacing: Joint,
span: $DIR/inner-attrs.rs:28:5: 28:6 (#0),
},
Punct {
ch: '!',
spacing: Alone,
span: $DIR/inner-attrs.rs:28:6: 28:7 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "print_target_and_args",
span: $DIR/inner-attrs.rs:28:8: 28:29 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "mod_third",
span: $DIR/inner-attrs.rs:28:30: 28:39 (#0),
},
],
span: $DIR/inner-attrs.rs:28:29: 28:40 (#0),
},
],
span: $DIR/inner-attrs.rs:28:7: 28:41 (#0),
},
Punct {
ch: '#',
spacing: Joint,
span: $DIR/inner-attrs.rs:29:5: 29:6 (#0),
},
Punct {
ch: '!',
spacing: Alone,
span: $DIR/inner-attrs.rs:29:6: 29:7 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "print_target_and_args",
span: $DIR/inner-attrs.rs:29:8: 29:29 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "mod_fourth",
span: $DIR/inner-attrs.rs:29:30: 29:40 (#0),
},
],
span: $DIR/inner-attrs.rs:29:29: 29:41 (#0),
},
],
span: $DIR/inner-attrs.rs:29:7: 29:42 (#0),
},
],
span: $DIR/inner-attrs.rs:27:16: 30:2 (#0),
},
]
PRINT-ATTR_ARGS INPUT (DISPLAY): mod_second
PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
Ident {
ident: "mod_second",
span: $DIR/inner-attrs.rs:26:25: 26:35 (#0),
},
]
PRINT-ATTR INPUT (DISPLAY): mod inline_mod
Improve `print_tts` by changing `tokenstream::Spacing`. `tokenstream::Spacing` appears on all `TokenTree::Token` instances, both punct and non-punct. Its current usage: - `Joint` means "can join with the next token *and* that token is a punct". - `Alone` means "cannot join with the next token *or* can join with the next token but that token is not a punct". The fact that `Alone` is used for two different cases is awkward. This commit augments `tokenstream::Spacing` with a new variant `JointHidden`, resulting in: - `Joint` means "can join with the next token *and* that token is a punct". - `JointHidden` means "can join with the next token *and* that token is a not a punct". - `Alone` means "cannot join with the next token". This *drastically* improves the output of `print_tts`. For example, this: ``` stringify!(let a: Vec<u32> = vec![];) ``` currently produces this string: ``` let a : Vec < u32 > = vec! [] ; ``` With this PR, it now produces this string: ``` let a: Vec<u32> = vec![] ; ``` (The space after the `]` is because `TokenTree::Delimited` currently doesn't have spacing information. The subsequent commit fixes this.) The new `print_tts` doesn't replicate original code perfectly. E.g. multiple space characters will be condensed into a single space character. But it's much improved. `print_tts` still produces the old, uglier output for code produced by proc macros. Because we have to translate the generated code from `proc_macro::Spacing` to the more expressive `token::Spacing`, which results in too much `proc_macro::Along` usage and no `proc_macro::JointHidden` usage. So `space_between` still exists and is used by `print_tts` in conjunction with the `Spacing` field. This change will also help with the removal of `Token::Interpolated`. Currently interpolated tokens are pretty-printed nicely via AST pretty printing. `Token::Interpolated` removal will mean they get printed with `print_tts`. Without this change, that would result in much uglier output for code produced by decl macro expansions. With this change, AST pretty printing and `print_tts` produce similar results. The commit also tweaks the comments on `proc_macro::Spacing`. In particular, it refers to "compound tokens" rather than "multi-char operators" because lifetimes aren't operators.
2023-08-07 20:43:44 -05:00
{ #![print_target_and_args(mod_third)] #![print_target_and_args(mod_fourth)] }
PRINT-ATTR DEEP-RE-COLLECTED (DISPLAY): mod inline_mod
{
#! [print_target_and_args(mod_third)] #!
[print_target_and_args(mod_fourth)]
}
PRINT-ATTR INPUT (DEBUG): TokenStream [
Ident {
ident: "mod",
span: $DIR/inner-attrs.rs:27:1: 27:4 (#0),
},
Ident {
ident: "inline_mod",
span: $DIR/inner-attrs.rs:27:5: 27:15 (#0),
},
Group {
delimiter: Brace,
stream: TokenStream [
Punct {
ch: '#',
spacing: Joint,
span: $DIR/inner-attrs.rs:28:5: 28:6 (#0),
},
Punct {
ch: '!',
spacing: Alone,
span: $DIR/inner-attrs.rs:28:6: 28:7 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "print_target_and_args",
span: $DIR/inner-attrs.rs:28:8: 28:29 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "mod_third",
span: $DIR/inner-attrs.rs:28:30: 28:39 (#0),
},
],
span: $DIR/inner-attrs.rs:28:29: 28:40 (#0),
},
],
span: $DIR/inner-attrs.rs:28:7: 28:41 (#0),
},
Punct {
ch: '#',
spacing: Joint,
span: $DIR/inner-attrs.rs:29:5: 29:6 (#0),
},
Punct {
ch: '!',
spacing: Alone,
span: $DIR/inner-attrs.rs:29:6: 29:7 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "print_target_and_args",
span: $DIR/inner-attrs.rs:29:8: 29:29 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "mod_fourth",
span: $DIR/inner-attrs.rs:29:30: 29:40 (#0),
},
],
span: $DIR/inner-attrs.rs:29:29: 29:41 (#0),
},
],
span: $DIR/inner-attrs.rs:29:7: 29:42 (#0),
},
],
span: $DIR/inner-attrs.rs:27:16: 30:2 (#0),
},
]
PRINT-ATTR_ARGS INPUT (DISPLAY): mod_third
PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
Ident {
ident: "mod_third",
span: $DIR/inner-attrs.rs:28:30: 28:39 (#0),
},
]
Improve `print_tts` by changing `tokenstream::Spacing`. `tokenstream::Spacing` appears on all `TokenTree::Token` instances, both punct and non-punct. Its current usage: - `Joint` means "can join with the next token *and* that token is a punct". - `Alone` means "cannot join with the next token *or* can join with the next token but that token is not a punct". The fact that `Alone` is used for two different cases is awkward. This commit augments `tokenstream::Spacing` with a new variant `JointHidden`, resulting in: - `Joint` means "can join with the next token *and* that token is a punct". - `JointHidden` means "can join with the next token *and* that token is a not a punct". - `Alone` means "cannot join with the next token". This *drastically* improves the output of `print_tts`. For example, this: ``` stringify!(let a: Vec<u32> = vec![];) ``` currently produces this string: ``` let a : Vec < u32 > = vec! [] ; ``` With this PR, it now produces this string: ``` let a: Vec<u32> = vec![] ; ``` (The space after the `]` is because `TokenTree::Delimited` currently doesn't have spacing information. The subsequent commit fixes this.) The new `print_tts` doesn't replicate original code perfectly. E.g. multiple space characters will be condensed into a single space character. But it's much improved. `print_tts` still produces the old, uglier output for code produced by proc macros. Because we have to translate the generated code from `proc_macro::Spacing` to the more expressive `token::Spacing`, which results in too much `proc_macro::Along` usage and no `proc_macro::JointHidden` usage. So `space_between` still exists and is used by `print_tts` in conjunction with the `Spacing` field. This change will also help with the removal of `Token::Interpolated`. Currently interpolated tokens are pretty-printed nicely via AST pretty printing. `Token::Interpolated` removal will mean they get printed with `print_tts`. Without this change, that would result in much uglier output for code produced by decl macro expansions. With this change, AST pretty printing and `print_tts` produce similar results. The commit also tweaks the comments on `proc_macro::Spacing`. In particular, it refers to "compound tokens" rather than "multi-char operators" because lifetimes aren't operators.
2023-08-07 20:43:44 -05:00
PRINT-ATTR INPUT (DISPLAY): mod inline_mod { #![print_target_and_args(mod_fourth)] }
PRINT-ATTR DEEP-RE-COLLECTED (DISPLAY): mod inline_mod { #! [print_target_and_args(mod_fourth)] }
PRINT-ATTR INPUT (DEBUG): TokenStream [
Ident {
ident: "mod",
span: $DIR/inner-attrs.rs:27:1: 27:4 (#0),
},
Ident {
ident: "inline_mod",
span: $DIR/inner-attrs.rs:27:5: 27:15 (#0),
},
Group {
delimiter: Brace,
stream: TokenStream [
Punct {
ch: '#',
spacing: Joint,
span: $DIR/inner-attrs.rs:29:5: 29:6 (#0),
},
Punct {
ch: '!',
spacing: Alone,
span: $DIR/inner-attrs.rs:29:6: 29:7 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "print_target_and_args",
span: $DIR/inner-attrs.rs:29:8: 29:29 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "mod_fourth",
span: $DIR/inner-attrs.rs:29:30: 29:40 (#0),
},
],
span: $DIR/inner-attrs.rs:29:29: 29:41 (#0),
},
],
span: $DIR/inner-attrs.rs:29:7: 29:42 (#0),
},
],
span: $DIR/inner-attrs.rs:27:16: 30:2 (#0),
},
]
PRINT-ATTR_ARGS INPUT (DISPLAY): mod_fourth
PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
Ident {
ident: "mod_fourth",
span: $DIR/inner-attrs.rs:29:30: 29:40 (#0),
},
]
2021-12-01 13:45:14 -06:00
PRINT-ATTR INPUT (DISPLAY): mod inline_mod {}
PRINT-ATTR INPUT (DEBUG): TokenStream [
Ident {
ident: "mod",
span: $DIR/inner-attrs.rs:27:1: 27:4 (#0),
},
Ident {
ident: "inline_mod",
span: $DIR/inner-attrs.rs:27:5: 27:15 (#0),
},
Group {
delimiter: Brace,
stream: TokenStream [],
span: $DIR/inner-attrs.rs:27:16: 30:2 (#0),
},
]
PRINT-DERIVE INPUT (DISPLAY): struct MyDerivePrint
{ field: [u8; { match true { _ => { #![rustc_dummy(third)] true } }; 0 }] }
Improve `print_tts` by changing `tokenstream::Spacing`. `tokenstream::Spacing` appears on all `TokenTree::Token` instances, both punct and non-punct. Its current usage: - `Joint` means "can join with the next token *and* that token is a punct". - `Alone` means "cannot join with the next token *or* can join with the next token but that token is not a punct". The fact that `Alone` is used for two different cases is awkward. This commit augments `tokenstream::Spacing` with a new variant `JointHidden`, resulting in: - `Joint` means "can join with the next token *and* that token is a punct". - `JointHidden` means "can join with the next token *and* that token is a not a punct". - `Alone` means "cannot join with the next token". This *drastically* improves the output of `print_tts`. For example, this: ``` stringify!(let a: Vec<u32> = vec![];) ``` currently produces this string: ``` let a : Vec < u32 > = vec! [] ; ``` With this PR, it now produces this string: ``` let a: Vec<u32> = vec![] ; ``` (The space after the `]` is because `TokenTree::Delimited` currently doesn't have spacing information. The subsequent commit fixes this.) The new `print_tts` doesn't replicate original code perfectly. E.g. multiple space characters will be condensed into a single space character. But it's much improved. `print_tts` still produces the old, uglier output for code produced by proc macros. Because we have to translate the generated code from `proc_macro::Spacing` to the more expressive `token::Spacing`, which results in too much `proc_macro::Along` usage and no `proc_macro::JointHidden` usage. So `space_between` still exists and is used by `print_tts` in conjunction with the `Spacing` field. This change will also help with the removal of `Token::Interpolated`. Currently interpolated tokens are pretty-printed nicely via AST pretty printing. `Token::Interpolated` removal will mean they get printed with `print_tts`. Without this change, that would result in much uglier output for code produced by decl macro expansions. With this change, AST pretty printing and `print_tts` produce similar results. The commit also tweaks the comments on `proc_macro::Spacing`. In particular, it refers to "compound tokens" rather than "multi-char operators" because lifetimes aren't operators.
2023-08-07 20:43:44 -05:00
PRINT-DERIVE DEEP-RE-COLLECTED (DISPLAY): struct MyDerivePrint
{ field : [u8; { match true { _ => { #! [rustc_dummy(third)] true } }; 0 }] }
PRINT-DERIVE INPUT (DEBUG): TokenStream [
Ident {
ident: "struct",
span: $DIR/inner-attrs.rs:37:1: 37:7 (#0),
},
Ident {
ident: "MyDerivePrint",
span: $DIR/inner-attrs.rs:37:8: 37:21 (#0),
},
Group {
delimiter: Brace,
stream: TokenStream [
Ident {
ident: "field",
span: $DIR/inner-attrs.rs:38:5: 38:10 (#0),
},
Punct {
ch: ':',
spacing: Alone,
span: $DIR/inner-attrs.rs:38:10: 38:11 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "u8",
span: $DIR/inner-attrs.rs:38:13: 38:15 (#0),
},
Punct {
ch: ';',
spacing: Alone,
span: $DIR/inner-attrs.rs:38:15: 38:16 (#0),
},
Group {
delimiter: Brace,
stream: TokenStream [
Ident {
ident: "match",
span: $DIR/inner-attrs.rs:39:9: 39:14 (#0),
},
Ident {
ident: "true",
span: $DIR/inner-attrs.rs:39:15: 39:19 (#0),
},
Group {
delimiter: Brace,
stream: TokenStream [
Ident {
ident: "_",
span: $DIR/inner-attrs.rs:40:13: 40:14 (#0),
},
Punct {
ch: '=',
spacing: Joint,
span: $DIR/inner-attrs.rs:40:15: 40:16 (#0),
},
Punct {
ch: '>',
spacing: Alone,
span: $DIR/inner-attrs.rs:40:16: 40:17 (#0),
},
Group {
delimiter: Brace,
stream: TokenStream [
Implement token-based handling of attributes during expansion This PR modifies the macro expansion infrastructure to handle attributes in a fully token-based manner. As a result: * Derives macros no longer lose spans when their input is modified by eager cfg-expansion. This is accomplished by performing eager cfg-expansion on the token stream that we pass to the derive proc-macro * Inner attributes now preserve spans in all cases, including when we have multiple inner attributes in a row. This is accomplished through the following changes: * New structs `AttrAnnotatedTokenStream` and `AttrAnnotatedTokenTree` are introduced. These are very similar to a normal `TokenTree`, but they also track the position of attributes and attribute targets within the stream. They are built when we collect tokens during parsing. An `AttrAnnotatedTokenStream` is converted to a regular `TokenStream` when we invoke a macro. * Token capturing and `LazyTokenStream` are modified to work with `AttrAnnotatedTokenStream`. A new `ReplaceRange` type is introduced, which is created during the parsing of a nested AST node to make the 'outer' AST node aware of the attributes and attribute target stored deeper in the token stream. * When we need to perform eager cfg-expansion (either due to `#[derive]` or `#[cfg_eval]`), we tokenize and reparse our target, capturing additional information about the locations of `#[cfg]` and `#[cfg_attr]` attributes at any depth within the target. This is a performance optimization, allowing us to perform less work in the typical case where captured tokens never have eager cfg-expansion run.
2020-11-28 17:33:17 -06:00
Punct {
ch: '#',
Improve `print_tts` by changing `tokenstream::Spacing`. `tokenstream::Spacing` appears on all `TokenTree::Token` instances, both punct and non-punct. Its current usage: - `Joint` means "can join with the next token *and* that token is a punct". - `Alone` means "cannot join with the next token *or* can join with the next token but that token is not a punct". The fact that `Alone` is used for two different cases is awkward. This commit augments `tokenstream::Spacing` with a new variant `JointHidden`, resulting in: - `Joint` means "can join with the next token *and* that token is a punct". - `JointHidden` means "can join with the next token *and* that token is a not a punct". - `Alone` means "cannot join with the next token". This *drastically* improves the output of `print_tts`. For example, this: ``` stringify!(let a: Vec<u32> = vec![];) ``` currently produces this string: ``` let a : Vec < u32 > = vec! [] ; ``` With this PR, it now produces this string: ``` let a: Vec<u32> = vec![] ; ``` (The space after the `]` is because `TokenTree::Delimited` currently doesn't have spacing information. The subsequent commit fixes this.) The new `print_tts` doesn't replicate original code perfectly. E.g. multiple space characters will be condensed into a single space character. But it's much improved. `print_tts` still produces the old, uglier output for code produced by proc macros. Because we have to translate the generated code from `proc_macro::Spacing` to the more expressive `token::Spacing`, which results in too much `proc_macro::Along` usage and no `proc_macro::JointHidden` usage. So `space_between` still exists and is used by `print_tts` in conjunction with the `Spacing` field. This change will also help with the removal of `Token::Interpolated`. Currently interpolated tokens are pretty-printed nicely via AST pretty printing. `Token::Interpolated` removal will mean they get printed with `print_tts`. Without this change, that would result in much uglier output for code produced by decl macro expansions. With this change, AST pretty printing and `print_tts` produce similar results. The commit also tweaks the comments on `proc_macro::Spacing`. In particular, it refers to "compound tokens" rather than "multi-char operators" because lifetimes aren't operators.
2023-08-07 20:43:44 -05:00
spacing: Joint,
span: $DIR/inner-attrs.rs:41:17: 41:18 (#0),
Implement token-based handling of attributes during expansion This PR modifies the macro expansion infrastructure to handle attributes in a fully token-based manner. As a result: * Derives macros no longer lose spans when their input is modified by eager cfg-expansion. This is accomplished by performing eager cfg-expansion on the token stream that we pass to the derive proc-macro * Inner attributes now preserve spans in all cases, including when we have multiple inner attributes in a row. This is accomplished through the following changes: * New structs `AttrAnnotatedTokenStream` and `AttrAnnotatedTokenTree` are introduced. These are very similar to a normal `TokenTree`, but they also track the position of attributes and attribute targets within the stream. They are built when we collect tokens during parsing. An `AttrAnnotatedTokenStream` is converted to a regular `TokenStream` when we invoke a macro. * Token capturing and `LazyTokenStream` are modified to work with `AttrAnnotatedTokenStream`. A new `ReplaceRange` type is introduced, which is created during the parsing of a nested AST node to make the 'outer' AST node aware of the attributes and attribute target stored deeper in the token stream. * When we need to perform eager cfg-expansion (either due to `#[derive]` or `#[cfg_eval]`), we tokenize and reparse our target, capturing additional information about the locations of `#[cfg]` and `#[cfg_attr]` attributes at any depth within the target. This is a performance optimization, allowing us to perform less work in the typical case where captured tokens never have eager cfg-expansion run.
2020-11-28 17:33:17 -06:00
},
Punct {
ch: '!',
spacing: Alone,
span: $DIR/inner-attrs.rs:41:18: 41:19 (#0),
Implement token-based handling of attributes during expansion This PR modifies the macro expansion infrastructure to handle attributes in a fully token-based manner. As a result: * Derives macros no longer lose spans when their input is modified by eager cfg-expansion. This is accomplished by performing eager cfg-expansion on the token stream that we pass to the derive proc-macro * Inner attributes now preserve spans in all cases, including when we have multiple inner attributes in a row. This is accomplished through the following changes: * New structs `AttrAnnotatedTokenStream` and `AttrAnnotatedTokenTree` are introduced. These are very similar to a normal `TokenTree`, but they also track the position of attributes and attribute targets within the stream. They are built when we collect tokens during parsing. An `AttrAnnotatedTokenStream` is converted to a regular `TokenStream` when we invoke a macro. * Token capturing and `LazyTokenStream` are modified to work with `AttrAnnotatedTokenStream`. A new `ReplaceRange` type is introduced, which is created during the parsing of a nested AST node to make the 'outer' AST node aware of the attributes and attribute target stored deeper in the token stream. * When we need to perform eager cfg-expansion (either due to `#[derive]` or `#[cfg_eval]`), we tokenize and reparse our target, capturing additional information about the locations of `#[cfg]` and `#[cfg_attr]` attributes at any depth within the target. This is a performance optimization, allowing us to perform less work in the typical case where captured tokens never have eager cfg-expansion run.
2020-11-28 17:33:17 -06:00
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "rustc_dummy",
span: $DIR/inner-attrs.rs:41:41: 41:52 (#0),
Implement token-based handling of attributes during expansion This PR modifies the macro expansion infrastructure to handle attributes in a fully token-based manner. As a result: * Derives macros no longer lose spans when their input is modified by eager cfg-expansion. This is accomplished by performing eager cfg-expansion on the token stream that we pass to the derive proc-macro * Inner attributes now preserve spans in all cases, including when we have multiple inner attributes in a row. This is accomplished through the following changes: * New structs `AttrAnnotatedTokenStream` and `AttrAnnotatedTokenTree` are introduced. These are very similar to a normal `TokenTree`, but they also track the position of attributes and attribute targets within the stream. They are built when we collect tokens during parsing. An `AttrAnnotatedTokenStream` is converted to a regular `TokenStream` when we invoke a macro. * Token capturing and `LazyTokenStream` are modified to work with `AttrAnnotatedTokenStream`. A new `ReplaceRange` type is introduced, which is created during the parsing of a nested AST node to make the 'outer' AST node aware of the attributes and attribute target stored deeper in the token stream. * When we need to perform eager cfg-expansion (either due to `#[derive]` or `#[cfg_eval]`), we tokenize and reparse our target, capturing additional information about the locations of `#[cfg]` and `#[cfg_attr]` attributes at any depth within the target. This is a performance optimization, allowing us to perform less work in the typical case where captured tokens never have eager cfg-expansion run.
2020-11-28 17:33:17 -06:00
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "third",
span: $DIR/inner-attrs.rs:41:53: 41:58 (#0),
Implement token-based handling of attributes during expansion This PR modifies the macro expansion infrastructure to handle attributes in a fully token-based manner. As a result: * Derives macros no longer lose spans when their input is modified by eager cfg-expansion. This is accomplished by performing eager cfg-expansion on the token stream that we pass to the derive proc-macro * Inner attributes now preserve spans in all cases, including when we have multiple inner attributes in a row. This is accomplished through the following changes: * New structs `AttrAnnotatedTokenStream` and `AttrAnnotatedTokenTree` are introduced. These are very similar to a normal `TokenTree`, but they also track the position of attributes and attribute targets within the stream. They are built when we collect tokens during parsing. An `AttrAnnotatedTokenStream` is converted to a regular `TokenStream` when we invoke a macro. * Token capturing and `LazyTokenStream` are modified to work with `AttrAnnotatedTokenStream`. A new `ReplaceRange` type is introduced, which is created during the parsing of a nested AST node to make the 'outer' AST node aware of the attributes and attribute target stored deeper in the token stream. * When we need to perform eager cfg-expansion (either due to `#[derive]` or `#[cfg_eval]`), we tokenize and reparse our target, capturing additional information about the locations of `#[cfg]` and `#[cfg_attr]` attributes at any depth within the target. This is a performance optimization, allowing us to perform less work in the typical case where captured tokens never have eager cfg-expansion run.
2020-11-28 17:33:17 -06:00
},
],
span: $DIR/inner-attrs.rs:41:52: 41:59 (#0),
Implement token-based handling of attributes during expansion This PR modifies the macro expansion infrastructure to handle attributes in a fully token-based manner. As a result: * Derives macros no longer lose spans when their input is modified by eager cfg-expansion. This is accomplished by performing eager cfg-expansion on the token stream that we pass to the derive proc-macro * Inner attributes now preserve spans in all cases, including when we have multiple inner attributes in a row. This is accomplished through the following changes: * New structs `AttrAnnotatedTokenStream` and `AttrAnnotatedTokenTree` are introduced. These are very similar to a normal `TokenTree`, but they also track the position of attributes and attribute targets within the stream. They are built when we collect tokens during parsing. An `AttrAnnotatedTokenStream` is converted to a regular `TokenStream` when we invoke a macro. * Token capturing and `LazyTokenStream` are modified to work with `AttrAnnotatedTokenStream`. A new `ReplaceRange` type is introduced, which is created during the parsing of a nested AST node to make the 'outer' AST node aware of the attributes and attribute target stored deeper in the token stream. * When we need to perform eager cfg-expansion (either due to `#[derive]` or `#[cfg_eval]`), we tokenize and reparse our target, capturing additional information about the locations of `#[cfg]` and `#[cfg_attr]` attributes at any depth within the target. This is a performance optimization, allowing us to perform less work in the typical case where captured tokens never have eager cfg-expansion run.
2020-11-28 17:33:17 -06:00
},
],
span: $DIR/inner-attrs.rs:41:17: 41:18 (#0),
Implement token-based handling of attributes during expansion This PR modifies the macro expansion infrastructure to handle attributes in a fully token-based manner. As a result: * Derives macros no longer lose spans when their input is modified by eager cfg-expansion. This is accomplished by performing eager cfg-expansion on the token stream that we pass to the derive proc-macro * Inner attributes now preserve spans in all cases, including when we have multiple inner attributes in a row. This is accomplished through the following changes: * New structs `AttrAnnotatedTokenStream` and `AttrAnnotatedTokenTree` are introduced. These are very similar to a normal `TokenTree`, but they also track the position of attributes and attribute targets within the stream. They are built when we collect tokens during parsing. An `AttrAnnotatedTokenStream` is converted to a regular `TokenStream` when we invoke a macro. * Token capturing and `LazyTokenStream` are modified to work with `AttrAnnotatedTokenStream`. A new `ReplaceRange` type is introduced, which is created during the parsing of a nested AST node to make the 'outer' AST node aware of the attributes and attribute target stored deeper in the token stream. * When we need to perform eager cfg-expansion (either due to `#[derive]` or `#[cfg_eval]`), we tokenize and reparse our target, capturing additional information about the locations of `#[cfg]` and `#[cfg_attr]` attributes at any depth within the target. This is a performance optimization, allowing us to perform less work in the typical case where captured tokens never have eager cfg-expansion run.
2020-11-28 17:33:17 -06:00
},
Ident {
ident: "true",
span: $DIR/inner-attrs.rs:42:17: 42:21 (#0),
},
],
span: $DIR/inner-attrs.rs:40:18: 43:14 (#0),
},
],
span: $DIR/inner-attrs.rs:39:20: 44:10 (#0),
},
Punct {
ch: ';',
spacing: Alone,
span: $DIR/inner-attrs.rs:44:10: 44:11 (#0),
},
Literal {
kind: Integer,
symbol: "0",
suffix: None,
span: $DIR/inner-attrs.rs:45:9: 45:10 (#0),
},
],
span: $DIR/inner-attrs.rs:38:17: 46:6 (#0),
},
],
span: $DIR/inner-attrs.rs:38:12: 46:7 (#0),
},
],
span: $DIR/inner-attrs.rs:37:22: 47:2 (#0),
},
]
PRINT-ATTR_ARGS INPUT (DISPLAY): tuple_attrs
PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
Ident {
ident: "tuple_attrs",
span: $DIR/inner-attrs.rs:50:29: 50:40 (#0),
},
]
PRINT-ATTR INPUT (DISPLAY): (3, 4, { #![cfg_attr(not(FALSE), rustc_dummy(innermost))] 5 });
PRINT-ATTR DEEP-RE-COLLECTED (DISPLAY): (3, 4, { #! [cfg_attr(not(FALSE), rustc_dummy(innermost))] 5 });
PRINT-ATTR INPUT (DEBUG): TokenStream [
Group {
delimiter: Parenthesis,
stream: TokenStream [
Literal {
kind: Integer,
symbol: "3",
suffix: None,
span: $DIR/inner-attrs.rs:51:9: 51:10 (#0),
},
Punct {
ch: ',',
spacing: Alone,
span: $DIR/inner-attrs.rs:51:10: 51:11 (#0),
},
Literal {
kind: Integer,
symbol: "4",
suffix: None,
span: $DIR/inner-attrs.rs:51:12: 51:13 (#0),
},
Punct {
ch: ',',
spacing: Alone,
span: $DIR/inner-attrs.rs:51:13: 51:14 (#0),
},
Group {
delimiter: Brace,
stream: TokenStream [
Punct {
ch: '#',
spacing: Joint,
span: $DIR/inner-attrs.rs:52:13: 52:14 (#0),
},
Punct {
ch: '!',
spacing: Alone,
span: $DIR/inner-attrs.rs:52:14: 52:15 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg_attr",
span: $DIR/inner-attrs.rs:52:16: 52:24 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "not",
span: $DIR/inner-attrs.rs:52:25: 52:28 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
span: $DIR/inner-attrs.rs:52:29: 52:34 (#0),
},
],
span: $DIR/inner-attrs.rs:52:28: 52:35 (#0),
},
Punct {
ch: ',',
spacing: Alone,
span: $DIR/inner-attrs.rs:52:35: 52:36 (#0),
},
Ident {
ident: "rustc_dummy",
span: $DIR/inner-attrs.rs:52:37: 52:48 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "innermost",
span: $DIR/inner-attrs.rs:52:49: 52:58 (#0),
},
],
span: $DIR/inner-attrs.rs:52:48: 52:59 (#0),
},
],
span: $DIR/inner-attrs.rs:52:24: 52:60 (#0),
},
],
span: $DIR/inner-attrs.rs:52:15: 52:61 (#0),
},
Literal {
kind: Integer,
symbol: "5",
suffix: None,
span: $DIR/inner-attrs.rs:53:13: 53:14 (#0),
},
],
span: $DIR/inner-attrs.rs:51:15: 54:10 (#0),
},
],
span: $DIR/inner-attrs.rs:50:43: 55:6 (#0),
},
Punct {
ch: ';',
spacing: Alone,
span: $DIR/inner-attrs.rs:55:6: 55:7 (#0),
},
]
PRINT-ATTR_ARGS INPUT (DISPLAY): tuple_attrs
2021-02-28 13:51:44 -06:00
PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
Ident {
ident: "tuple_attrs",
span: $DIR/inner-attrs.rs:57:29: 57:40 (#0),
2021-02-28 13:51:44 -06:00
},
]
PRINT-ATTR INPUT (DISPLAY): (3, 4, { #![cfg_attr(not(FALSE), rustc_dummy(innermost))] 5 });
PRINT-ATTR DEEP-RE-COLLECTED (DISPLAY): (3, 4, { #! [cfg_attr(not(FALSE), rustc_dummy(innermost))] 5 });
2021-02-28 13:51:44 -06:00
PRINT-ATTR INPUT (DEBUG): TokenStream [
Group {
delimiter: Parenthesis,
stream: TokenStream [
Literal {
kind: Integer,
symbol: "3",
2021-02-28 13:51:44 -06:00
suffix: None,
span: $DIR/inner-attrs.rs:58:9: 58:10 (#0),
2021-02-28 13:51:44 -06:00
},
Punct {
ch: ',',
spacing: Alone,
span: $DIR/inner-attrs.rs:58:10: 58:11 (#0),
2021-02-28 13:51:44 -06:00
},
Literal {
kind: Integer,
symbol: "4",
2021-02-28 13:51:44 -06:00
suffix: None,
span: $DIR/inner-attrs.rs:58:12: 58:13 (#0),
2021-02-28 13:51:44 -06:00
},
Punct {
ch: ',',
2021-02-28 13:51:44 -06:00
spacing: Alone,
span: $DIR/inner-attrs.rs:58:13: 58:14 (#0),
2021-02-28 13:51:44 -06:00
},
Group {
delimiter: Brace,
stream: TokenStream [
Punct {
ch: '#',
spacing: Joint,
span: $DIR/inner-attrs.rs:59:13: 59:14 (#0),
},
Punct {
ch: '!',
spacing: Alone,
span: $DIR/inner-attrs.rs:59:14: 59:15 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg_attr",
span: $DIR/inner-attrs.rs:59:16: 59:24 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "not",
span: $DIR/inner-attrs.rs:59:25: 59:28 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
span: $DIR/inner-attrs.rs:59:29: 59:34 (#0),
},
],
span: $DIR/inner-attrs.rs:59:28: 59:35 (#0),
},
Punct {
ch: ',',
spacing: Alone,
span: $DIR/inner-attrs.rs:59:35: 59:36 (#0),
},
Ident {
ident: "rustc_dummy",
span: $DIR/inner-attrs.rs:59:37: 59:48 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "innermost",
span: $DIR/inner-attrs.rs:59:49: 59:58 (#0),
},
],
span: $DIR/inner-attrs.rs:59:48: 59:59 (#0),
},
],
span: $DIR/inner-attrs.rs:59:24: 59:60 (#0),
},
],
span: $DIR/inner-attrs.rs:59:15: 59:61 (#0),
},
Literal {
kind: Integer,
symbol: "5",
suffix: None,
span: $DIR/inner-attrs.rs:60:13: 60:14 (#0),
},
],
span: $DIR/inner-attrs.rs:58:15: 61:10 (#0),
2021-02-28 13:51:44 -06:00
},
],
span: $DIR/inner-attrs.rs:57:43: 62:6 (#0),
2021-02-28 13:51:44 -06:00
},
Punct {
ch: ';',
spacing: Alone,
span: $DIR/inner-attrs.rs:62:6: 62:7 (#0),
2021-02-28 13:51:44 -06:00
},
]
PRINT-ATTR_ARGS INPUT (DISPLAY): tenth
PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
Ident {
ident: "tenth",
span: $DIR/inner-attrs.rs:84:42: 84:47 (#0),
2021-02-28 13:51:44 -06:00
},
]
2021-12-01 13:45:14 -06:00
PRINT-ATTR INPUT (DISPLAY): fn weird_extern() {}
2021-02-28 13:51:44 -06:00
PRINT-ATTR INPUT (DEBUG): TokenStream [
Ident {
ident: "fn",
span: $DIR/inner-attrs.rs:83:5: 83:7 (#0),
2021-02-28 13:51:44 -06:00
},
Ident {
ident: "weird_extern",
span: $DIR/inner-attrs.rs:83:8: 83:20 (#0),
2021-02-28 13:51:44 -06:00
},
Group {
delimiter: Parenthesis,
stream: TokenStream [],
span: $DIR/inner-attrs.rs:83:20: 83:22 (#0),
2021-02-28 13:51:44 -06:00
},
Group {
delimiter: Brace,
stream: TokenStream [],
span: $DIR/inner-attrs.rs:83:23: 85:6 (#0),
2021-02-28 13:51:44 -06:00
},
]