mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 08:44:35 +00:00
Add more proc-macro attribute tests
This commit is contained in:
parent
573a697a61
commit
8aed5b4334
26
src/test/ui/proc-macro/attr-complex-fn.rs
Normal file
26
src/test/ui/proc-macro/attr-complex-fn.rs
Normal file
@ -0,0 +1,26 @@
|
||||
// check-pass
|
||||
// compile-flags: -Z span-debug --error-format human
|
||||
// aux-build:test-macros.rs
|
||||
|
||||
#![feature(stmt_expr_attributes)]
|
||||
#![feature(custom_inner_attributes)]
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
#![no_std] // Don't load unnecessary hygiene information from std
|
||||
extern crate std;
|
||||
|
||||
#[macro_use]
|
||||
extern crate test_macros;
|
||||
|
||||
trait MyTrait<T> {}
|
||||
struct MyStruct<const N: bool>;
|
||||
|
||||
#[print_attr]
|
||||
fn foo<T: MyTrait<MyStruct<{ true }>>>() {}
|
||||
|
||||
impl<T> MyTrait<T> for MyStruct<{true}> {
|
||||
#![print_attr]
|
||||
#![rustc_dummy]
|
||||
}
|
||||
|
||||
fn main() {}
|
171
src/test/ui/proc-macro/attr-complex-fn.stdout
Normal file
171
src/test/ui/proc-macro/attr-complex-fn.stdout
Normal file
@ -0,0 +1,171 @@
|
||||
PRINT-ATTR INPUT (DISPLAY): fn foo < T : MyTrait < MyStruct < { true } >> > () { }
|
||||
PRINT-ATTR INPUT (DEBUG): TokenStream [
|
||||
Ident {
|
||||
ident: "fn",
|
||||
span: $DIR/attr-complex-fn.rs:19:1: 19:3 (#0),
|
||||
},
|
||||
Ident {
|
||||
ident: "foo",
|
||||
span: $DIR/attr-complex-fn.rs:19:4: 19:7 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '<',
|
||||
spacing: Alone,
|
||||
span: $DIR/attr-complex-fn.rs:19:7: 19:8 (#0),
|
||||
},
|
||||
Ident {
|
||||
ident: "T",
|
||||
span: $DIR/attr-complex-fn.rs:19:8: 19:9 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: ':',
|
||||
spacing: Alone,
|
||||
span: $DIR/attr-complex-fn.rs:19:9: 19:10 (#0),
|
||||
},
|
||||
Ident {
|
||||
ident: "MyTrait",
|
||||
span: $DIR/attr-complex-fn.rs:19:11: 19:18 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '<',
|
||||
spacing: Alone,
|
||||
span: $DIR/attr-complex-fn.rs:19:18: 19:19 (#0),
|
||||
},
|
||||
Ident {
|
||||
ident: "MyStruct",
|
||||
span: $DIR/attr-complex-fn.rs:19:19: 19:27 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '<',
|
||||
spacing: Alone,
|
||||
span: $DIR/attr-complex-fn.rs:19:27: 19:28 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "true",
|
||||
span: $DIR/attr-complex-fn.rs:19:30: 19:34 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/attr-complex-fn.rs:19:28: 19:36 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '>',
|
||||
spacing: Joint,
|
||||
span: $DIR/attr-complex-fn.rs:19:36: 19:38 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '>',
|
||||
spacing: Joint,
|
||||
span: $DIR/attr-complex-fn.rs:19:36: 19:38 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '>',
|
||||
spacing: Alone,
|
||||
span: $DIR/attr-complex-fn.rs:19:38: 19:39 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [],
|
||||
span: $DIR/attr-complex-fn.rs:19:39: 19:41 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
stream: 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 (DEBUG): TokenStream [
|
||||
Ident {
|
||||
ident: "impl",
|
||||
span: $DIR/attr-complex-fn.rs:21:1: 24:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '<',
|
||||
spacing: Alone,
|
||||
span: $DIR/attr-complex-fn.rs:21:1: 24:2 (#0),
|
||||
},
|
||||
Ident {
|
||||
ident: "T",
|
||||
span: $DIR/attr-complex-fn.rs:21:1: 24:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '>',
|
||||
spacing: Alone,
|
||||
span: $DIR/attr-complex-fn.rs:21:1: 24:2 (#0),
|
||||
},
|
||||
Ident {
|
||||
ident: "MyTrait",
|
||||
span: $DIR/attr-complex-fn.rs:21:1: 24:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '<',
|
||||
spacing: Alone,
|
||||
span: $DIR/attr-complex-fn.rs:21:1: 24:2 (#0),
|
||||
},
|
||||
Ident {
|
||||
ident: "T",
|
||||
span: $DIR/attr-complex-fn.rs:21:1: 24:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '>',
|
||||
spacing: Alone,
|
||||
span: $DIR/attr-complex-fn.rs:21:1: 24:2 (#0),
|
||||
},
|
||||
Ident {
|
||||
ident: "for",
|
||||
span: $DIR/attr-complex-fn.rs:21:1: 24:2 (#0),
|
||||
},
|
||||
Ident {
|
||||
ident: "MyStruct",
|
||||
span: $DIR/attr-complex-fn.rs:21:1: 24:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '<',
|
||||
spacing: Alone,
|
||||
span: $DIR/attr-complex-fn.rs:21:1: 24:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "true",
|
||||
span: $DIR/attr-complex-fn.rs:21:1: 24:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/attr-complex-fn.rs:21:1: 24:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '>',
|
||||
spacing: Alone,
|
||||
span: $DIR/attr-complex-fn.rs:21:1: 24:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [
|
||||
Punct {
|
||||
ch: '#',
|
||||
spacing: Joint,
|
||||
span: $DIR/attr-complex-fn.rs:21:1: 24:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '!',
|
||||
spacing: Alone,
|
||||
span: $DIR/attr-complex-fn.rs:21:1: 24:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "rustc_dummy",
|
||||
span: $DIR/attr-complex-fn.rs:21:1: 24:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/attr-complex-fn.rs:21:1: 24:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/attr-complex-fn.rs:21:1: 24:2 (#0),
|
||||
},
|
||||
]
|
@ -128,6 +128,20 @@ pub fn print_attr_args(args: TokenStream, input: TokenStream) -> TokenStream {
|
||||
input
|
||||
}
|
||||
|
||||
#[proc_macro_attribute]
|
||||
pub fn print_target_and_args(args: TokenStream, input: TokenStream) -> TokenStream {
|
||||
print_helper(args, "ATTR_ARGS");
|
||||
print_helper(input.clone(), "ATTR");
|
||||
input
|
||||
}
|
||||
|
||||
#[proc_macro_attribute]
|
||||
pub fn print_target_and_args_consume(args: TokenStream, input: TokenStream) -> TokenStream {
|
||||
print_helper(args, "ATTR_ARGS");
|
||||
print_helper(input.clone(), "ATTR");
|
||||
TokenStream::new()
|
||||
}
|
||||
|
||||
#[proc_macro_derive(Print, attributes(print_helper))]
|
||||
pub fn print_derive(input: TokenStream) -> TokenStream {
|
||||
print_helper(input, "DERIVE");
|
||||
|
34
src/test/ui/proc-macro/expand-to-derive.rs
Normal file
34
src/test/ui/proc-macro/expand-to-derive.rs
Normal file
@ -0,0 +1,34 @@
|
||||
// check-pass
|
||||
// compile-flags: -Z span-debug --error-format human
|
||||
// aux-build:test-macros.rs
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
#![no_std] // Don't load unnecessary hygiene information from std
|
||||
extern crate std;
|
||||
|
||||
#[macro_use]
|
||||
extern crate test_macros;
|
||||
|
||||
macro_rules! expand_to_derive {
|
||||
($item:item) => {
|
||||
#[derive(Print)]
|
||||
struct Foo {
|
||||
#[cfg(FALSE)] removed: bool,
|
||||
field: [bool; {
|
||||
$item
|
||||
0
|
||||
}]
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
expand_to_derive! {
|
||||
#[cfg_attr(not(FALSE), rustc_dummy)]
|
||||
struct Inner {
|
||||
#[cfg(FALSE)] removed_inner_field: bool,
|
||||
other_inner_field: u8,
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
109
src/test/ui/proc-macro/expand-to-derive.stdout
Normal file
109
src/test/ui/proc-macro/expand-to-derive.stdout
Normal file
@ -0,0 +1,109 @@
|
||||
PRINT-DERIVE INPUT (DISPLAY): struct Foo
|
||||
{
|
||||
field :
|
||||
[bool ; { #[rustc_dummy] struct Inner { other_inner_field : u8, } 0 }],
|
||||
}
|
||||
PRINT-DERIVE INPUT (DEBUG): TokenStream [
|
||||
Ident {
|
||||
ident: "struct",
|
||||
span: $DIR/expand-to-derive.rs:16:9: 22:10 (#4),
|
||||
},
|
||||
Ident {
|
||||
ident: "Foo",
|
||||
span: $DIR/expand-to-derive.rs:16:9: 22:10 (#4),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "field",
|
||||
span: $DIR/expand-to-derive.rs:16:9: 22:10 (#4),
|
||||
},
|
||||
Punct {
|
||||
ch: ':',
|
||||
spacing: Alone,
|
||||
span: $DIR/expand-to-derive.rs:16:9: 22:10 (#4),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "bool",
|
||||
span: $DIR/expand-to-derive.rs:16:9: 22:10 (#4),
|
||||
},
|
||||
Punct {
|
||||
ch: ';',
|
||||
spacing: Alone,
|
||||
span: $DIR/expand-to-derive.rs:16:9: 22:10 (#4),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [
|
||||
Punct {
|
||||
ch: '#',
|
||||
spacing: Alone,
|
||||
span: $DIR/expand-to-derive.rs:16:9: 22:10 (#4),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "rustc_dummy",
|
||||
span: $DIR/expand-to-derive.rs:16:9: 22:10 (#4),
|
||||
},
|
||||
],
|
||||
span: $DIR/expand-to-derive.rs:16:9: 22:10 (#4),
|
||||
},
|
||||
Ident {
|
||||
ident: "struct",
|
||||
span: $DIR/expand-to-derive.rs:16:9: 22:10 (#4),
|
||||
},
|
||||
Ident {
|
||||
ident: "Inner",
|
||||
span: $DIR/expand-to-derive.rs:16:9: 22:10 (#4),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "other_inner_field",
|
||||
span: $DIR/expand-to-derive.rs:16:9: 22:10 (#4),
|
||||
},
|
||||
Punct {
|
||||
ch: ':',
|
||||
spacing: Alone,
|
||||
span: $DIR/expand-to-derive.rs:16:9: 22:10 (#4),
|
||||
},
|
||||
Ident {
|
||||
ident: "u8",
|
||||
span: $DIR/expand-to-derive.rs:16:9: 22:10 (#4),
|
||||
},
|
||||
Punct {
|
||||
ch: ',',
|
||||
spacing: Alone,
|
||||
span: $DIR/expand-to-derive.rs:16:9: 22:10 (#4),
|
||||
},
|
||||
],
|
||||
span: $DIR/expand-to-derive.rs:16:9: 22:10 (#4),
|
||||
},
|
||||
Literal {
|
||||
kind: Integer,
|
||||
symbol: "0",
|
||||
suffix: None,
|
||||
span: $DIR/expand-to-derive.rs:16:9: 22:10 (#4),
|
||||
},
|
||||
],
|
||||
span: $DIR/expand-to-derive.rs:16:9: 22:10 (#4),
|
||||
},
|
||||
],
|
||||
span: $DIR/expand-to-derive.rs:16:9: 22:10 (#4),
|
||||
},
|
||||
Punct {
|
||||
ch: ',',
|
||||
spacing: Alone,
|
||||
span: $DIR/expand-to-derive.rs:16:9: 22:10 (#4),
|
||||
},
|
||||
],
|
||||
span: $DIR/expand-to-derive.rs:16:9: 22:10 (#4),
|
||||
},
|
||||
]
|
47
src/test/ui/proc-macro/inner-attrs.rs
Normal file
47
src/test/ui/proc-macro/inner-attrs.rs
Normal file
@ -0,0 +1,47 @@
|
||||
// check-pass
|
||||
// compile-flags: -Z span-debug --error-format human
|
||||
// aux-build:test-macros.rs
|
||||
|
||||
#![feature(custom_inner_attributes)]
|
||||
#![feature(proc_macro_hygiene)]
|
||||
#![feature(stmt_expr_attributes)]
|
||||
|
||||
#![no_std] // Don't load unnecessary hygiene information from std
|
||||
extern crate std;
|
||||
|
||||
#[macro_use]
|
||||
extern crate test_macros;
|
||||
|
||||
#[print_target_and_args(first)]
|
||||
#[print_target_and_args(second)]
|
||||
fn foo() {
|
||||
#![print_target_and_args(third)]
|
||||
#![print_target_and_args(fourth)]
|
||||
}
|
||||
|
||||
struct MyStruct {
|
||||
field: bool
|
||||
}
|
||||
|
||||
fn bar() {
|
||||
(#![print_target_and_args(fifth)] 1, 2);
|
||||
|
||||
[#![print_target_and_args(sixth)] 1 , 2];
|
||||
[#![print_target_and_args(seventh)] true ; 5];
|
||||
|
||||
|
||||
match 0 {
|
||||
#![print_target_and_args(eighth)]
|
||||
_ => {}
|
||||
}
|
||||
|
||||
MyStruct { #![print_target_and_args(ninth)] field: true };
|
||||
}
|
||||
|
||||
extern {
|
||||
fn weird_extern() {
|
||||
#![print_target_and_args_consume(tenth)]
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
520
src/test/ui/proc-macro/inner-attrs.stdout
Normal file
520
src/test/ui/proc-macro/inner-attrs.stdout
Normal file
@ -0,0 +1,520 @@
|
||||
PRINT-ATTR_ARGS INPUT (DISPLAY): first
|
||||
PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
|
||||
Ident {
|
||||
ident: "first",
|
||||
span: $DIR/inner-attrs.rs:15:25: 15:30 (#0),
|
||||
},
|
||||
]
|
||||
PRINT-ATTR INPUT (DISPLAY): #[print_target_and_args(second)] fn foo()
|
||||
{ # ! [print_target_and_args(third)] # ! [print_target_and_args(fourth)] }
|
||||
PRINT-ATTR INPUT (DEBUG): TokenStream [
|
||||
Punct {
|
||||
ch: '#',
|
||||
spacing: Alone,
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "print_target_and_args",
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "second",
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
Ident {
|
||||
ident: "fn",
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
Ident {
|
||||
ident: "foo",
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [],
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [
|
||||
Punct {
|
||||
ch: '#',
|
||||
spacing: Joint,
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '!',
|
||||
spacing: Alone,
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "print_target_and_args",
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "third",
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '#',
|
||||
spacing: Joint,
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '!',
|
||||
spacing: Alone,
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "print_target_and_args",
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "fourth",
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
]
|
||||
PRINT-ATTR_ARGS INPUT (DISPLAY): second
|
||||
PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
|
||||
Ident {
|
||||
ident: "second",
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
]
|
||||
PRINT-ATTR INPUT (DISPLAY): fn foo()
|
||||
{ # ! [print_target_and_args(third)] # ! [print_target_and_args(fourth)] }
|
||||
PRINT-ATTR INPUT (DEBUG): TokenStream [
|
||||
Ident {
|
||||
ident: "fn",
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
Ident {
|
||||
ident: "foo",
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [],
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [
|
||||
Punct {
|
||||
ch: '#',
|
||||
spacing: Joint,
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '!',
|
||||
spacing: Alone,
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "print_target_and_args",
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "third",
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '#',
|
||||
spacing: Joint,
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '!',
|
||||
spacing: Alone,
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "print_target_and_args",
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "fourth",
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
]
|
||||
PRINT-ATTR_ARGS INPUT (DISPLAY): third
|
||||
PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
|
||||
Ident {
|
||||
ident: "third",
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
]
|
||||
PRINT-ATTR INPUT (DISPLAY): fn foo() { # ! [print_target_and_args(fourth)] }
|
||||
PRINT-ATTR INPUT (DEBUG): TokenStream [
|
||||
Ident {
|
||||
ident: "fn",
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
Ident {
|
||||
ident: "foo",
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [],
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [
|
||||
Punct {
|
||||
ch: '#',
|
||||
spacing: Joint,
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '!',
|
||||
spacing: Alone,
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "print_target_and_args",
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "fourth",
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
]
|
||||
PRINT-ATTR_ARGS INPUT (DISPLAY): fourth
|
||||
PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
|
||||
Ident {
|
||||
ident: "fourth",
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
]
|
||||
PRINT-ATTR INPUT (DISPLAY): fn foo() { }
|
||||
PRINT-ATTR INPUT (DEBUG): TokenStream [
|
||||
Ident {
|
||||
ident: "fn",
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
Ident {
|
||||
ident: "foo",
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [],
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [],
|
||||
span: $DIR/inner-attrs.rs:17:1: 20:2 (#0),
|
||||
},
|
||||
]
|
||||
PRINT-ATTR_ARGS INPUT (DISPLAY): fifth
|
||||
PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
|
||||
Ident {
|
||||
ident: "fifth",
|
||||
span: $DIR/inner-attrs.rs:27:31: 27:36 (#0),
|
||||
},
|
||||
]
|
||||
PRINT-ATTR INPUT (DISPLAY): (1, 2) ;
|
||||
PRINT-ATTR INPUT (DEBUG): TokenStream [
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Literal {
|
||||
kind: Integer,
|
||||
symbol: "1",
|
||||
suffix: None,
|
||||
span: $DIR/inner-attrs.rs:27:5: 27:45 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: ',',
|
||||
spacing: Alone,
|
||||
span: $DIR/inner-attrs.rs:27:5: 27:45 (#0),
|
||||
},
|
||||
Literal {
|
||||
kind: Integer,
|
||||
symbol: "2",
|
||||
suffix: None,
|
||||
span: $DIR/inner-attrs.rs:27:5: 27:45 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/inner-attrs.rs:27:5: 27:45 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: ';',
|
||||
spacing: Alone,
|
||||
span: $DIR/inner-attrs.rs:27:5: 27:45 (#0),
|
||||
},
|
||||
]
|
||||
PRINT-ATTR_ARGS INPUT (DISPLAY): sixth
|
||||
PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
|
||||
Ident {
|
||||
ident: "sixth",
|
||||
span: $DIR/inner-attrs.rs:29:31: 29:36 (#0),
|
||||
},
|
||||
]
|
||||
PRINT-ATTR INPUT (DISPLAY): [1, 2] ;
|
||||
PRINT-ATTR INPUT (DEBUG): TokenStream [
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Literal {
|
||||
kind: Integer,
|
||||
symbol: "1",
|
||||
suffix: None,
|
||||
span: $DIR/inner-attrs.rs:29:5: 29:46 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: ',',
|
||||
spacing: Alone,
|
||||
span: $DIR/inner-attrs.rs:29:5: 29:46 (#0),
|
||||
},
|
||||
Literal {
|
||||
kind: Integer,
|
||||
symbol: "2",
|
||||
suffix: None,
|
||||
span: $DIR/inner-attrs.rs:29:5: 29:46 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/inner-attrs.rs:29:5: 29:46 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: ';',
|
||||
spacing: Alone,
|
||||
span: $DIR/inner-attrs.rs:29:5: 29:46 (#0),
|
||||
},
|
||||
]
|
||||
PRINT-ATTR_ARGS INPUT (DISPLAY): seventh
|
||||
PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
|
||||
Ident {
|
||||
ident: "seventh",
|
||||
span: $DIR/inner-attrs.rs:30:31: 30:38 (#0),
|
||||
},
|
||||
]
|
||||
PRINT-ATTR INPUT (DISPLAY): [true ; 5] ;
|
||||
PRINT-ATTR INPUT (DEBUG): TokenStream [
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "true",
|
||||
span: $DIR/inner-attrs.rs:30:5: 30:51 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: ';',
|
||||
spacing: Alone,
|
||||
span: $DIR/inner-attrs.rs:30:5: 30:51 (#0),
|
||||
},
|
||||
Literal {
|
||||
kind: Integer,
|
||||
symbol: "5",
|
||||
suffix: None,
|
||||
span: $DIR/inner-attrs.rs:30:5: 30:51 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/inner-attrs.rs:30:5: 30:51 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: ';',
|
||||
spacing: Alone,
|
||||
span: $DIR/inner-attrs.rs:30:5: 30:51 (#0),
|
||||
},
|
||||
]
|
||||
PRINT-ATTR_ARGS INPUT (DISPLAY): eighth
|
||||
PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
|
||||
Ident {
|
||||
ident: "eighth",
|
||||
span: $DIR/inner-attrs.rs:34:34: 34:40 (#0),
|
||||
},
|
||||
]
|
||||
PRINT-ATTR INPUT (DISPLAY): match 0 { _ => { } }
|
||||
PRINT-ATTR INPUT (DEBUG): TokenStream [
|
||||
Ident {
|
||||
ident: "match",
|
||||
span: $DIR/inner-attrs.rs:33:5: 36:6 (#0),
|
||||
},
|
||||
Literal {
|
||||
kind: Integer,
|
||||
symbol: "0",
|
||||
suffix: None,
|
||||
span: $DIR/inner-attrs.rs:33:5: 36:6 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "_",
|
||||
span: $DIR/inner-attrs.rs:33:5: 36:6 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '=',
|
||||
spacing: Joint,
|
||||
span: $DIR/inner-attrs.rs:33:5: 36:6 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '>',
|
||||
spacing: Alone,
|
||||
span: $DIR/inner-attrs.rs:33:5: 36:6 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [],
|
||||
span: $DIR/inner-attrs.rs:33:5: 36:6 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/inner-attrs.rs:33:5: 36:6 (#0),
|
||||
},
|
||||
]
|
||||
PRINT-ATTR_ARGS INPUT (DISPLAY): ninth
|
||||
PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
|
||||
Ident {
|
||||
ident: "ninth",
|
||||
span: $DIR/inner-attrs.rs:38:41: 38:46 (#0),
|
||||
},
|
||||
]
|
||||
PRINT-ATTR INPUT (DISPLAY): MyStruct { field : true, } ;
|
||||
PRINT-ATTR INPUT (DEBUG): TokenStream [
|
||||
Ident {
|
||||
ident: "MyStruct",
|
||||
span: $DIR/inner-attrs.rs:38:5: 38:63 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "field",
|
||||
span: $DIR/inner-attrs.rs:38:5: 38:63 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: ':',
|
||||
spacing: Alone,
|
||||
span: $DIR/inner-attrs.rs:38:5: 38:63 (#0),
|
||||
},
|
||||
Ident {
|
||||
ident: "true",
|
||||
span: $DIR/inner-attrs.rs:38:5: 38:63 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: ',',
|
||||
spacing: Alone,
|
||||
span: $DIR/inner-attrs.rs:38:5: 38:63 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/inner-attrs.rs:38:5: 38:63 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: ';',
|
||||
spacing: Alone,
|
||||
span: $DIR/inner-attrs.rs:38:5: 38:63 (#0),
|
||||
},
|
||||
]
|
||||
PRINT-ATTR_ARGS INPUT (DISPLAY): tenth
|
||||
PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
|
||||
Ident {
|
||||
ident: "tenth",
|
||||
span: $DIR/inner-attrs.rs:43:42: 43:47 (#0),
|
||||
},
|
||||
]
|
||||
PRINT-ATTR INPUT (DISPLAY): fn weird_extern() { }
|
||||
PRINT-ATTR INPUT (DEBUG): TokenStream [
|
||||
Ident {
|
||||
ident: "fn",
|
||||
span: $DIR/inner-attrs.rs:42:5: 44:6 (#0),
|
||||
},
|
||||
Ident {
|
||||
ident: "weird_extern",
|
||||
span: $DIR/inner-attrs.rs:42:5: 44:6 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [],
|
||||
span: $DIR/inner-attrs.rs:42:5: 44:6 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [],
|
||||
span: $DIR/inner-attrs.rs:42:5: 44:6 (#0),
|
||||
},
|
||||
]
|
@ -10,6 +10,9 @@
|
||||
// (a pretty-printed struct may cause a line to start with '{' )
|
||||
// FIXME: We currently lose spans here (see issue #43081)
|
||||
|
||||
#![no_std] // Don't load unnecessary hygiene information from std
|
||||
extern crate std;
|
||||
|
||||
#[macro_use]
|
||||
extern crate test_macros;
|
||||
|
||||
@ -58,6 +61,10 @@ struct Foo<#[cfg(FALSE)] A, B> {
|
||||
u8
|
||||
);
|
||||
|
||||
fn plain_removed_fn() {
|
||||
#![cfg_attr(not(FALSE), cfg(FALSE))]
|
||||
}
|
||||
|
||||
0
|
||||
}],
|
||||
#[print_helper(d)]
|
||||
|
@ -1,5 +1,5 @@
|
||||
warning: derive helper attribute is used before it is introduced
|
||||
--> $DIR/issue-75930-derive-cfg.rs:16:3
|
||||
--> $DIR/issue-75930-derive-cfg.rs:19:3
|
||||
|
|
||||
LL | #[print_helper(a)]
|
||||
| ^^^^^^^^^^^^
|
||||
|
File diff suppressed because it is too large
Load Diff
31
src/test/ui/proc-macro/macro-rules-derive-cfg.rs
Normal file
31
src/test/ui/proc-macro/macro-rules-derive-cfg.rs
Normal file
@ -0,0 +1,31 @@
|
||||
// check-pass
|
||||
// compile-flags: -Z span-debug --error-format human
|
||||
// aux-build:test-macros.rs
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
#![feature(stmt_expr_attributes)]
|
||||
|
||||
#![no_std] // Don't load unnecessary hygiene information from std
|
||||
extern crate std;
|
||||
|
||||
#[macro_use]
|
||||
extern crate test_macros;
|
||||
|
||||
macro_rules! produce_it {
|
||||
($expr:expr) => {
|
||||
#[derive(Print)]
|
||||
struct Foo {
|
||||
val: [bool; {
|
||||
let a = #[cfg_attr(not(FALSE), rustc_dummy(first))] $expr;
|
||||
0
|
||||
}]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
produce_it!(#[cfg_attr(not(FALSE), rustc_dummy(second))] {
|
||||
#![cfg_attr(not(FALSE), allow(unused))]
|
||||
30
|
||||
});
|
||||
|
||||
fn main() {}
|
176
src/test/ui/proc-macro/macro-rules-derive-cfg.stdout
Normal file
176
src/test/ui/proc-macro/macro-rules-derive-cfg.stdout
Normal file
@ -0,0 +1,176 @@
|
||||
PRINT-DERIVE INPUT (DISPLAY): struct Foo
|
||||
{
|
||||
val :
|
||||
[bool ;
|
||||
{
|
||||
let a = #[rustc_dummy(first)] #[rustc_dummy(second)]
|
||||
{ # ! [allow(unused)] 30 } ; 0
|
||||
}],
|
||||
}
|
||||
PRINT-DERIVE INPUT (DEBUG): TokenStream [
|
||||
Ident {
|
||||
ident: "struct",
|
||||
span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
|
||||
},
|
||||
Ident {
|
||||
ident: "Foo",
|
||||
span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "val",
|
||||
span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
|
||||
},
|
||||
Punct {
|
||||
ch: ':',
|
||||
spacing: Alone,
|
||||
span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "bool",
|
||||
span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
|
||||
},
|
||||
Punct {
|
||||
ch: ';',
|
||||
spacing: Alone,
|
||||
span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "let",
|
||||
span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
|
||||
},
|
||||
Ident {
|
||||
ident: "a",
|
||||
span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
|
||||
},
|
||||
Punct {
|
||||
ch: '=',
|
||||
spacing: Alone,
|
||||
span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
|
||||
},
|
||||
Punct {
|
||||
ch: '#',
|
||||
spacing: Alone,
|
||||
span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "rustc_dummy",
|
||||
span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "first",
|
||||
span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
|
||||
},
|
||||
],
|
||||
span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
|
||||
},
|
||||
],
|
||||
span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
|
||||
},
|
||||
Punct {
|
||||
ch: '#',
|
||||
spacing: Alone,
|
||||
span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "rustc_dummy",
|
||||
span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "second",
|
||||
span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
|
||||
},
|
||||
],
|
||||
span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
|
||||
},
|
||||
],
|
||||
span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [
|
||||
Punct {
|
||||
ch: '#',
|
||||
spacing: Joint,
|
||||
span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
|
||||
},
|
||||
Punct {
|
||||
ch: '!',
|
||||
spacing: Alone,
|
||||
span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "allow",
|
||||
span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "unused",
|
||||
span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
|
||||
},
|
||||
],
|
||||
span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
|
||||
},
|
||||
],
|
||||
span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
|
||||
},
|
||||
Literal {
|
||||
kind: Integer,
|
||||
symbol: "30",
|
||||
suffix: None,
|
||||
span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
|
||||
},
|
||||
],
|
||||
span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
|
||||
},
|
||||
Punct {
|
||||
ch: ';',
|
||||
spacing: Alone,
|
||||
span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
|
||||
},
|
||||
Literal {
|
||||
kind: Integer,
|
||||
symbol: "0",
|
||||
suffix: None,
|
||||
span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
|
||||
},
|
||||
],
|
||||
span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
|
||||
},
|
||||
],
|
||||
span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
|
||||
},
|
||||
Punct {
|
||||
ch: ',',
|
||||
spacing: Alone,
|
||||
span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
|
||||
},
|
||||
],
|
||||
span: $DIR/macro-rules-derive-cfg.rs:17:9: 22:10 (#4),
|
||||
},
|
||||
]
|
23
src/test/ui/proc-macro/nested-derive-cfg.rs
Normal file
23
src/test/ui/proc-macro/nested-derive-cfg.rs
Normal file
@ -0,0 +1,23 @@
|
||||
// compile-flags: -Z span-debug --error-format human
|
||||
// aux-build:test-macros.rs
|
||||
// check-pass
|
||||
|
||||
#![no_std] // Don't load unnecessary hygiene information from std
|
||||
extern crate std;
|
||||
|
||||
#[macro_use]
|
||||
extern crate test_macros;
|
||||
|
||||
#[derive(Print)]
|
||||
struct Foo {
|
||||
#[cfg(FALSE)] removed: bool,
|
||||
my_array: [bool; {
|
||||
struct Inner {
|
||||
#[cfg(FALSE)] removed_inner_field: u8,
|
||||
non_removed_inner_field: usize
|
||||
}
|
||||
0
|
||||
}]
|
||||
}
|
||||
|
||||
fn main() {}
|
94
src/test/ui/proc-macro/nested-derive-cfg.stdout
Normal file
94
src/test/ui/proc-macro/nested-derive-cfg.stdout
Normal file
@ -0,0 +1,94 @@
|
||||
PRINT-DERIVE INPUT (DISPLAY): struct Foo
|
||||
{
|
||||
my_array :
|
||||
[bool ; { struct Inner { non_removed_inner_field : usize, } 0 }],
|
||||
}
|
||||
PRINT-DERIVE INPUT (DEBUG): TokenStream [
|
||||
Ident {
|
||||
ident: "struct",
|
||||
span: $DIR/nested-derive-cfg.rs:12:1: 21:2 (#0),
|
||||
},
|
||||
Ident {
|
||||
ident: "Foo",
|
||||
span: $DIR/nested-derive-cfg.rs:12:1: 21:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "my_array",
|
||||
span: $DIR/nested-derive-cfg.rs:12:1: 21:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: ':',
|
||||
spacing: Alone,
|
||||
span: $DIR/nested-derive-cfg.rs:12:1: 21:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "bool",
|
||||
span: $DIR/nested-derive-cfg.rs:12:1: 21:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: ';',
|
||||
spacing: Alone,
|
||||
span: $DIR/nested-derive-cfg.rs:12:1: 21:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "struct",
|
||||
span: $DIR/nested-derive-cfg.rs:12:1: 21:2 (#0),
|
||||
},
|
||||
Ident {
|
||||
ident: "Inner",
|
||||
span: $DIR/nested-derive-cfg.rs:12:1: 21:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "non_removed_inner_field",
|
||||
span: $DIR/nested-derive-cfg.rs:12:1: 21:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: ':',
|
||||
spacing: Alone,
|
||||
span: $DIR/nested-derive-cfg.rs:12:1: 21:2 (#0),
|
||||
},
|
||||
Ident {
|
||||
ident: "usize",
|
||||
span: $DIR/nested-derive-cfg.rs:12:1: 21:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: ',',
|
||||
spacing: Alone,
|
||||
span: $DIR/nested-derive-cfg.rs:12:1: 21:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/nested-derive-cfg.rs:12:1: 21:2 (#0),
|
||||
},
|
||||
Literal {
|
||||
kind: Integer,
|
||||
symbol: "0",
|
||||
suffix: None,
|
||||
span: $DIR/nested-derive-cfg.rs:12:1: 21:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/nested-derive-cfg.rs:12:1: 21:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/nested-derive-cfg.rs:12:1: 21:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: ',',
|
||||
spacing: Alone,
|
||||
span: $DIR/nested-derive-cfg.rs:12:1: 21:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/nested-derive-cfg.rs:12:1: 21:2 (#0),
|
||||
},
|
||||
]
|
23
src/test/ui/proc-macro/weird-braces.rs
Normal file
23
src/test/ui/proc-macro/weird-braces.rs
Normal file
@ -0,0 +1,23 @@
|
||||
// aux-build:test-macros.rs
|
||||
// check-pass
|
||||
// compile-flags: -Z span-debug
|
||||
|
||||
#![feature(custom_inner_attributes)]
|
||||
|
||||
#![no_std] // Don't load unnecessary hygiene information from std
|
||||
extern crate std;
|
||||
|
||||
extern crate test_macros;
|
||||
use test_macros::{print_target_and_args};
|
||||
|
||||
struct Foo<const V: bool>;
|
||||
trait Bar<const V: bool> {}
|
||||
|
||||
#[print_target_and_args(first_outer)]
|
||||
#[print_target_and_args(second_outer)]
|
||||
impl Bar<{1 > 0}> for Foo<{true}> {
|
||||
#![print_target_and_args(first_inner)]
|
||||
#![print_target_and_args(second_inner)]
|
||||
}
|
||||
|
||||
fn main() {}
|
524
src/test/ui/proc-macro/weird-braces.stdout
Normal file
524
src/test/ui/proc-macro/weird-braces.stdout
Normal file
@ -0,0 +1,524 @@
|
||||
PRINT-ATTR_ARGS INPUT (DISPLAY): first_outer
|
||||
PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
|
||||
Ident {
|
||||
ident: "first_outer",
|
||||
span: $DIR/weird-braces.rs:16:25: 16:36 (#0),
|
||||
},
|
||||
]
|
||||
PRINT-ATTR INPUT (DISPLAY): #[print_target_and_args(second_outer)] impl Bar < { 1 > 0 } > for Foo <
|
||||
{ true } >
|
||||
{
|
||||
# ! [print_target_and_args(first_inner)] # !
|
||||
[print_target_and_args(second_inner)]
|
||||
}
|
||||
PRINT-ATTR INPUT (DEBUG): TokenStream [
|
||||
Punct {
|
||||
ch: '#',
|
||||
spacing: Alone,
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "print_target_and_args",
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "second_outer",
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Ident {
|
||||
ident: "impl",
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Ident {
|
||||
ident: "Bar",
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '<',
|
||||
spacing: Alone,
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [
|
||||
Literal {
|
||||
kind: Integer,
|
||||
symbol: "1",
|
||||
suffix: None,
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '>',
|
||||
spacing: Alone,
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Literal {
|
||||
kind: Integer,
|
||||
symbol: "0",
|
||||
suffix: None,
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '>',
|
||||
spacing: Alone,
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Ident {
|
||||
ident: "for",
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Ident {
|
||||
ident: "Foo",
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '<',
|
||||
spacing: Alone,
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "true",
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '>',
|
||||
spacing: Alone,
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [
|
||||
Punct {
|
||||
ch: '#',
|
||||
spacing: Joint,
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '!',
|
||||
spacing: Alone,
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "print_target_and_args",
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "first_inner",
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '#',
|
||||
spacing: Joint,
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '!',
|
||||
spacing: Alone,
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "print_target_and_args",
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "second_inner",
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
]
|
||||
PRINT-ATTR_ARGS INPUT (DISPLAY): second_outer
|
||||
PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
|
||||
Ident {
|
||||
ident: "second_outer",
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
]
|
||||
PRINT-ATTR INPUT (DISPLAY): impl Bar < { 1 > 0 } > for Foo < { true } >
|
||||
{
|
||||
# ! [print_target_and_args(first_inner)] # !
|
||||
[print_target_and_args(second_inner)]
|
||||
}
|
||||
PRINT-ATTR INPUT (DEBUG): TokenStream [
|
||||
Ident {
|
||||
ident: "impl",
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Ident {
|
||||
ident: "Bar",
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '<',
|
||||
spacing: Alone,
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [
|
||||
Literal {
|
||||
kind: Integer,
|
||||
symbol: "1",
|
||||
suffix: None,
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '>',
|
||||
spacing: Alone,
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Literal {
|
||||
kind: Integer,
|
||||
symbol: "0",
|
||||
suffix: None,
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '>',
|
||||
spacing: Alone,
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Ident {
|
||||
ident: "for",
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Ident {
|
||||
ident: "Foo",
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '<',
|
||||
spacing: Alone,
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "true",
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '>',
|
||||
spacing: Alone,
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [
|
||||
Punct {
|
||||
ch: '#',
|
||||
spacing: Joint,
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '!',
|
||||
spacing: Alone,
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "print_target_and_args",
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "first_inner",
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '#',
|
||||
spacing: Joint,
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '!',
|
||||
spacing: Alone,
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "print_target_and_args",
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "second_inner",
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
]
|
||||
PRINT-ATTR_ARGS INPUT (DISPLAY): first_inner
|
||||
PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
|
||||
Ident {
|
||||
ident: "first_inner",
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
]
|
||||
PRINT-ATTR INPUT (DISPLAY): impl Bar < { 1 > 0 } > for Foo < { true } >
|
||||
{ # ! [print_target_and_args(second_inner)] }
|
||||
PRINT-ATTR INPUT (DEBUG): TokenStream [
|
||||
Ident {
|
||||
ident: "impl",
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Ident {
|
||||
ident: "Bar",
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '<',
|
||||
spacing: Alone,
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [
|
||||
Literal {
|
||||
kind: Integer,
|
||||
symbol: "1",
|
||||
suffix: None,
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '>',
|
||||
spacing: Alone,
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Literal {
|
||||
kind: Integer,
|
||||
symbol: "0",
|
||||
suffix: None,
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '>',
|
||||
spacing: Alone,
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Ident {
|
||||
ident: "for",
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Ident {
|
||||
ident: "Foo",
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '<',
|
||||
spacing: Alone,
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "true",
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '>',
|
||||
spacing: Alone,
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [
|
||||
Punct {
|
||||
ch: '#',
|
||||
spacing: Joint,
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '!',
|
||||
spacing: Alone,
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Bracket,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "print_target_and_args",
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "second_inner",
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
]
|
||||
PRINT-ATTR_ARGS INPUT (DISPLAY): second_inner
|
||||
PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
|
||||
Ident {
|
||||
ident: "second_inner",
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
]
|
||||
PRINT-ATTR INPUT (DISPLAY): impl Bar < { 1 > 0 } > for Foo < { true } > { }
|
||||
PRINT-ATTR INPUT (DEBUG): TokenStream [
|
||||
Ident {
|
||||
ident: "impl",
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Ident {
|
||||
ident: "Bar",
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '<',
|
||||
spacing: Alone,
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [
|
||||
Literal {
|
||||
kind: Integer,
|
||||
symbol: "1",
|
||||
suffix: None,
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '>',
|
||||
spacing: Alone,
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Literal {
|
||||
kind: Integer,
|
||||
symbol: "0",
|
||||
suffix: None,
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '>',
|
||||
spacing: Alone,
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Ident {
|
||||
ident: "for",
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Ident {
|
||||
ident: "Foo",
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '<',
|
||||
spacing: Alone,
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "true",
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
],
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Punct {
|
||||
ch: '>',
|
||||
spacing: Alone,
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [],
|
||||
span: $DIR/weird-braces.rs:18:1: 21:2 (#0),
|
||||
},
|
||||
]
|
Loading…
Reference in New Issue
Block a user