Tweak tests/ui/proc-macro/macro-rules-derive-cfg.rs
.
- Trim some unnecessary fat from the type declaration. - Add another attribute, to make it a stronger test of `cfg_attr` processing. Note that the current output is incorrect, because it duplicates the added attribute. The next commit will fix this.
This commit is contained in:
parent
39b38a94e3
commit
b7e7f6e903
@ -14,17 +14,15 @@
|
||||
macro_rules! produce_it {
|
||||
($expr:expr) => {
|
||||
#[derive(Print)]
|
||||
struct Foo {
|
||||
val: [bool; {
|
||||
let a = #[cfg_attr(not(FALSE), rustc_dummy(first))] $expr;
|
||||
0
|
||||
}]
|
||||
}
|
||||
struct Foo(
|
||||
[bool; #[cfg_attr(not(FALSE), rustc_dummy(first))] $expr]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
produce_it!(#[cfg_attr(not(FALSE), rustc_dummy(second))] {
|
||||
#![cfg_attr(not(FALSE), allow(unused))]
|
||||
#![cfg_attr(not(FALSE), rustc_dummy(third))]
|
||||
#[cfg_attr(not(FALSE), rustc_dummy(fourth))]
|
||||
30
|
||||
});
|
||||
|
||||
|
@ -1,21 +1,11 @@
|
||||
PRINT-DERIVE INPUT (DISPLAY): struct Foo
|
||||
PRINT-DERIVE INPUT (DISPLAY): struct
|
||||
Foo([bool; #[rustc_dummy(first)] #[rustc_dummy(second)]
|
||||
{ #![rustc_dummy(third)] #[rustc_dummy(fourth)] #[rustc_dummy(fourth)] 30 }]);
|
||||
PRINT-DERIVE DEEP-RE-COLLECTED (DISPLAY): struct
|
||||
Foo([bool; #[rustc_dummy(first)] #[rustc_dummy(second)]
|
||||
{
|
||||
val :
|
||||
[bool;
|
||||
{
|
||||
let a = #[rustc_dummy(first)] #[rustc_dummy(second)]
|
||||
{ #![allow(unused)] 30 }; 0
|
||||
}]
|
||||
}
|
||||
PRINT-DERIVE DEEP-RE-COLLECTED (DISPLAY): struct Foo
|
||||
{
|
||||
val :
|
||||
[bool;
|
||||
{
|
||||
let a = #[rustc_dummy(first)] #[rustc_dummy(second)]
|
||||
{ #! [allow(unused)] 30 }; 0
|
||||
}]
|
||||
}
|
||||
#! [rustc_dummy(third)] #[rustc_dummy(fourth)] #[rustc_dummy(fourth)] 30
|
||||
}]);
|
||||
PRINT-DERIVE INPUT (DEBUG): TokenStream [
|
||||
Ident {
|
||||
ident: "struct",
|
||||
@ -26,155 +16,171 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [
|
||||
span: $DIR/macro-rules-derive-cfg.rs:17:16: 17:19 (#3),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "val",
|
||||
span: $DIR/macro-rules-derive-cfg.rs:18:13: 18:16 (#3),
|
||||
},
|
||||
Punct {
|
||||
ch: ':',
|
||||
spacing: Alone,
|
||||
span: $DIR/macro-rules-derive-cfg.rs:18:16: 18:17 (#3),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "bool",
|
||||
span: $DIR/macro-rules-derive-cfg.rs:18:19: 18:23 (#3),
|
||||
span: $DIR/macro-rules-derive-cfg.rs:18:14: 18:18 (#3),
|
||||
},
|
||||
Punct {
|
||||
ch: ';',
|
||||
spacing: Alone,
|
||||
span: $DIR/macro-rules-derive-cfg.rs:18:23: 18:24 (#3),
|
||||
span: $DIR/macro-rules-derive-cfg.rs:18:18: 18:19 (#3),
|
||||
},
|
||||
Punct {
|
||||
ch: '#',
|
||||
spacing: Alone,
|
||||
span: $DIR/macro-rules-derive-cfg.rs:18:20: 18:21 (#3),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "rustc_dummy",
|
||||
span: $DIR/macro-rules-derive-cfg.rs:18:43: 18:54 (#3),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "first",
|
||||
span: $DIR/macro-rules-derive-cfg.rs:18:55: 18:60 (#3),
|
||||
},
|
||||
],
|
||||
span: $DIR/macro-rules-derive-cfg.rs:18:54: 18:61 (#3),
|
||||
},
|
||||
],
|
||||
span: $DIR/macro-rules-derive-cfg.rs:18:21: 18:63 (#3),
|
||||
},
|
||||
Punct {
|
||||
ch: '#',
|
||||
spacing: Alone,
|
||||
span: $DIR/macro-rules-derive-cfg.rs:23:13: 23:14 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "rustc_dummy",
|
||||
span: $DIR/macro-rules-derive-cfg.rs:23:36: 23:47 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "second",
|
||||
span: $DIR/macro-rules-derive-cfg.rs:23:48: 23:54 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/macro-rules-derive-cfg.rs:23:47: 23:55 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/macro-rules-derive-cfg.rs:23:14: 23:57 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "let",
|
||||
span: $DIR/macro-rules-derive-cfg.rs:19:17: 19:20 (#3),
|
||||
},
|
||||
Ident {
|
||||
ident: "a",
|
||||
span: $DIR/macro-rules-derive-cfg.rs:19:21: 19:22 (#3),
|
||||
},
|
||||
Punct {
|
||||
ch: '=',
|
||||
spacing: Alone,
|
||||
span: $DIR/macro-rules-derive-cfg.rs:19:23: 19:24 (#3),
|
||||
},
|
||||
Punct {
|
||||
ch: '#',
|
||||
spacing: Joint,
|
||||
span: $DIR/macro-rules-derive-cfg.rs:24:5: 24:6 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '!',
|
||||
spacing: Alone,
|
||||
span: $DIR/macro-rules-derive-cfg.rs:19:25: 19:26 (#3),
|
||||
span: $DIR/macro-rules-derive-cfg.rs:24:6: 24:7 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "rustc_dummy",
|
||||
span: $DIR/macro-rules-derive-cfg.rs:19:48: 19:59 (#3),
|
||||
span: $DIR/macro-rules-derive-cfg.rs:24:29: 24:40 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "first",
|
||||
span: $DIR/macro-rules-derive-cfg.rs:19:60: 19:65 (#3),
|
||||
ident: "third",
|
||||
span: $DIR/macro-rules-derive-cfg.rs:24:41: 24:46 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/macro-rules-derive-cfg.rs:19:59: 19:66 (#3),
|
||||
span: $DIR/macro-rules-derive-cfg.rs:24:40: 24:47 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/macro-rules-derive-cfg.rs:19:26: 19:68 (#3),
|
||||
span: $DIR/macro-rules-derive-cfg.rs:24:7: 24:49 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '#',
|
||||
spacing: Alone,
|
||||
span: $DIR/macro-rules-derive-cfg.rs:26:13: 26:14 (#0),
|
||||
span: $DIR/macro-rules-derive-cfg.rs:25:5: 25:6 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "rustc_dummy",
|
||||
span: $DIR/macro-rules-derive-cfg.rs:26:36: 26:47 (#0),
|
||||
span: $DIR/macro-rules-derive-cfg.rs:25:28: 25:39 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "second",
|
||||
span: $DIR/macro-rules-derive-cfg.rs:26:48: 26:54 (#0),
|
||||
ident: "fourth",
|
||||
span: $DIR/macro-rules-derive-cfg.rs:25:40: 25:46 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/macro-rules-derive-cfg.rs:26:47: 26:55 (#0),
|
||||
span: $DIR/macro-rules-derive-cfg.rs:25:39: 25:47 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/macro-rules-derive-cfg.rs:26:14: 26:57 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [
|
||||
Punct {
|
||||
ch: '#',
|
||||
spacing: Joint,
|
||||
span: $DIR/macro-rules-derive-cfg.rs:27:5: 27:6 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '!',
|
||||
spacing: Alone,
|
||||
span: $DIR/macro-rules-derive-cfg.rs:27:6: 27:7 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "allow",
|
||||
span: $DIR/macro-rules-derive-cfg.rs:27:29: 27:34 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "unused",
|
||||
span: $DIR/macro-rules-derive-cfg.rs:27:35: 27:41 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/macro-rules-derive-cfg.rs:27:34: 27:42 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/macro-rules-derive-cfg.rs:27:7: 27:44 (#0),
|
||||
},
|
||||
Literal {
|
||||
kind: Integer,
|
||||
symbol: "30",
|
||||
suffix: None,
|
||||
span: $DIR/macro-rules-derive-cfg.rs:28:5: 28:7 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/macro-rules-derive-cfg.rs:26:58: 29:2 (#0),
|
||||
span: $DIR/macro-rules-derive-cfg.rs:25:6: 25:49 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: ';',
|
||||
ch: '#',
|
||||
spacing: Alone,
|
||||
span: $DIR/macro-rules-derive-cfg.rs:19:74: 19:75 (#3),
|
||||
span: $DIR/macro-rules-derive-cfg.rs:25:5: 25:6 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "rustc_dummy",
|
||||
span: $DIR/macro-rules-derive-cfg.rs:25:28: 25:39 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "fourth",
|
||||
span: $DIR/macro-rules-derive-cfg.rs:25:40: 25:46 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/macro-rules-derive-cfg.rs:25:39: 25:47 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/macro-rules-derive-cfg.rs:25:6: 25:49 (#0),
|
||||
},
|
||||
Literal {
|
||||
kind: Integer,
|
||||
symbol: "0",
|
||||
symbol: "30",
|
||||
suffix: None,
|
||||
span: $DIR/macro-rules-derive-cfg.rs:20:17: 20:18 (#3),
|
||||
span: $DIR/macro-rules-derive-cfg.rs:26:5: 26:7 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/macro-rules-derive-cfg.rs:18:25: 21:14 (#3),
|
||||
span: $DIR/macro-rules-derive-cfg.rs:23:58: 27:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/macro-rules-derive-cfg.rs:18:18: 21:15 (#3),
|
||||
span: $DIR/macro-rules-derive-cfg.rs:18:13: 18:70 (#3),
|
||||
},
|
||||
],
|
||||
span: $DIR/macro-rules-derive-cfg.rs:17:20: 22:10 (#3),
|
||||
span: $DIR/macro-rules-derive-cfg.rs:17:19: 19:10 (#3),
|
||||
},
|
||||
Punct {
|
||||
ch: ';',
|
||||
spacing: Alone,
|
||||
span: $DIR/macro-rules-derive-cfg.rs:19:10: 19:11 (#3),
|
||||
},
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user