From baa3ad4dc846981902926ec230a89f452f5bc370 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Sat, 1 Jan 2022 17:15:47 +0800 Subject: [PATCH] proc-macro: Stop wrapping `ident` matchers into groups --- .../rustc_expand/src/proc_macro_server.rs | 110 +---------- .../capture-macro-rules-invoke.stdout | 12 +- .../actix-web-2.0.0/src/extract.rs | 7 - .../actix-web/src/extract.rs | 7 - .../actori-web-2.0.0/src/extract.rs | 7 - .../actori-web/src/extract.rs | 7 - .../auxiliary/pin-project-internal-0.4.0.rs | 17 -- .../group-compat-hack/group-compat-hack.rs | 87 --------- .../group-compat-hack.stderr | 173 ------------------ .../group-compat-hack.stdout | 11 -- .../js-sys-0.3.17/src/lib.rs | 7 - .../js-sys-0.3.40/src/lib.rs | 7 - .../group-compat-hack/js-sys/src/lib.rs | 7 - .../time-macros-impl-0.1.0/src/lib.rs | 7 - .../time-macros-impl/src/lib.rs | 7 - .../ui/proc-macro/input-interpolated.stdout | 36 +--- .../ui/proc-macro/nested-macro-rules.stdout | 24 +-- .../nonterminal-recollect-attr.stdout | 12 +- 18 files changed, 25 insertions(+), 520 deletions(-) delete mode 100644 src/test/ui/proc-macro/group-compat-hack/actix-web-2.0.0/src/extract.rs delete mode 100644 src/test/ui/proc-macro/group-compat-hack/actix-web/src/extract.rs delete mode 100644 src/test/ui/proc-macro/group-compat-hack/actori-web-2.0.0/src/extract.rs delete mode 100644 src/test/ui/proc-macro/group-compat-hack/actori-web/src/extract.rs delete mode 100644 src/test/ui/proc-macro/group-compat-hack/auxiliary/pin-project-internal-0.4.0.rs delete mode 100644 src/test/ui/proc-macro/group-compat-hack/group-compat-hack.rs delete mode 100644 src/test/ui/proc-macro/group-compat-hack/group-compat-hack.stderr delete mode 100644 src/test/ui/proc-macro/group-compat-hack/group-compat-hack.stdout delete mode 100644 src/test/ui/proc-macro/group-compat-hack/js-sys-0.3.17/src/lib.rs delete mode 100644 src/test/ui/proc-macro/group-compat-hack/js-sys-0.3.40/src/lib.rs delete mode 100644 src/test/ui/proc-macro/group-compat-hack/js-sys/src/lib.rs delete mode 100644 src/test/ui/proc-macro/group-compat-hack/time-macros-impl-0.1.0/src/lib.rs delete mode 100644 src/test/ui/proc-macro/group-compat-hack/time-macros-impl/src/lib.rs diff --git a/compiler/rustc_expand/src/proc_macro_server.rs b/compiler/rustc_expand/src/proc_macro_server.rs index 5bd4bee3adfca..bfdf99762f57a 100644 --- a/compiler/rustc_expand/src/proc_macro_server.rs +++ b/compiler/rustc_expand/src/proc_macro_server.rs @@ -1,22 +1,19 @@ use crate::base::ExtCtxt; use rustc_ast as ast; -use rustc_ast::token::{self, Nonterminal, NtIdent}; +use rustc_ast::token; use rustc_ast::tokenstream::{self, CanSynthesizeMissingTokens}; use rustc_ast::tokenstream::{DelimSpan, Spacing::*, TokenStream, TreeAndSpacing}; use rustc_ast_pretty::pprust; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::sync::Lrc; use rustc_errors::{Diagnostic, PResult}; -use rustc_lint_defs::builtin::PROC_MACRO_BACK_COMPAT; -use rustc_lint_defs::BuiltinLintDiagnostics; use rustc_parse::lexer::nfc_normalize; use rustc_parse::{nt_to_tokenstream, parse_stream_from_source_str}; use rustc_session::parse::ParseSess; use rustc_span::def_id::CrateNum; -use rustc_span::hygiene::ExpnKind; use rustc_span::symbol::{self, kw, sym, Symbol}; -use rustc_span::{BytePos, FileName, MultiSpan, Pos, RealFileName, SourceFile, Span}; +use rustc_span::{BytePos, FileName, MultiSpan, Pos, SourceFile, Span}; use pm::bridge::{server, TokenTree}; use pm::{Delimiter, Level, LineColumn, Spacing}; @@ -178,10 +175,8 @@ impl FromInternal<(TreeAndSpacing, &'_ mut Vec, &mut Rustc<'_, '_>)> tt!(Punct::new('#', false)) } - Interpolated(nt) - if let Some((name, is_raw)) = ident_name_compatibility_hack(&nt, span, rustc) => - { - TokenTree::Ident(Ident::new(rustc.sess(), name.name, is_raw, name.span)) + Interpolated(nt) if let NtIdent(ident, is_raw) = *nt => { + TokenTree::Ident(Ident::new(rustc.sess(), ident.name, is_raw, ident.span)) } Interpolated(nt) => { let stream = nt_to_tokenstream(&nt, rustc.sess(), CanSynthesizeMissingTokens::No); @@ -868,100 +863,3 @@ impl server::Span for Rustc<'_, '_> { }) } } - -// See issue #74616 for details -fn ident_name_compatibility_hack( - nt: &Nonterminal, - orig_span: Span, - rustc: &mut Rustc<'_, '_>, -) -> Option<(rustc_span::symbol::Ident, bool)> { - if let NtIdent(ident, is_raw) = nt { - if let ExpnKind::Macro(_, macro_name) = orig_span.ctxt().outer_expn_data().kind { - let source_map = rustc.sess().source_map(); - let filename = source_map.span_to_filename(orig_span); - if let FileName::Real(RealFileName::LocalPath(path)) = filename { - let matches_prefix = |prefix, filename| { - // Check for a path that ends with 'prefix*/src/' - let mut iter = path.components().rev(); - iter.next().and_then(|p| p.as_os_str().to_str()) == Some(filename) - && iter.next().and_then(|p| p.as_os_str().to_str()) == Some("src") - && iter - .next() - .and_then(|p| p.as_os_str().to_str()) - .map_or(false, |p| p.starts_with(prefix)) - }; - - let time_macros_impl = - macro_name == sym::impl_macros && matches_prefix("time-macros-impl", "lib.rs"); - let js_sys = macro_name == sym::arrays && matches_prefix("js-sys", "lib.rs"); - if time_macros_impl || js_sys { - let snippet = source_map.span_to_snippet(orig_span); - if snippet.as_deref() == Ok("$name") { - if time_macros_impl { - rustc.sess().buffer_lint_with_diagnostic( - &PROC_MACRO_BACK_COMPAT, - orig_span, - ast::CRATE_NODE_ID, - "using an old version of `time-macros-impl`", - BuiltinLintDiagnostics::ProcMacroBackCompat( - "the `time-macros-impl` crate will stop compiling in futures version of Rust. \ - Please update to the latest version of the `time` crate to avoid breakage".to_string()) - ); - return Some((*ident, *is_raw)); - } - if js_sys { - if let Some(c) = path - .components() - .flat_map(|c| c.as_os_str().to_str()) - .find(|c| c.starts_with("js-sys")) - { - let mut version = c.trim_start_matches("js-sys-").split('.'); - if version.next() == Some("0") - && version.next() == Some("3") - && version - .next() - .and_then(|c| c.parse::().ok()) - .map_or(false, |v| v < 40) - { - rustc.sess().buffer_lint_with_diagnostic( - &PROC_MACRO_BACK_COMPAT, - orig_span, - ast::CRATE_NODE_ID, - "using an old version of `js-sys`", - BuiltinLintDiagnostics::ProcMacroBackCompat( - "older versions of the `js-sys` crate will stop compiling in future versions of Rust; \ - please update to `js-sys` v0.3.40 or above".to_string()) - ); - return Some((*ident, *is_raw)); - } - } - } - } - } - - if macro_name == sym::tuple_from_req && matches_prefix("actix-web", "extract.rs") { - let snippet = source_map.span_to_snippet(orig_span); - if snippet.as_deref() == Ok("$T") { - if let FileName::Real(RealFileName::LocalPath(macro_path)) = - source_map.span_to_filename(rustc.def_site) - { - if macro_path.to_string_lossy().contains("pin-project-internal-0.") { - rustc.sess().buffer_lint_with_diagnostic( - &PROC_MACRO_BACK_COMPAT, - orig_span, - ast::CRATE_NODE_ID, - "using an old version of `actix-web`", - BuiltinLintDiagnostics::ProcMacroBackCompat( - "the version of `actix-web` you are using might stop compiling in future versions of Rust; \ - please update to the latest version of the `actix-web` crate to avoid breakage".to_string()) - ); - return Some((*ident, *is_raw)); - } - } - } - } - } - } - } - None -} diff --git a/src/test/ui/proc-macro/capture-macro-rules-invoke.stdout b/src/test/ui/proc-macro/capture-macro-rules-invoke.stdout index 0e7b429d621ff..4de8746a1b460 100644 --- a/src/test/ui/proc-macro/capture-macro-rules-invoke.stdout +++ b/src/test/ui/proc-macro/capture-macro-rules-invoke.stdout @@ -112,15 +112,9 @@ PRINT-BANG INPUT (DEBUG): TokenStream [ spacing: Alone, span: $DIR/capture-macro-rules-invoke.rs:14:54: 14:55 (#8), }, - Group { - delimiter: None, - stream: TokenStream [ - Ident { - ident: "my_name", - span: $DIR/capture-macro-rules-invoke.rs:42:13: 42:20 (#0), - }, - ], - span: $DIR/capture-macro-rules-invoke.rs:14:56: 14:62 (#8), + Ident { + ident: "my_name", + span: $DIR/capture-macro-rules-invoke.rs:42:13: 42:20 (#0), }, Punct { ch: ',', diff --git a/src/test/ui/proc-macro/group-compat-hack/actix-web-2.0.0/src/extract.rs b/src/test/ui/proc-macro/group-compat-hack/actix-web-2.0.0/src/extract.rs deleted file mode 100644 index 2d4f6010012df..0000000000000 --- a/src/test/ui/proc-macro/group-compat-hack/actix-web-2.0.0/src/extract.rs +++ /dev/null @@ -1,7 +0,0 @@ -// ignore-test this is not a test - -macro_rules! tuple_from_req { - ($T:ident) => { - #[my_macro] struct Three($T); - } -} diff --git a/src/test/ui/proc-macro/group-compat-hack/actix-web/src/extract.rs b/src/test/ui/proc-macro/group-compat-hack/actix-web/src/extract.rs deleted file mode 100644 index 2d4f6010012df..0000000000000 --- a/src/test/ui/proc-macro/group-compat-hack/actix-web/src/extract.rs +++ /dev/null @@ -1,7 +0,0 @@ -// ignore-test this is not a test - -macro_rules! tuple_from_req { - ($T:ident) => { - #[my_macro] struct Three($T); - } -} diff --git a/src/test/ui/proc-macro/group-compat-hack/actori-web-2.0.0/src/extract.rs b/src/test/ui/proc-macro/group-compat-hack/actori-web-2.0.0/src/extract.rs deleted file mode 100644 index 9ec6aba63f35f..0000000000000 --- a/src/test/ui/proc-macro/group-compat-hack/actori-web-2.0.0/src/extract.rs +++ /dev/null @@ -1,7 +0,0 @@ -// ignore-test this is not a test - -macro_rules! tuple_from_req { - ($T:ident) => { - #[my_macro] struct Four($T); - } -} diff --git a/src/test/ui/proc-macro/group-compat-hack/actori-web/src/extract.rs b/src/test/ui/proc-macro/group-compat-hack/actori-web/src/extract.rs deleted file mode 100644 index 9ec6aba63f35f..0000000000000 --- a/src/test/ui/proc-macro/group-compat-hack/actori-web/src/extract.rs +++ /dev/null @@ -1,7 +0,0 @@ -// ignore-test this is not a test - -macro_rules! tuple_from_req { - ($T:ident) => { - #[my_macro] struct Four($T); - } -} diff --git a/src/test/ui/proc-macro/group-compat-hack/auxiliary/pin-project-internal-0.4.0.rs b/src/test/ui/proc-macro/group-compat-hack/auxiliary/pin-project-internal-0.4.0.rs deleted file mode 100644 index baa4fd3a10559..0000000000000 --- a/src/test/ui/proc-macro/group-compat-hack/auxiliary/pin-project-internal-0.4.0.rs +++ /dev/null @@ -1,17 +0,0 @@ -// force-host -// no-prefer-dynamic - -#![crate_type = "proc-macro"] -#![crate_name = "group_compat_hack"] - -// This file has an unusual name in order to trigger the back-compat -// code in the compiler - -extern crate proc_macro; -use proc_macro::TokenStream; - -#[proc_macro_attribute] -pub fn my_macro(_attr: TokenStream, input: TokenStream) -> TokenStream { - println!("Called proc_macro_hack with {:?}", input); - input -} diff --git a/src/test/ui/proc-macro/group-compat-hack/group-compat-hack.rs b/src/test/ui/proc-macro/group-compat-hack/group-compat-hack.rs deleted file mode 100644 index 3a2a6fa2253fa..0000000000000 --- a/src/test/ui/proc-macro/group-compat-hack/group-compat-hack.rs +++ /dev/null @@ -1,87 +0,0 @@ -// aux-build:pin-project-internal-0.4.0.rs -// compile-flags: -Z span-debug - -#![no_std] // Don't load unnecessary hygiene information from std -extern crate std; - -#[macro_use] extern crate group_compat_hack; - -// Tests the backwards compatibility hack added for certain macros -// When an attribute macro named `proc_macro_hack` or `wasm_bindgen` -// has an `NtIdent` named `$name`, we pass a plain `Ident` token in -// place of a `None`-delimited group. This allows us to maintain -// backwards compatibility for older versions of these crates. - -mod no_version { - include!("js-sys/src/lib.rs"); - include!("time-macros-impl/src/lib.rs"); - - macro_rules! other { - ($name:ident) => { - #[my_macro] struct Three($name); - } - } - - struct Foo; - impl_macros!(Foo); //~ ERROR using an old version - //~| WARN this was previously - arrays!(Foo); - other!(Foo); -} - -mod with_version { - include!("js-sys-0.3.17/src/lib.rs"); - include!("time-macros-impl-0.1.0/src/lib.rs"); - - macro_rules! other { - ($name:ident) => { - #[my_macro] struct Three($name); - } - } - - struct Foo; - impl_macros!(Foo); //~ ERROR using an old version - //~| WARN this was previously - arrays!(Foo); //~ ERROR using an old version - //~| WARN this was previously - other!(Foo); -} - -mod actix_web_test { - include!("actix-web/src/extract.rs"); - - struct Foo; - tuple_from_req!(Foo); //~ ERROR using an old version - //~| WARN this was previously -} - -mod actix_web_version_test { - include!("actix-web-2.0.0/src/extract.rs"); - - struct Foo; - tuple_from_req!(Foo); //~ ERROR using an old version - //~| WARN this was previously -} - -mod actori_web_test { - include!("actori-web/src/extract.rs"); - - struct Foo; - tuple_from_req!(Foo); -} - -mod actori_web_version_test { - include!("actori-web-2.0.0/src/extract.rs"); - - struct Foo; - tuple_from_req!(Foo); -} - -mod with_good_js_sys_version { - include!("js-sys-0.3.40/src/lib.rs"); - struct Foo; - arrays!(Foo); -} - - -fn main() {} diff --git a/src/test/ui/proc-macro/group-compat-hack/group-compat-hack.stderr b/src/test/ui/proc-macro/group-compat-hack/group-compat-hack.stderr deleted file mode 100644 index acba357b0d336..0000000000000 --- a/src/test/ui/proc-macro/group-compat-hack/group-compat-hack.stderr +++ /dev/null @@ -1,173 +0,0 @@ -error: using an old version of `time-macros-impl` - --> $DIR/time-macros-impl/src/lib.rs:5:32 - | -LL | #[my_macro] struct One($name); - | ^^^^^ - | - ::: $DIR/group-compat-hack.rs:26:5 - | -LL | impl_macros!(Foo); - | ----------------- in this macro invocation - | - = note: `#[deny(proc_macro_back_compat)]` on by default - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #83125 - = note: the `time-macros-impl` crate will stop compiling in futures version of Rust. Please update to the latest version of the `time` crate to avoid breakage - = note: this error originates in the macro `impl_macros` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: using an old version of `time-macros-impl` - --> $DIR/time-macros-impl-0.1.0/src/lib.rs:5:32 - | -LL | #[my_macro] struct One($name); - | ^^^^^ - | - ::: $DIR/group-compat-hack.rs:43:5 - | -LL | impl_macros!(Foo); - | ----------------- in this macro invocation - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #83125 - = note: the `time-macros-impl` crate will stop compiling in futures version of Rust. Please update to the latest version of the `time` crate to avoid breakage - = note: this error originates in the macro `impl_macros` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: using an old version of `js-sys` - --> $DIR/js-sys-0.3.17/src/lib.rs:5:32 - | -LL | #[my_macro] struct Two($name); - | ^^^^^ - | - ::: $DIR/group-compat-hack.rs:45:5 - | -LL | arrays!(Foo); - | ------------ in this macro invocation - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #83125 - = note: older versions of the `js-sys` crate will stop compiling in future versions of Rust; please update to `js-sys` v0.3.40 or above - = note: this error originates in the macro `arrays` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: using an old version of `actix-web` - --> $DIR/actix-web/src/extract.rs:5:34 - | -LL | #[my_macro] struct Three($T); - | ^^ - | - ::: $DIR/group-compat-hack.rs:54:5 - | -LL | tuple_from_req!(Foo); - | -------------------- in this macro invocation - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #83125 - = note: the version of `actix-web` you are using might stop compiling in future versions of Rust; please update to the latest version of the `actix-web` crate to avoid breakage - = note: this error originates in the macro `tuple_from_req` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: using an old version of `actix-web` - --> $DIR/actix-web-2.0.0/src/extract.rs:5:34 - | -LL | #[my_macro] struct Three($T); - | ^^ - | - ::: $DIR/group-compat-hack.rs:62:5 - | -LL | tuple_from_req!(Foo); - | -------------------- in this macro invocation - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #83125 - = note: the version of `actix-web` you are using might stop compiling in future versions of Rust; please update to the latest version of the `actix-web` crate to avoid breakage - = note: this error originates in the macro `tuple_from_req` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to 5 previous errors - -Future incompatibility report: Future breakage diagnostic: -error: using an old version of `time-macros-impl` - --> $DIR/time-macros-impl/src/lib.rs:5:32 - | -LL | #[my_macro] struct One($name); - | ^^^^^ - | - ::: $DIR/group-compat-hack.rs:26:5 - | -LL | impl_macros!(Foo); - | ----------------- in this macro invocation - | - = note: `#[deny(proc_macro_back_compat)]` on by default - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #83125 - = note: the `time-macros-impl` crate will stop compiling in futures version of Rust. Please update to the latest version of the `time` crate to avoid breakage - = note: this error originates in the macro `impl_macros` (in Nightly builds, run with -Z macro-backtrace for more info) - -Future breakage diagnostic: -error: using an old version of `time-macros-impl` - --> $DIR/time-macros-impl-0.1.0/src/lib.rs:5:32 - | -LL | #[my_macro] struct One($name); - | ^^^^^ - | - ::: $DIR/group-compat-hack.rs:43:5 - | -LL | impl_macros!(Foo); - | ----------------- in this macro invocation - | - = note: `#[deny(proc_macro_back_compat)]` on by default - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #83125 - = note: the `time-macros-impl` crate will stop compiling in futures version of Rust. Please update to the latest version of the `time` crate to avoid breakage - = note: this error originates in the macro `impl_macros` (in Nightly builds, run with -Z macro-backtrace for more info) - -Future breakage diagnostic: -error: using an old version of `js-sys` - --> $DIR/js-sys-0.3.17/src/lib.rs:5:32 - | -LL | #[my_macro] struct Two($name); - | ^^^^^ - | - ::: $DIR/group-compat-hack.rs:45:5 - | -LL | arrays!(Foo); - | ------------ in this macro invocation - | - = note: `#[deny(proc_macro_back_compat)]` on by default - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #83125 - = note: older versions of the `js-sys` crate will stop compiling in future versions of Rust; please update to `js-sys` v0.3.40 or above - = note: this error originates in the macro `arrays` (in Nightly builds, run with -Z macro-backtrace for more info) - -Future breakage diagnostic: -error: using an old version of `actix-web` - --> $DIR/actix-web/src/extract.rs:5:34 - | -LL | #[my_macro] struct Three($T); - | ^^ - | - ::: $DIR/group-compat-hack.rs:54:5 - | -LL | tuple_from_req!(Foo); - | -------------------- in this macro invocation - | - = note: `#[deny(proc_macro_back_compat)]` on by default - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #83125 - = note: the version of `actix-web` you are using might stop compiling in future versions of Rust; please update to the latest version of the `actix-web` crate to avoid breakage - = note: this error originates in the macro `tuple_from_req` (in Nightly builds, run with -Z macro-backtrace for more info) - -Future breakage diagnostic: -error: using an old version of `actix-web` - --> $DIR/actix-web-2.0.0/src/extract.rs:5:34 - | -LL | #[my_macro] struct Three($T); - | ^^ - | - ::: $DIR/group-compat-hack.rs:62:5 - | -LL | tuple_from_req!(Foo); - | -------------------- in this macro invocation - | - = note: `#[deny(proc_macro_back_compat)]` on by default - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #83125 - = note: the version of `actix-web` you are using might stop compiling in future versions of Rust; please update to the latest version of the `actix-web` crate to avoid breakage - = note: this error originates in the macro `tuple_from_req` (in Nightly builds, run with -Z macro-backtrace for more info) - diff --git a/src/test/ui/proc-macro/group-compat-hack/group-compat-hack.stdout b/src/test/ui/proc-macro/group-compat-hack/group-compat-hack.stdout deleted file mode 100644 index 51312b10ad176..0000000000000 --- a/src/test/ui/proc-macro/group-compat-hack/group-compat-hack.stdout +++ /dev/null @@ -1,11 +0,0 @@ -Called proc_macro_hack with TokenStream [Ident { ident: "struct", span: $DIR/time-macros-impl/src/lib.rs:5:21: 5:27 (#6) }, Ident { ident: "One", span: $DIR/time-macros-impl/src/lib.rs:5:28: 5:31 (#6) }, Group { delimiter: Parenthesis, stream: TokenStream [Ident { ident: "Foo", span: $DIR/group-compat-hack.rs:26:18: 26:21 (#0) }], span: $DIR/time-macros-impl/src/lib.rs:5:31: 5:38 (#6) }, Punct { ch: ';', spacing: Alone, span: $DIR/time-macros-impl/src/lib.rs:5:38: 5:39 (#6) }] -Called proc_macro_hack with TokenStream [Ident { ident: "struct", span: $DIR/js-sys/src/lib.rs:5:21: 5:27 (#10) }, Ident { ident: "Two", span: $DIR/js-sys/src/lib.rs:5:28: 5:31 (#10) }, Group { delimiter: Parenthesis, stream: TokenStream [Group { delimiter: None, stream: TokenStream [Ident { ident: "Foo", span: $DIR/group-compat-hack.rs:28:13: 28:16 (#0) }], span: $DIR/js-sys/src/lib.rs:5:32: 5:37 (#10) }], span: $DIR/js-sys/src/lib.rs:5:31: 5:38 (#10) }, Punct { ch: ';', spacing: Alone, span: $DIR/js-sys/src/lib.rs:5:38: 5:39 (#10) }] -Called proc_macro_hack with TokenStream [Ident { ident: "struct", span: $DIR/group-compat-hack.rs:21:25: 21:31 (#14) }, Ident { ident: "Three", span: $DIR/group-compat-hack.rs:21:32: 21:37 (#14) }, Group { delimiter: Parenthesis, stream: TokenStream [Group { delimiter: None, stream: TokenStream [Ident { ident: "Foo", span: $DIR/group-compat-hack.rs:29:12: 29:15 (#0) }], span: $DIR/group-compat-hack.rs:21:38: 21:43 (#14) }], span: $DIR/group-compat-hack.rs:21:37: 21:44 (#14) }, Punct { ch: ';', spacing: Alone, span: $DIR/group-compat-hack.rs:21:44: 21:45 (#14) }] -Called proc_macro_hack with TokenStream [Ident { ident: "struct", span: $DIR/time-macros-impl-0.1.0/src/lib.rs:5:21: 5:27 (#20) }, Ident { ident: "One", span: $DIR/time-macros-impl-0.1.0/src/lib.rs:5:28: 5:31 (#20) }, Group { delimiter: Parenthesis, stream: TokenStream [Ident { ident: "Foo", span: $DIR/group-compat-hack.rs:43:18: 43:21 (#0) }], span: $DIR/time-macros-impl-0.1.0/src/lib.rs:5:31: 5:38 (#20) }, Punct { ch: ';', spacing: Alone, span: $DIR/time-macros-impl-0.1.0/src/lib.rs:5:38: 5:39 (#20) }] -Called proc_macro_hack with TokenStream [Ident { ident: "struct", span: $DIR/js-sys-0.3.17/src/lib.rs:5:21: 5:27 (#24) }, Ident { ident: "Two", span: $DIR/js-sys-0.3.17/src/lib.rs:5:28: 5:31 (#24) }, Group { delimiter: Parenthesis, stream: TokenStream [Ident { ident: "Foo", span: $DIR/group-compat-hack.rs:45:13: 45:16 (#0) }], span: $DIR/js-sys-0.3.17/src/lib.rs:5:31: 5:38 (#24) }, Punct { ch: ';', spacing: Alone, span: $DIR/js-sys-0.3.17/src/lib.rs:5:38: 5:39 (#24) }] -Called proc_macro_hack with TokenStream [Ident { ident: "struct", span: $DIR/group-compat-hack.rs:38:25: 38:31 (#28) }, Ident { ident: "Three", span: $DIR/group-compat-hack.rs:38:32: 38:37 (#28) }, Group { delimiter: Parenthesis, stream: TokenStream [Group { delimiter: None, stream: TokenStream [Ident { ident: "Foo", span: $DIR/group-compat-hack.rs:47:12: 47:15 (#0) }], span: $DIR/group-compat-hack.rs:38:38: 38:43 (#28) }], span: $DIR/group-compat-hack.rs:38:37: 38:44 (#28) }, Punct { ch: ';', spacing: Alone, span: $DIR/group-compat-hack.rs:38:44: 38:45 (#28) }] -Called proc_macro_hack with TokenStream [Ident { ident: "struct", span: $DIR/actix-web/src/extract.rs:5:21: 5:27 (#33) }, Ident { ident: "Three", span: $DIR/actix-web/src/extract.rs:5:28: 5:33 (#33) }, Group { delimiter: Parenthesis, stream: TokenStream [Ident { ident: "Foo", span: $DIR/group-compat-hack.rs:54:21: 54:24 (#0) }], span: $DIR/actix-web/src/extract.rs:5:33: 5:37 (#33) }, Punct { ch: ';', spacing: Alone, span: $DIR/actix-web/src/extract.rs:5:37: 5:38 (#33) }] -Called proc_macro_hack with TokenStream [Ident { ident: "struct", span: $DIR/actix-web-2.0.0/src/extract.rs:5:21: 5:27 (#38) }, Ident { ident: "Three", span: $DIR/actix-web-2.0.0/src/extract.rs:5:28: 5:33 (#38) }, Group { delimiter: Parenthesis, stream: TokenStream [Ident { ident: "Foo", span: $DIR/group-compat-hack.rs:62:21: 62:24 (#0) }], span: $DIR/actix-web-2.0.0/src/extract.rs:5:33: 5:37 (#38) }, Punct { ch: ';', spacing: Alone, span: $DIR/actix-web-2.0.0/src/extract.rs:5:37: 5:38 (#38) }] -Called proc_macro_hack with TokenStream [Ident { ident: "struct", span: $DIR/actori-web/src/extract.rs:5:21: 5:27 (#43) }, Ident { ident: "Four", span: $DIR/actori-web/src/extract.rs:5:28: 5:32 (#43) }, Group { delimiter: Parenthesis, stream: TokenStream [Group { delimiter: None, stream: TokenStream [Ident { ident: "Foo", span: $DIR/group-compat-hack.rs:70:21: 70:24 (#0) }], span: $DIR/actori-web/src/extract.rs:5:33: 5:35 (#43) }], span: $DIR/actori-web/src/extract.rs:5:32: 5:36 (#43) }, Punct { ch: ';', spacing: Alone, span: $DIR/actori-web/src/extract.rs:5:36: 5:37 (#43) }] -Called proc_macro_hack with TokenStream [Ident { ident: "struct", span: $DIR/actori-web-2.0.0/src/extract.rs:5:21: 5:27 (#48) }, Ident { ident: "Four", span: $DIR/actori-web-2.0.0/src/extract.rs:5:28: 5:32 (#48) }, Group { delimiter: Parenthesis, stream: TokenStream [Group { delimiter: None, stream: TokenStream [Ident { ident: "Foo", span: $DIR/group-compat-hack.rs:77:21: 77:24 (#0) }], span: $DIR/actori-web-2.0.0/src/extract.rs:5:33: 5:35 (#48) }], span: $DIR/actori-web-2.0.0/src/extract.rs:5:32: 5:36 (#48) }, Punct { ch: ';', spacing: Alone, span: $DIR/actori-web-2.0.0/src/extract.rs:5:36: 5:37 (#48) }] -Called proc_macro_hack with TokenStream [Ident { ident: "struct", span: $DIR/js-sys-0.3.40/src/lib.rs:5:21: 5:27 (#53) }, Ident { ident: "Two", span: $DIR/js-sys-0.3.40/src/lib.rs:5:28: 5:31 (#53) }, Group { delimiter: Parenthesis, stream: TokenStream [Group { delimiter: None, stream: TokenStream [Ident { ident: "Foo", span: $DIR/group-compat-hack.rs:83:13: 83:16 (#0) }], span: $DIR/js-sys-0.3.40/src/lib.rs:5:32: 5:37 (#53) }], span: $DIR/js-sys-0.3.40/src/lib.rs:5:31: 5:38 (#53) }, Punct { ch: ';', spacing: Alone, span: $DIR/js-sys-0.3.40/src/lib.rs:5:38: 5:39 (#53) }] diff --git a/src/test/ui/proc-macro/group-compat-hack/js-sys-0.3.17/src/lib.rs b/src/test/ui/proc-macro/group-compat-hack/js-sys-0.3.17/src/lib.rs deleted file mode 100644 index d1a66940ebf3c..0000000000000 --- a/src/test/ui/proc-macro/group-compat-hack/js-sys-0.3.17/src/lib.rs +++ /dev/null @@ -1,7 +0,0 @@ -// ignore-test this is not a test - -macro_rules! arrays { - ($name:ident) => { - #[my_macro] struct Two($name); - } -} diff --git a/src/test/ui/proc-macro/group-compat-hack/js-sys-0.3.40/src/lib.rs b/src/test/ui/proc-macro/group-compat-hack/js-sys-0.3.40/src/lib.rs deleted file mode 100644 index d1a66940ebf3c..0000000000000 --- a/src/test/ui/proc-macro/group-compat-hack/js-sys-0.3.40/src/lib.rs +++ /dev/null @@ -1,7 +0,0 @@ -// ignore-test this is not a test - -macro_rules! arrays { - ($name:ident) => { - #[my_macro] struct Two($name); - } -} diff --git a/src/test/ui/proc-macro/group-compat-hack/js-sys/src/lib.rs b/src/test/ui/proc-macro/group-compat-hack/js-sys/src/lib.rs deleted file mode 100644 index d1a66940ebf3c..0000000000000 --- a/src/test/ui/proc-macro/group-compat-hack/js-sys/src/lib.rs +++ /dev/null @@ -1,7 +0,0 @@ -// ignore-test this is not a test - -macro_rules! arrays { - ($name:ident) => { - #[my_macro] struct Two($name); - } -} diff --git a/src/test/ui/proc-macro/group-compat-hack/time-macros-impl-0.1.0/src/lib.rs b/src/test/ui/proc-macro/group-compat-hack/time-macros-impl-0.1.0/src/lib.rs deleted file mode 100644 index c94c357920974..0000000000000 --- a/src/test/ui/proc-macro/group-compat-hack/time-macros-impl-0.1.0/src/lib.rs +++ /dev/null @@ -1,7 +0,0 @@ -// ignore-test this is not a test - -macro_rules! impl_macros { - ($name:ident) => { - #[my_macro] struct One($name); - } -} diff --git a/src/test/ui/proc-macro/group-compat-hack/time-macros-impl/src/lib.rs b/src/test/ui/proc-macro/group-compat-hack/time-macros-impl/src/lib.rs deleted file mode 100644 index c94c357920974..0000000000000 --- a/src/test/ui/proc-macro/group-compat-hack/time-macros-impl/src/lib.rs +++ /dev/null @@ -1,7 +0,0 @@ -// ignore-test this is not a test - -macro_rules! impl_macros { - ($name:ident) => { - #[my_macro] struct One($name); - } -} diff --git a/src/test/ui/proc-macro/input-interpolated.stdout b/src/test/ui/proc-macro/input-interpolated.stdout index 44baa37577cfa..34566c7801944 100644 --- a/src/test/ui/proc-macro/input-interpolated.stdout +++ b/src/test/ui/proc-macro/input-interpolated.stdout @@ -1,14 +1,8 @@ PRINT-BANG INPUT (DISPLAY): A PRINT-BANG INPUT (DEBUG): TokenStream [ - Group { - delimiter: None, - stream: TokenStream [ - Ident { - ident: "A", - span: #0 bytes(503..504), - }, - ], - span: #4 bytes(370..372), + Ident { + ident: "A", + span: #0 bytes(503..504), }, ] PRINT-ATTR INPUT (DISPLAY): const A : u8 = 0 ; @@ -17,15 +11,9 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ ident: "const", span: #4 bytes(416..421), }, - Group { - delimiter: None, - stream: TokenStream [ - Ident { - ident: "A", - span: #0 bytes(503..504), - }, - ], - span: #4 bytes(422..424), + Ident { + ident: "A", + span: #0 bytes(503..504), }, Punct { ch: ':', @@ -59,15 +47,9 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [ ident: "struct", span: #4 bytes(468..474), }, - Group { - delimiter: None, - stream: TokenStream [ - Ident { - ident: "A", - span: #0 bytes(503..504), - }, - ], - span: #4 bytes(475..477), + Ident { + ident: "A", + span: #0 bytes(503..504), }, Group { delimiter: Brace, diff --git a/src/test/ui/proc-macro/nested-macro-rules.stdout b/src/test/ui/proc-macro/nested-macro-rules.stdout index 68f30c23a8d28..fa35e81148b07 100644 --- a/src/test/ui/proc-macro/nested-macro-rules.stdout +++ b/src/test/ui/proc-macro/nested-macro-rules.stdout @@ -35,15 +35,9 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ ] PRINT-BANG INPUT (DISPLAY): SecondStruct PRINT-BANG INPUT (DEBUG): TokenStream [ - Group { - delimiter: None, - stream: TokenStream [ - Ident { - ident: "SecondStruct", - span: $DIR/nested-macro-rules.rs:21:38: 21:50 (#16), - }, - ], - span: $DIR/auxiliary/nested-macro-rules.rs:9:30: 9:35 (#15), + Ident { + ident: "SecondStruct", + span: $DIR/nested-macro-rules.rs:21:38: 21:50 (#16), }, ] PRINT-ATTR INPUT (DISPLAY): struct SecondAttrStruct {} @@ -52,15 +46,9 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ ident: "struct", span: $DIR/auxiliary/nested-macro-rules.rs:10:32: 10:38 (#15), }, - Group { - delimiter: None, - stream: TokenStream [ - Ident { - ident: "SecondAttrStruct", - span: $DIR/nested-macro-rules.rs:21:52: 21:68 (#16), - }, - ], - span: $DIR/auxiliary/nested-macro-rules.rs:10:39: 10:56 (#15), + Ident { + ident: "SecondAttrStruct", + span: $DIR/nested-macro-rules.rs:21:52: 21:68 (#16), }, Group { delimiter: Brace, diff --git a/src/test/ui/proc-macro/nonterminal-recollect-attr.stdout b/src/test/ui/proc-macro/nonterminal-recollect-attr.stdout index 7331a25abd328..6824395ae4056 100644 --- a/src/test/ui/proc-macro/nonterminal-recollect-attr.stdout +++ b/src/test/ui/proc-macro/nonterminal-recollect-attr.stdout @@ -1,13 +1,7 @@ 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: "pub", + span: $DIR/nonterminal-recollect-attr.rs:20:11: 20:14 (#0), }, Ident { ident: "struct",