From 6c591112ce88ad64b21cf9ec5e3f5f6d9363bab6 Mon Sep 17 00:00:00 2001 From: Aaron Hill Date: Thu, 8 Apr 2021 17:01:15 -0400 Subject: [PATCH] Add some proc-macro attribute token handling tests --- .../auxiliary/nonterminal-recollect-attr.rs | 4 +- src/test/ui/proc-macro/cfg-eval-inner.rs | 39 + src/test/ui/proc-macro/cfg-eval-inner.stdout | 252 ++++++ src/test/ui/proc-macro/cfg-eval.rs | 9 +- src/test/ui/proc-macro/cfg-eval.stdout | 35 +- src/test/ui/proc-macro/inner-attrs.rs | 54 +- src/test/ui/proc-macro/inner-attrs.stderr | 36 +- src/test/ui/proc-macro/inner-attrs.stdout | 760 ++++++++++++++++-- .../proc-macro/nonterminal-recollect-attr.rs | 4 + .../nonterminal-recollect-attr.stdout | 72 ++ 10 files changed, 1199 insertions(+), 66 deletions(-) create mode 100644 src/test/ui/proc-macro/cfg-eval-inner.rs create mode 100644 src/test/ui/proc-macro/cfg-eval-inner.stdout create mode 100644 src/test/ui/proc-macro/nonterminal-recollect-attr.stdout diff --git a/src/test/ui/proc-macro/auxiliary/nonterminal-recollect-attr.rs b/src/test/ui/proc-macro/auxiliary/nonterminal-recollect-attr.rs index a6903283aa108..ea5ff466570e6 100644 --- a/src/test/ui/proc-macro/auxiliary/nonterminal-recollect-attr.rs +++ b/src/test/ui/proc-macro/auxiliary/nonterminal-recollect-attr.rs @@ -10,6 +10,7 @@ use proc_macro::{TokenStream, quote}; #[proc_macro_attribute] pub fn first_attr(_: TokenStream, input: TokenStream) -> TokenStream { let recollected: TokenStream = input.into_iter().collect(); + println!("First recollected: {:#?}", recollected); quote! { #[second_attr] $recollected @@ -18,6 +19,7 @@ pub fn first_attr(_: TokenStream, input: TokenStream) -> TokenStream { #[proc_macro_attribute] pub fn second_attr(_: TokenStream, input: TokenStream) -> TokenStream { - let _recollected: TokenStream = input.into_iter().collect(); + let recollected: TokenStream = input.into_iter().collect(); + println!("Second recollected: {:#?}", recollected); TokenStream::new() } diff --git a/src/test/ui/proc-macro/cfg-eval-inner.rs b/src/test/ui/proc-macro/cfg-eval-inner.rs new file mode 100644 index 0000000000000..5fd3ca0d163bc --- /dev/null +++ b/src/test/ui/proc-macro/cfg-eval-inner.rs @@ -0,0 +1,39 @@ +// compile-flags: -Z span-debug +// aux-build:test-macros.rs +// check-pass + +#![feature(cfg_eval)] +#![feature(custom_inner_attributes)] +#![feature(stmt_expr_attributes)] +#![feature(rustc_attrs)] + +#![no_std] // Don't load unnecessary hygiene information from std +extern crate std; + +#[macro_use] +extern crate test_macros; + +struct Foo(T); + +impl Foo<[u8; { + #![cfg_attr(not(FALSE), rustc_dummy(cursed_inner))] + #![allow(unused)] + struct Inner { + field: [u8; { + #![cfg_attr(not(FALSE), rustc_dummy(another_cursed_inner))] + 1 + }] + } + + 0 +}]> { + #![cfg_eval] + #![print_attr] + #![cfg_attr(not(FALSE), rustc_dummy(evaluated_attr))] + + fn bar() { + #[cfg(FALSE)] let a = 1; + } +} + +fn main() {} diff --git a/src/test/ui/proc-macro/cfg-eval-inner.stdout b/src/test/ui/proc-macro/cfg-eval-inner.stdout new file mode 100644 index 0000000000000..a9301d3349f17 --- /dev/null +++ b/src/test/ui/proc-macro/cfg-eval-inner.stdout @@ -0,0 +1,252 @@ +PRINT-ATTR INPUT (DISPLAY): impl Foo < +[u8 ; + { + # ! [rustc_dummy(cursed_inner)] # ! [allow(unused)] struct Inner + { field : [u8 ; { # ! [rustc_dummy(another_cursed_inner)] 1 }], } 0 + }] > { # ! [rustc_dummy(evaluated_attr)] fn bar() { } } +PRINT-ATTR INPUT (DEBUG): TokenStream [ + Ident { + ident: "impl", + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + Ident { + ident: "Foo", + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + Punct { + ch: '<', + spacing: Alone, + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + Group { + delimiter: Bracket, + stream: TokenStream [ + Ident { + ident: "u8", + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + Punct { + ch: ';', + spacing: Alone, + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + Group { + delimiter: Brace, + stream: TokenStream [ + Punct { + ch: '#', + spacing: Joint, + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + Punct { + ch: '!', + spacing: Alone, + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + Group { + delimiter: Bracket, + stream: TokenStream [ + Ident { + ident: "rustc_dummy", + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [ + Ident { + ident: "cursed_inner", + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + ], + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + ], + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + Punct { + ch: '#', + spacing: Joint, + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + Punct { + ch: '!', + spacing: Alone, + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + Group { + delimiter: Bracket, + stream: TokenStream [ + Ident { + ident: "allow", + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [ + Ident { + ident: "unused", + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + ], + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + ], + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + Ident { + ident: "struct", + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + Ident { + ident: "Inner", + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + Group { + delimiter: Brace, + stream: TokenStream [ + Ident { + ident: "field", + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + Punct { + ch: ':', + spacing: Alone, + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + Group { + delimiter: Bracket, + stream: TokenStream [ + Ident { + ident: "u8", + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + Punct { + ch: ';', + spacing: Alone, + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + Group { + delimiter: Brace, + stream: TokenStream [ + Punct { + ch: '#', + spacing: Joint, + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + Punct { + ch: '!', + spacing: Alone, + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + Group { + delimiter: Bracket, + stream: TokenStream [ + Ident { + ident: "rustc_dummy", + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [ + Ident { + ident: "another_cursed_inner", + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + ], + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + ], + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + Literal { + kind: Integer, + symbol: "1", + suffix: None, + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + ], + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + ], + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + Punct { + ch: ',', + spacing: Alone, + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + ], + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + Literal { + kind: Integer, + symbol: "0", + suffix: None, + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + ], + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + ], + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + Punct { + ch: '>', + spacing: Alone, + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + Group { + delimiter: Brace, + stream: TokenStream [ + Punct { + ch: '#', + spacing: Joint, + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + Punct { + ch: '!', + spacing: Alone, + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + Group { + delimiter: Bracket, + stream: TokenStream [ + Ident { + ident: "rustc_dummy", + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [ + Ident { + ident: "evaluated_attr", + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + ], + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + ], + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + Ident { + ident: "fn", + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + Ident { + ident: "bar", + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [], + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + Group { + delimiter: Brace, + stream: TokenStream [], + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, + ], + span: $DIR/cfg-eval-inner.rs:18:1: 37:2 (#0), + }, +] diff --git a/src/test/ui/proc-macro/cfg-eval.rs b/src/test/ui/proc-macro/cfg-eval.rs index ea397df545265..fa6d015e48eb8 100644 --- a/src/test/ui/proc-macro/cfg-eval.rs +++ b/src/test/ui/proc-macro/cfg-eval.rs @@ -5,7 +5,7 @@ #![feature(cfg_eval)] #![feature(proc_macro_hygiene)] #![feature(stmt_expr_attributes)] - +#![feature(rustc_attrs)] #![no_std] // Don't load unnecessary hygiene information from std extern crate std; @@ -28,5 +28,10 @@ struct S1 { struct S2 {} fn main() { - let _ = #[cfg_eval] #[print_attr](#[cfg(FALSE)] 0, #[cfg(all(/*true*/))] 1); + // Subtle - we need a trailing comma after the '1' - otherwise, `#[cfg_eval]` will + // turn this into `(#[cfg(all())] 1)`, which is a parenthesized expression, not a tuple + // expression. `#[cfg]` is not supported inside parenthesized expressions, so this will + // produce an error when attribute collection runs. + let _ = #[cfg_eval] #[print_attr] #[cfg_attr(not(FALSE), rustc_dummy)] + (#[cfg(FALSE)] 0, #[cfg(all(/*true*/))] 1,); } diff --git a/src/test/ui/proc-macro/cfg-eval.stdout b/src/test/ui/proc-macro/cfg-eval.stdout index b98e8961bfea7..1f784598ff708 100644 --- a/src/test/ui/proc-macro/cfg-eval.stdout +++ b/src/test/ui/proc-macro/cfg-eval.stdout @@ -83,53 +83,68 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ span: $DIR/cfg-eval.rs:17:1: 24:2 (#0), }, ] -PRINT-ATTR INPUT (DISPLAY): (#[cfg(all())] 1,) +PRINT-ATTR INPUT (DISPLAY): #[rustc_dummy] (#[cfg(all())] 1,) PRINT-ATTR INPUT (DEBUG): TokenStream [ + Punct { + ch: '#', + spacing: Alone, + span: $DIR/cfg-eval.rs:36:5: 36:48 (#0), + }, + Group { + delimiter: Bracket, + stream: TokenStream [ + Ident { + ident: "rustc_dummy", + span: $DIR/cfg-eval.rs:36:5: 36:48 (#0), + }, + ], + span: $DIR/cfg-eval.rs:36:5: 36:48 (#0), + }, Group { delimiter: Parenthesis, stream: TokenStream [ Punct { ch: '#', spacing: Alone, - span: $DIR/cfg-eval.rs:31:38: 31:80 (#0), + span: $DIR/cfg-eval.rs:36:5: 36:48 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "cfg", - span: $DIR/cfg-eval.rs:31:38: 31:80 (#0), + span: $DIR/cfg-eval.rs:36:5: 36:48 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "all", - span: $DIR/cfg-eval.rs:31:38: 31:80 (#0), + span: $DIR/cfg-eval.rs:36:5: 36:48 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [], - span: $DIR/cfg-eval.rs:31:38: 31:80 (#0), + span: $DIR/cfg-eval.rs:36:5: 36:48 (#0), }, ], - span: $DIR/cfg-eval.rs:31:38: 31:80 (#0), + span: $DIR/cfg-eval.rs:36:5: 36:48 (#0), }, ], - span: $DIR/cfg-eval.rs:31:38: 31:80 (#0), + span: $DIR/cfg-eval.rs:36:5: 36:48 (#0), }, Literal { kind: Integer, symbol: "1", suffix: None, - span: $DIR/cfg-eval.rs:31:38: 31:80 (#0), + span: $DIR/cfg-eval.rs:36:5: 36:48 (#0), }, Punct { ch: ',', spacing: Alone, - span: $DIR/cfg-eval.rs:31:38: 31:80 (#0), + span: $DIR/cfg-eval.rs:36:5: 36:48 (#0), }, ], - span: $DIR/cfg-eval.rs:31:38: 31:80 (#0), + span: $DIR/cfg-eval.rs:36:5: 36:48 (#0), }, ] diff --git a/src/test/ui/proc-macro/inner-attrs.rs b/src/test/ui/proc-macro/inner-attrs.rs index 5707621f80e67..1ff97dbf3c7fa 100644 --- a/src/test/ui/proc-macro/inner-attrs.rs +++ b/src/test/ui/proc-macro/inner-attrs.rs @@ -1,6 +1,6 @@ // compile-flags: -Z span-debug --error-format human // aux-build:test-macros.rs - +// edition:2018 #![feature(custom_inner_attributes)] #![feature(proc_macro_hygiene)] #![feature(stmt_expr_attributes)] @@ -19,10 +19,32 @@ fn foo() { #![print_target_and_args(fourth)] } +#[print_target_and_args(mod_first)] +#[print_target_and_args(mod_second)] +mod inline_mod { + #![print_target_and_args(mod_third)] + #![print_target_and_args(mod_fourth)] +} + struct MyStruct { field: bool } +#[derive(Print)] +struct MyDerivePrint { + field: [u8; { + match true { + #![cfg_attr(not(FALSE), rustc_dummy(first))] + #![cfg_attr(not(FALSE), rustc_dummy(second))] + _ => { + #![cfg_attr(not(FALSE), rustc_dummy(second))] + true + } + }; + 0 + }] +} + fn bar() { (#![print_target_and_args(fifth)] 1, 2); //~^ ERROR expected non-macro inner attribute, found attribute macro @@ -40,6 +62,19 @@ fn bar() { true; 0 ]; + #[print_target_and_args(tuple_attrs)] ( + #![cfg_attr(FALSE, rustc_dummy)] + 3, 4, { + #![cfg_attr(not(FALSE), rustc_dummy(innermost))] + 5 + } + ); + + #[print_target_and_args(array_attrs)] [ + #![rustc_dummy(inner)] + true; 0 + ]; + [#![print_target_and_args(sixth)] 1 , 2]; //~^ ERROR expected non-macro inner attribute, found attribute macro [#![print_target_and_args(seventh)] true ; 5]; @@ -53,8 +88,25 @@ fn bar() { MyStruct { #![print_target_and_args(ninth)] field: true }; //~^ ERROR expected non-macro inner attribute, found attribute macro + + for _ in &[true] { + #![print_attr] //~ ERROR expected non-macro inner attribute + } + + let _ = { + #![print_attr] //~ ERROR expected non-macro inner attribute + }; + + let _ = async { + #![print_attr] //~ ERROR expected non-macro inner attribute + }; + + { + #![print_attr] //~ ERROR expected non-macro inner attribute + }; } + extern { fn weird_extern() { #![print_target_and_args_consume(tenth)] diff --git a/src/test/ui/proc-macro/inner-attrs.stderr b/src/test/ui/proc-macro/inner-attrs.stderr index db774cbfb8fc3..7f22c5f30d660 100644 --- a/src/test/ui/proc-macro/inner-attrs.stderr +++ b/src/test/ui/proc-macro/inner-attrs.stderr @@ -1,32 +1,56 @@ error: expected non-macro inner attribute, found attribute macro `print_target_and_args` - --> $DIR/inner-attrs.rs:27:9 + --> $DIR/inner-attrs.rs:49:9 | LL | (#![print_target_and_args(fifth)] 1, 2); | ^^^^^^^^^^^^^^^^^^^^^ not a non-macro inner attribute error: expected non-macro inner attribute, found attribute macro `print_target_and_args` - --> $DIR/inner-attrs.rs:43:9 + --> $DIR/inner-attrs.rs:78:9 | LL | [#![print_target_and_args(sixth)] 1 , 2]; | ^^^^^^^^^^^^^^^^^^^^^ not a non-macro inner attribute error: expected non-macro inner attribute, found attribute macro `print_target_and_args` - --> $DIR/inner-attrs.rs:45:9 + --> $DIR/inner-attrs.rs:80:9 | LL | [#![print_target_and_args(seventh)] true ; 5]; | ^^^^^^^^^^^^^^^^^^^^^ not a non-macro inner attribute error: expected non-macro inner attribute, found attribute macro `print_target_and_args` - --> $DIR/inner-attrs.rs:49:12 + --> $DIR/inner-attrs.rs:84:12 | LL | #![print_target_and_args(eighth)] | ^^^^^^^^^^^^^^^^^^^^^ not a non-macro inner attribute error: expected non-macro inner attribute, found attribute macro `print_target_and_args` - --> $DIR/inner-attrs.rs:54:19 + --> $DIR/inner-attrs.rs:89:19 | LL | MyStruct { #![print_target_and_args(ninth)] field: true }; | ^^^^^^^^^^^^^^^^^^^^^ not a non-macro inner attribute -error: aborting due to 5 previous errors +error: expected non-macro inner attribute, found attribute macro `print_attr` + --> $DIR/inner-attrs.rs:93:12 + | +LL | #![print_attr] + | ^^^^^^^^^^ not a non-macro inner attribute + +error: expected non-macro inner attribute, found attribute macro `print_attr` + --> $DIR/inner-attrs.rs:97:12 + | +LL | #![print_attr] + | ^^^^^^^^^^ not a non-macro inner attribute + +error: expected non-macro inner attribute, found attribute macro `print_attr` + --> $DIR/inner-attrs.rs:101:12 + | +LL | #![print_attr] + | ^^^^^^^^^^ not a non-macro inner attribute + +error: expected non-macro inner attribute, found attribute macro `print_attr` + --> $DIR/inner-attrs.rs:105:12 + | +LL | #![print_attr] + | ^^^^^^^^^^ not a non-macro inner attribute + +error: aborting due to 9 previous errors diff --git a/src/test/ui/proc-macro/inner-attrs.stdout b/src/test/ui/proc-macro/inner-attrs.stdout index ae04544e53356..b44822fb557f9 100644 --- a/src/test/ui/proc-macro/inner-attrs.stdout +++ b/src/test/ui/proc-macro/inner-attrs.stdout @@ -290,11 +290,679 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ span: $DIR/inner-attrs.rs:17:1: 20:2 (#0), }, ] +PRINT-ATTR_ARGS INPUT (DISPLAY): mod_first +PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [ + Ident { + ident: "mod_first", + span: $DIR/inner-attrs.rs:22:25: 22:34 (#0), + }, +] +PRINT-ATTR INPUT (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:24:1: 27:2 (#0), + }, + Group { + delimiter: Bracket, + stream: TokenStream [ + Ident { + ident: "print_target_and_args", + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [ + Ident { + ident: "mod_second", + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, + ], + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, + ], + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, + Ident { + ident: "mod", + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, + Ident { + ident: "inline_mod", + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, + Group { + delimiter: Brace, + stream: TokenStream [ + Punct { + ch: '#', + spacing: Joint, + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, + Punct { + ch: '!', + spacing: Alone, + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, + Group { + delimiter: Bracket, + stream: TokenStream [ + Ident { + ident: "print_target_and_args", + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [ + Ident { + ident: "mod_third", + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, + ], + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, + ], + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, + Punct { + ch: '#', + spacing: Joint, + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, + Punct { + ch: '!', + spacing: Alone, + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, + Group { + delimiter: Bracket, + stream: TokenStream [ + Ident { + ident: "print_target_and_args", + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [ + Ident { + ident: "mod_fourth", + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, + ], + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, + ], + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, + ], + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, +] +PRINT-ATTR_ARGS INPUT (DISPLAY): mod_second +PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [ + Ident { + ident: "mod_second", + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, +] +PRINT-ATTR INPUT (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:24:1: 27:2 (#0), + }, + Ident { + ident: "inline_mod", + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, + Group { + delimiter: Brace, + stream: TokenStream [ + Punct { + ch: '#', + spacing: Joint, + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, + Punct { + ch: '!', + spacing: Alone, + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, + Group { + delimiter: Bracket, + stream: TokenStream [ + Ident { + ident: "print_target_and_args", + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [ + Ident { + ident: "mod_third", + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, + ], + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, + ], + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, + Punct { + ch: '#', + spacing: Joint, + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, + Punct { + ch: '!', + spacing: Alone, + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, + Group { + delimiter: Bracket, + stream: TokenStream [ + Ident { + ident: "print_target_and_args", + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [ + Ident { + ident: "mod_fourth", + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, + ], + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, + ], + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, + ], + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, +] +PRINT-ATTR_ARGS INPUT (DISPLAY): mod_third +PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [ + Ident { + ident: "mod_third", + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, +] +PRINT-ATTR INPUT (DISPLAY): mod inline_mod { # ! [print_target_and_args(mod_fourth)] } +PRINT-ATTR INPUT (DEBUG): TokenStream [ + Ident { + ident: "mod", + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, + Ident { + ident: "inline_mod", + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, + Group { + delimiter: Brace, + stream: TokenStream [ + Punct { + ch: '#', + spacing: Joint, + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, + Punct { + ch: '!', + spacing: Alone, + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, + Group { + delimiter: Bracket, + stream: TokenStream [ + Ident { + ident: "print_target_and_args", + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [ + Ident { + ident: "mod_fourth", + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, + ], + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, + ], + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, + ], + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, +] +PRINT-ATTR_ARGS INPUT (DISPLAY): mod_fourth +PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [ + Ident { + ident: "mod_fourth", + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, +] +PRINT-ATTR INPUT (DISPLAY): mod inline_mod { } +PRINT-ATTR INPUT (DEBUG): TokenStream [ + Ident { + ident: "mod", + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, + Ident { + ident: "inline_mod", + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, + Group { + delimiter: Brace, + stream: TokenStream [], + span: $DIR/inner-attrs.rs:24:1: 27:2 (#0), + }, +] +PRINT-DERIVE INPUT (DISPLAY): struct MyDerivePrint +{ + field : + [u8 ; + { + match true + { # ! [rustc_dummy(first)] # ! [rustc_dummy(second)] _ => { true } } + ; 0 + }], +} +PRINT-DERIVE INPUT (DEBUG): TokenStream [ + Ident { + ident: "struct", + span: $DIR/inner-attrs.rs:34:1: 46:2 (#0), + }, + Ident { + ident: "MyDerivePrint", + span: $DIR/inner-attrs.rs:34:1: 46:2 (#0), + }, + Group { + delimiter: Brace, + stream: TokenStream [ + Ident { + ident: "field", + span: $DIR/inner-attrs.rs:34:1: 46:2 (#0), + }, + Punct { + ch: ':', + spacing: Alone, + span: $DIR/inner-attrs.rs:34:1: 46:2 (#0), + }, + Group { + delimiter: Bracket, + stream: TokenStream [ + Ident { + ident: "u8", + span: $DIR/inner-attrs.rs:34:1: 46:2 (#0), + }, + Punct { + ch: ';', + spacing: Alone, + span: $DIR/inner-attrs.rs:34:1: 46:2 (#0), + }, + Group { + delimiter: Brace, + stream: TokenStream [ + Ident { + ident: "match", + span: $DIR/inner-attrs.rs:34:1: 46:2 (#0), + }, + Ident { + ident: "true", + span: $DIR/inner-attrs.rs:34:1: 46:2 (#0), + }, + Group { + delimiter: Brace, + stream: TokenStream [ + Punct { + ch: '#', + spacing: Joint, + span: $DIR/inner-attrs.rs:34:1: 46:2 (#0), + }, + Punct { + ch: '!', + spacing: Alone, + span: $DIR/inner-attrs.rs:34:1: 46:2 (#0), + }, + Group { + delimiter: Bracket, + stream: TokenStream [ + Ident { + ident: "rustc_dummy", + span: $DIR/inner-attrs.rs:34:1: 46:2 (#0), + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [ + Ident { + ident: "first", + span: $DIR/inner-attrs.rs:34:1: 46:2 (#0), + }, + ], + span: $DIR/inner-attrs.rs:34:1: 46:2 (#0), + }, + ], + span: $DIR/inner-attrs.rs:34:1: 46:2 (#0), + }, + Punct { + ch: '#', + spacing: Joint, + span: $DIR/inner-attrs.rs:34:1: 46:2 (#0), + }, + Punct { + ch: '!', + spacing: Alone, + span: $DIR/inner-attrs.rs:34:1: 46:2 (#0), + }, + Group { + delimiter: Bracket, + stream: TokenStream [ + Ident { + ident: "rustc_dummy", + span: $DIR/inner-attrs.rs:34:1: 46:2 (#0), + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [ + Ident { + ident: "second", + span: $DIR/inner-attrs.rs:34:1: 46:2 (#0), + }, + ], + span: $DIR/inner-attrs.rs:34:1: 46:2 (#0), + }, + ], + span: $DIR/inner-attrs.rs:34:1: 46:2 (#0), + }, + Ident { + ident: "_", + span: $DIR/inner-attrs.rs:34:1: 46:2 (#0), + }, + Punct { + ch: '=', + spacing: Joint, + span: $DIR/inner-attrs.rs:34:1: 46:2 (#0), + }, + Punct { + ch: '>', + spacing: Alone, + span: $DIR/inner-attrs.rs:34:1: 46:2 (#0), + }, + Group { + delimiter: Brace, + stream: TokenStream [ + Ident { + ident: "true", + span: $DIR/inner-attrs.rs:34:1: 46:2 (#0), + }, + ], + span: $DIR/inner-attrs.rs:34:1: 46:2 (#0), + }, + ], + span: $DIR/inner-attrs.rs:34:1: 46:2 (#0), + }, + Punct { + ch: ';', + spacing: Alone, + span: $DIR/inner-attrs.rs:34:1: 46:2 (#0), + }, + Literal { + kind: Integer, + symbol: "0", + suffix: None, + span: $DIR/inner-attrs.rs:34:1: 46:2 (#0), + }, + ], + span: $DIR/inner-attrs.rs:34:1: 46:2 (#0), + }, + ], + span: $DIR/inner-attrs.rs:34:1: 46:2 (#0), + }, + Punct { + ch: ',', + spacing: Alone, + span: $DIR/inner-attrs.rs:34:1: 46:2 (#0), + }, + ], + span: $DIR/inner-attrs.rs:34:1: 46:2 (#0), + }, +] +PRINT-ATTR_ARGS INPUT (DISPLAY): tuple_attrs +PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [ + Ident { + ident: "tuple_attrs", + span: $DIR/inner-attrs.rs:52:29: 52:40 (#0), + }, +] +PRINT-ATTR INPUT (DISPLAY): (# ! [cfg_attr(FALSE, rustc_dummy)] 3, 4, + { # ! [cfg_attr(not(FALSE), rustc_dummy(innermost))] 5 }) ; +PRINT-ATTR INPUT (DEBUG): TokenStream [ + Group { + delimiter: Parenthesis, + stream: TokenStream [ + Punct { + ch: '#', + spacing: Joint, + span: $DIR/inner-attrs.rs:53:9: 53:10 (#0), + }, + Punct { + ch: '!', + spacing: Alone, + span: $DIR/inner-attrs.rs:53:10: 53:11 (#0), + }, + Group { + delimiter: Bracket, + stream: TokenStream [ + Ident { + ident: "cfg_attr", + span: $DIR/inner-attrs.rs:53:12: 53:20 (#0), + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [ + Ident { + ident: "FALSE", + span: $DIR/inner-attrs.rs:53:21: 53:26 (#0), + }, + Punct { + ch: ',', + spacing: Alone, + span: $DIR/inner-attrs.rs:53:26: 53:27 (#0), + }, + Ident { + ident: "rustc_dummy", + span: $DIR/inner-attrs.rs:53:28: 53:39 (#0), + }, + ], + span: $DIR/inner-attrs.rs:53:20: 53:40 (#0), + }, + ], + span: $DIR/inner-attrs.rs:53:11: 53:41 (#0), + }, + Literal { + kind: Integer, + symbol: "3", + suffix: None, + span: $DIR/inner-attrs.rs:54:9: 54:10 (#0), + }, + Punct { + ch: ',', + spacing: Alone, + span: $DIR/inner-attrs.rs:54:10: 54:11 (#0), + }, + Literal { + kind: Integer, + symbol: "4", + suffix: None, + span: $DIR/inner-attrs.rs:54:12: 54:13 (#0), + }, + Punct { + ch: ',', + spacing: Alone, + span: $DIR/inner-attrs.rs:54:13: 54:14 (#0), + }, + Group { + delimiter: Brace, + stream: TokenStream [ + Punct { + ch: '#', + spacing: Joint, + span: $DIR/inner-attrs.rs:55:13: 55:14 (#0), + }, + Punct { + ch: '!', + spacing: Alone, + span: $DIR/inner-attrs.rs:55:14: 55:15 (#0), + }, + Group { + delimiter: Bracket, + stream: TokenStream [ + Ident { + ident: "cfg_attr", + span: $DIR/inner-attrs.rs:55:16: 55:24 (#0), + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [ + Ident { + ident: "not", + span: $DIR/inner-attrs.rs:55:25: 55:28 (#0), + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [ + Ident { + ident: "FALSE", + span: $DIR/inner-attrs.rs:55:29: 55:34 (#0), + }, + ], + span: $DIR/inner-attrs.rs:55:28: 55:35 (#0), + }, + Punct { + ch: ',', + spacing: Alone, + span: $DIR/inner-attrs.rs:55:35: 55:36 (#0), + }, + Ident { + ident: "rustc_dummy", + span: $DIR/inner-attrs.rs:55:37: 55:48 (#0), + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [ + Ident { + ident: "innermost", + span: $DIR/inner-attrs.rs:55:49: 55:58 (#0), + }, + ], + span: $DIR/inner-attrs.rs:55:48: 55:59 (#0), + }, + ], + span: $DIR/inner-attrs.rs:55:24: 55:60 (#0), + }, + ], + span: $DIR/inner-attrs.rs:55:15: 55:61 (#0), + }, + Literal { + kind: Integer, + symbol: "5", + suffix: None, + span: $DIR/inner-attrs.rs:56:13: 56:14 (#0), + }, + ], + span: $DIR/inner-attrs.rs:54:15: 57:10 (#0), + }, + ], + span: $DIR/inner-attrs.rs:52:43: 58:6 (#0), + }, + Punct { + ch: ';', + spacing: Alone, + span: $DIR/inner-attrs.rs:58:6: 58:7 (#0), + }, +] +PRINT-ATTR_ARGS INPUT (DISPLAY): array_attrs +PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [ + Ident { + ident: "array_attrs", + span: $DIR/inner-attrs.rs:60:29: 60:40 (#0), + }, +] +PRINT-ATTR INPUT (DISPLAY): [# ! [rustc_dummy(inner)] true ; 0] ; +PRINT-ATTR INPUT (DEBUG): TokenStream [ + Group { + delimiter: Bracket, + stream: TokenStream [ + Punct { + ch: '#', + spacing: Joint, + span: $DIR/inner-attrs.rs:60:43: 63:7 (#0), + }, + Punct { + ch: '!', + spacing: Alone, + span: $DIR/inner-attrs.rs:60:43: 63:7 (#0), + }, + Group { + delimiter: Bracket, + stream: TokenStream [ + Ident { + ident: "rustc_dummy", + span: $DIR/inner-attrs.rs:60:43: 63:7 (#0), + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [ + Ident { + ident: "inner", + span: $DIR/inner-attrs.rs:60:43: 63:7 (#0), + }, + ], + span: $DIR/inner-attrs.rs:60:43: 63:7 (#0), + }, + ], + span: $DIR/inner-attrs.rs:60:43: 63:7 (#0), + }, + Ident { + ident: "true", + span: $DIR/inner-attrs.rs:60:43: 63:7 (#0), + }, + Punct { + ch: ';', + spacing: Alone, + span: $DIR/inner-attrs.rs:60:43: 63:7 (#0), + }, + Literal { + kind: Integer, + symbol: "0", + suffix: None, + span: $DIR/inner-attrs.rs:60:43: 63:7 (#0), + }, + ], + span: $DIR/inner-attrs.rs:60:43: 63:7 (#0), + }, + Punct { + ch: ';', + spacing: Alone, + span: $DIR/inner-attrs.rs:60:43: 63:7 (#0), + }, +] PRINT-ATTR_ARGS INPUT (DISPLAY): tuple_attrs PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [ Ident { ident: "tuple_attrs", - span: $DIR/inner-attrs.rs:30:29: 30:40 (#0), + span: $DIR/inner-attrs.rs:65:29: 65:40 (#0), }, ] PRINT-ATTR INPUT (DISPLAY): (# ! [cfg_attr(FALSE, rustc_dummy)] 3, 4, @@ -306,63 +974,63 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '#', spacing: Joint, - span: $DIR/inner-attrs.rs:31:9: 31:10 (#0), + span: $DIR/inner-attrs.rs:66:9: 66:10 (#0), }, Punct { ch: '!', spacing: Alone, - span: $DIR/inner-attrs.rs:31:10: 31:11 (#0), + span: $DIR/inner-attrs.rs:66:10: 66:11 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "cfg_attr", - span: $DIR/inner-attrs.rs:31:12: 31:20 (#0), + span: $DIR/inner-attrs.rs:66:12: 66:20 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "FALSE", - span: $DIR/inner-attrs.rs:31:21: 31:26 (#0), + span: $DIR/inner-attrs.rs:66:21: 66:26 (#0), }, Punct { ch: ',', spacing: Alone, - span: $DIR/inner-attrs.rs:31:26: 31:27 (#0), + span: $DIR/inner-attrs.rs:66:26: 66:27 (#0), }, Ident { ident: "rustc_dummy", - span: $DIR/inner-attrs.rs:31:28: 31:39 (#0), + span: $DIR/inner-attrs.rs:66:28: 66:39 (#0), }, ], - span: $DIR/inner-attrs.rs:31:20: 31:40 (#0), + span: $DIR/inner-attrs.rs:66:20: 66:40 (#0), }, ], - span: $DIR/inner-attrs.rs:31:11: 31:41 (#0), + span: $DIR/inner-attrs.rs:66:11: 66:41 (#0), }, Literal { kind: Integer, symbol: "3", suffix: None, - span: $DIR/inner-attrs.rs:32:9: 32:10 (#0), + span: $DIR/inner-attrs.rs:67:9: 67:10 (#0), }, Punct { ch: ',', spacing: Alone, - span: $DIR/inner-attrs.rs:32:10: 32:11 (#0), + span: $DIR/inner-attrs.rs:67:10: 67:11 (#0), }, Literal { kind: Integer, symbol: "4", suffix: None, - span: $DIR/inner-attrs.rs:32:12: 32:13 (#0), + span: $DIR/inner-attrs.rs:67:12: 67:13 (#0), }, Punct { ch: ',', spacing: Alone, - span: $DIR/inner-attrs.rs:32:13: 32:14 (#0), + span: $DIR/inner-attrs.rs:67:13: 67:14 (#0), }, Group { delimiter: Brace, @@ -370,85 +1038,85 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '#', spacing: Joint, - span: $DIR/inner-attrs.rs:33:13: 33:14 (#0), + span: $DIR/inner-attrs.rs:68:13: 68:14 (#0), }, Punct { ch: '!', spacing: Alone, - span: $DIR/inner-attrs.rs:33:14: 33:15 (#0), + span: $DIR/inner-attrs.rs:68:14: 68:15 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "cfg_attr", - span: $DIR/inner-attrs.rs:33:16: 33:24 (#0), + span: $DIR/inner-attrs.rs:68:16: 68:24 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "not", - span: $DIR/inner-attrs.rs:33:25: 33:28 (#0), + span: $DIR/inner-attrs.rs:68:25: 68:28 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "FALSE", - span: $DIR/inner-attrs.rs:33:29: 33:34 (#0), + span: $DIR/inner-attrs.rs:68:29: 68:34 (#0), }, ], - span: $DIR/inner-attrs.rs:33:28: 33:35 (#0), + span: $DIR/inner-attrs.rs:68:28: 68:35 (#0), }, Punct { ch: ',', spacing: Alone, - span: $DIR/inner-attrs.rs:33:35: 33:36 (#0), + span: $DIR/inner-attrs.rs:68:35: 68:36 (#0), }, Ident { ident: "rustc_dummy", - span: $DIR/inner-attrs.rs:33:37: 33:48 (#0), + span: $DIR/inner-attrs.rs:68:37: 68:48 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "innermost", - span: $DIR/inner-attrs.rs:33:49: 33:58 (#0), + span: $DIR/inner-attrs.rs:68:49: 68:58 (#0), }, ], - span: $DIR/inner-attrs.rs:33:48: 33:59 (#0), + span: $DIR/inner-attrs.rs:68:48: 68:59 (#0), }, ], - span: $DIR/inner-attrs.rs:33:24: 33:60 (#0), + span: $DIR/inner-attrs.rs:68:24: 68:60 (#0), }, ], - span: $DIR/inner-attrs.rs:33:15: 33:61 (#0), + span: $DIR/inner-attrs.rs:68:15: 68:61 (#0), }, Literal { kind: Integer, symbol: "5", suffix: None, - span: $DIR/inner-attrs.rs:34:13: 34:14 (#0), + span: $DIR/inner-attrs.rs:69:13: 69:14 (#0), }, ], - span: $DIR/inner-attrs.rs:32:15: 35:10 (#0), + span: $DIR/inner-attrs.rs:67:15: 70:10 (#0), }, ], - span: $DIR/inner-attrs.rs:30:43: 36:6 (#0), + span: $DIR/inner-attrs.rs:65:43: 71:6 (#0), }, Punct { ch: ';', spacing: Alone, - span: $DIR/inner-attrs.rs:36:6: 36:7 (#0), + span: $DIR/inner-attrs.rs:71:6: 71:7 (#0), }, ] PRINT-ATTR_ARGS INPUT (DISPLAY): array_attrs PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [ Ident { ident: "array_attrs", - span: $DIR/inner-attrs.rs:38:29: 38:40 (#0), + span: $DIR/inner-attrs.rs:73:29: 73:40 (#0), }, ] PRINT-ATTR INPUT (DISPLAY): [# ! [rustc_dummy(inner)] true ; 0] ; @@ -459,82 +1127,82 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '#', spacing: Joint, - span: $DIR/inner-attrs.rs:38:43: 41:7 (#0), + span: $DIR/inner-attrs.rs:73:43: 76:7 (#0), }, Punct { ch: '!', spacing: Alone, - span: $DIR/inner-attrs.rs:38:43: 41:7 (#0), + span: $DIR/inner-attrs.rs:73:43: 76:7 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "rustc_dummy", - span: $DIR/inner-attrs.rs:38:43: 41:7 (#0), + span: $DIR/inner-attrs.rs:73:43: 76:7 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "inner", - span: $DIR/inner-attrs.rs:38:43: 41:7 (#0), + span: $DIR/inner-attrs.rs:73:43: 76:7 (#0), }, ], - span: $DIR/inner-attrs.rs:38:43: 41:7 (#0), + span: $DIR/inner-attrs.rs:73:43: 76:7 (#0), }, ], - span: $DIR/inner-attrs.rs:38:43: 41:7 (#0), + span: $DIR/inner-attrs.rs:73:43: 76:7 (#0), }, Ident { ident: "true", - span: $DIR/inner-attrs.rs:38:43: 41:7 (#0), + span: $DIR/inner-attrs.rs:73:43: 76:7 (#0), }, Punct { ch: ';', spacing: Alone, - span: $DIR/inner-attrs.rs:38:43: 41:7 (#0), + span: $DIR/inner-attrs.rs:73:43: 76:7 (#0), }, Literal { kind: Integer, symbol: "0", suffix: None, - span: $DIR/inner-attrs.rs:38:43: 41:7 (#0), + span: $DIR/inner-attrs.rs:73:43: 76:7 (#0), }, ], - span: $DIR/inner-attrs.rs:38:43: 41:7 (#0), + span: $DIR/inner-attrs.rs:73:43: 76:7 (#0), }, Punct { ch: ';', spacing: Alone, - span: $DIR/inner-attrs.rs:38:43: 41:7 (#0), + span: $DIR/inner-attrs.rs:73:43: 76:7 (#0), }, ] PRINT-ATTR_ARGS INPUT (DISPLAY): tenth PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [ Ident { ident: "tenth", - span: $DIR/inner-attrs.rs:60:42: 60:47 (#0), + span: $DIR/inner-attrs.rs:112:42: 112:47 (#0), }, ] PRINT-ATTR INPUT (DISPLAY): fn weird_extern() { } PRINT-ATTR INPUT (DEBUG): TokenStream [ Ident { ident: "fn", - span: $DIR/inner-attrs.rs:59:5: 61:6 (#0), + span: $DIR/inner-attrs.rs:111:5: 113:6 (#0), }, Ident { ident: "weird_extern", - span: $DIR/inner-attrs.rs:59:5: 61:6 (#0), + span: $DIR/inner-attrs.rs:111:5: 113:6 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [], - span: $DIR/inner-attrs.rs:59:5: 61:6 (#0), + span: $DIR/inner-attrs.rs:111:5: 113:6 (#0), }, Group { delimiter: Brace, stream: TokenStream [], - span: $DIR/inner-attrs.rs:59:5: 61:6 (#0), + span: $DIR/inner-attrs.rs:111:5: 113:6 (#0), }, ] diff --git a/src/test/ui/proc-macro/nonterminal-recollect-attr.rs b/src/test/ui/proc-macro/nonterminal-recollect-attr.rs index 5d4649b78c270..79c4ad4cd2a24 100644 --- a/src/test/ui/proc-macro/nonterminal-recollect-attr.rs +++ b/src/test/ui/proc-macro/nonterminal-recollect-attr.rs @@ -1,6 +1,10 @@ // check-pass +// compile-flags: -Z span-debug // aux-build:nonterminal-recollect-attr.rs +#![no_std] // Don't load unnecessary hygiene information from std +extern crate std; + extern crate nonterminal_recollect_attr; use nonterminal_recollect_attr::*; diff --git a/src/test/ui/proc-macro/nonterminal-recollect-attr.stdout b/src/test/ui/proc-macro/nonterminal-recollect-attr.stdout new file mode 100644 index 0000000000000..7331a25abd328 --- /dev/null +++ b/src/test/ui/proc-macro/nonterminal-recollect-attr.stdout @@ -0,0 +1,72 @@ +First recollected: TokenStream [ + Group { + delimiter: None, + stream: TokenStream [ + Ident { + ident: "pub", + span: $DIR/nonterminal-recollect-attr.rs:20:11: 20:14 (#0), + }, + ], + span: $DIR/nonterminal-recollect-attr.rs:14:9: 14:11 (#4), + }, + Ident { + ident: "struct", + span: $DIR/nonterminal-recollect-attr.rs:14:12: 14:18 (#4), + }, + Ident { + ident: "Foo", + span: $DIR/nonterminal-recollect-attr.rs:14:19: 14:22 (#4), + }, + Group { + delimiter: Brace, + stream: TokenStream [ + Ident { + ident: "field", + span: $DIR/nonterminal-recollect-attr.rs:15:13: 15:18 (#4), + }, + Punct { + ch: ':', + spacing: Alone, + span: $DIR/nonterminal-recollect-attr.rs:15:18: 15:19 (#4), + }, + Ident { + ident: "u8", + span: $DIR/nonterminal-recollect-attr.rs:15:20: 15:22 (#4), + }, + ], + span: $DIR/nonterminal-recollect-attr.rs:14:23: 16:10 (#4), + }, +] +Second recollected: TokenStream [ + Ident { + ident: "pub", + span: $DIR/nonterminal-recollect-attr.rs:20:11: 20:14 (#0), + }, + Ident { + ident: "struct", + span: $DIR/nonterminal-recollect-attr.rs:14:12: 14:18 (#4), + }, + Ident { + ident: "Foo", + span: $DIR/nonterminal-recollect-attr.rs:14:19: 14:22 (#4), + }, + Group { + delimiter: Brace, + stream: TokenStream [ + Ident { + ident: "field", + span: $DIR/nonterminal-recollect-attr.rs:15:13: 15:18 (#4), + }, + Punct { + ch: ':', + spacing: Alone, + span: $DIR/nonterminal-recollect-attr.rs:15:18: 15:19 (#4), + }, + Ident { + ident: "u8", + span: $DIR/nonterminal-recollect-attr.rs:15:20: 15:22 (#4), + }, + ], + span: $DIR/nonterminal-recollect-attr.rs:14:23: 16:10 (#4), + }, +]