diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-05-27 09:00:48 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-05-28 08:15:15 +1000 |
| commit | cf0c2c73334eb1c7c6a45e2603244238e4bd3ef7 (patch) | |
| tree | 0d67667a2df1e0e54a318dc988bd02d8fc7baab7 /compiler/rustc_expand/src/proc_macro_server.rs | |
| parent | 3607cee3e7009c91dfdf3d4f8669ac8156a36ac0 (diff) | |
| download | rust-cf0c2c73334eb1c7c6a45e2603244238e4bd3ef7.tar.gz rust-cf0c2c73334eb1c7c6a45e2603244238e4bd3ef7.zip | |
Convert `proc_macro_back_compat` lint to an unconditional error.
We still check for the `rental`/`allsorts-rental` crates. But now if they are detected we just emit a fatal error, instead of emitting a warning and providing alternative behaviour. The original "hack" implementing alternative behaviour was added in #73345. The lint was added in #83127. The tracking issue is #83125. The direct motivation for the change is that providing the alternative behaviour is interfering with #125174 and follow-on work.
Diffstat (limited to 'compiler/rustc_expand/src/proc_macro_server.rs')
| -rw-r--r-- | compiler/rustc_expand/src/proc_macro_server.rs | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/compiler/rustc_expand/src/proc_macro_server.rs b/compiler/rustc_expand/src/proc_macro_server.rs index ec7e4416b91..c2e799abae8 100644 --- a/compiler/rustc_expand/src/proc_macro_server.rs +++ b/compiler/rustc_expand/src/proc_macro_server.rs @@ -276,21 +276,20 @@ impl FromInternal<(TokenStream, &mut Rustc<'_, '_>)> for Vec<TokenTree<TokenStre Interpolated(nt) => { let stream = TokenStream::from_nonterminal_ast(&nt); - // A hack used to pass AST fragments to attribute and derive - // macros as a single nonterminal token instead of a token - // stream. Such token needs to be "unwrapped" and not - // represented as a delimited group. - // FIXME: It needs to be removed, but there are some - // compatibility issues (see #73345). - if crate::base::nt_pretty_printing_compatibility_hack(&nt, rustc.ecx.sess) { - trees.extend(Self::from_internal((stream, rustc))); - } else { - trees.push(TokenTree::Group(Group { - delimiter: pm::Delimiter::None, - stream: Some(stream), - span: DelimSpan::from_single(span), - })) - } + // We used to have an alternative behaviour for crates that + // needed it: a hack used to pass AST fragments to + // attribute and derive macros as a single nonterminal + // token instead of a token stream. Such token needs to be + // "unwrapped" and not represented as a delimited group. We + // had a lint for a long time, but now we just emit a hard + // error. Eventually we might remove the special case hard + // error check altogether. See #73345. + crate::base::nt_pretty_printing_compatibility_hack(&nt, rustc.ecx.sess); + trees.push(TokenTree::Group(Group { + delimiter: pm::Delimiter::None, + stream: Some(stream), + span: DelimSpan::from_single(span), + })) } OpenDelim(..) | CloseDelim(..) => unreachable!(), |
