Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustc_expand can be tricked into infinite loops #95698

Open
jyn514 opened this issue Apr 5, 2022 · 9 comments · May be fixed by #103029
Open

rustc_expand can be tricked into infinite loops #95698

jyn514 opened this issue Apr 5, 2022 · 9 comments · May be fixed by #103029
Assignees
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) C-bug Category: This is a bug. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@jyn514
Copy link
Member

jyn514 commented Apr 5, 2022

I tried this code:

macro_rules! from_cow_impls {
    ($( $from: ty ),+ $(,)? ) => {
        from_cow_impls!(
            $($from, Cow::from),+
        );
    };

    ($( $from: ty, $normalizer: expr ),+ $(,)? ) => {
        $( impl<'a> From<$from> for LhsValue<'a> {
            fn from(val: $from) -> Self {
                LhsValue::Bytes($normalizer(val))
            }
        } )+
    };
}

from_cow_impls!(
    &'a [u8],
    Vec<u8>,
);
from_cow_impls!(
    &'a str, |x: &'a str| Cow::from(x.as_bytes()),
    String, |x: String| Cow::from(x.into_bytes()),
);

I expected to see this happen: Compilation succeeds or errors.

Instead, this happened: The compiler hangs indefinitely. GDB shows it stuck in https://doc.rust-lang.org/nightly/nightly-rustc/rustc_expand/mbe/macro_parser/struct.TtParser.html#method.parse_tt.

Meta

rustc --version --verbose:

rustc 1.59.0 (9d1b2106e 2022-02-23)
Backtrace

(gdb) thread apply all where

Thread 2 (Thread 0x7fffee5ff700 (LWP 1722086)):
#0  0x00007ffff646182f in <rustc_parse::parser::Parser>::parse_nonterminal () from /home/jnelson/.local/lib/rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-028c2c06c3edd7fd.so
#1  0x00007ffff6409ea2 in rustc_expand::mbe::macro_parser::parse_tt () from /home/jnelson/.local/lib/rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-028c2c06c3edd7fd.so
#2  0x00007ffff63febb2 in <rustc_expand::mbe::macro_rules::MacroRulesMacroExpander as rustc_expand::base::TTMacroExpander>::expand () from /home/jnelson/.local/lib/rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-028c2c06c3edd7fd.so
#3  0x00007ffff63bd29c in <rustc_expand::expand::MacroExpander>::fully_expand_fragment () from /home/jnelson/.local/lib/rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-028c2c06c3edd7fd.so
#4  0x00007ffff6d5b2a1 in <rustc_expand::expand::MacroExpander>::expand_crate () from /home/jnelson/.local/lib/rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-028c2c06c3edd7fd.so
#5  0x00007ffff67a9143 in <rustc_session::session::Session>::time::<core::result::Result<rustc_ast::ast::Crate, rustc_errors::ErrorReported>, rustc_interface::passes::configure_and_expand::{closure#1}> () from /home/jnelson/.local/lib/rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-028c2c06c3edd7fd.so
#6  0x00007ffff6789009 in rustc_interface::passes::configure_and_expand () from /home/jnelson/.local/lib/rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-028c2c06c3edd7fd.so
#7  0x00007ffff678d597 in <rustc_interface::queries::Queries>::expansion () from /home/jnelson/.local/lib/rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-028c2c06c3edd7fd.so
#8  0x00007ffff676b76a in <rustc_interface::interface::Compiler>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_errors::ErrorReported>> () from /home/jnelson/.local/lib/rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-028c2c06c3edd7fd.so
#9  0x00007ffff674e97c in rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorReported>, rustc_interface::interface::create_compiler_and_run<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>::{closure#1}> () from /home/jnelson/.local/lib/rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-028c2c06c3edd7fd.so
#10 0x00007ffff676acfe in rustc_interface::interface::create_compiler_and_run::<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}> () from /home/jnelson/.local/lib/rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-028c2c06c3edd7fd.so
#11 0x00007ffff674fedb in <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>> () from /home/jnelson/.local/lib/rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-028c2c06c3edd7fd.so
#12 0x00007ffff674fcd5 in std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>> () from /home/jnelson/.local/lib/rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-028c2c06c3edd7fd.so
#13 0x00007ffff677b499 in <<std::thread::Builder>::spawn_unchecked<rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} () from /home/jnelson/.local/lib/rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-028c2c06c3edd7fd.so
--Type <RET> for more, q to quit, c to continue without paging--c
#14 0x00007ffff413d073 in <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once () at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/alloc/src/boxed.rs:1854
#15 <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once () at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/alloc/src/boxed.rs:1854
#16 std::sys::unix::thread::Thread::new::thread_start () at library/std/src/sys/unix/thread.rs:108
#17 0x00007ffff405b609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#18 0x00007ffff3f75293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

@rustbot label +A-macros

@jyn514 jyn514 added the C-bug Category: This is a bug. label Apr 5, 2022
@rustbot rustbot added the A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) label Apr 5, 2022
@jyn514
Copy link
Member Author

jyn514 commented Apr 5, 2022

A workaround is to disambiguate the two macro arms with parentheses and reorder the match arms:

macro_rules! from_cow_impls {
    ($( ( $from: ty, $normalizer: expr ) ),+ $(,)? ) => {
        $( impl<'a> From<$from> for LhsValue<'a> {
            fn from(val: $from) -> Self {
                LhsValue::Bytes($normalizer(val))
            }
        } )+
    };
    ($( $from: ty ),+ $(,)? ) => {
        from_cow_impls!(
            $( ($from, Cow::from) ),+
        );
    };
}

from_cow_impls!(
    &'a [u8],
    Vec<u8>,
);
from_cow_impls!(
    (&'a str, |x: &'a str| Cow::from(x.as_bytes())),
    (String, |x: String| Cow::from(x.into_bytes())),
);

@jyn514
Copy link
Member Author

jyn514 commented Apr 5, 2022

The fix here is probably to add a recursion_limit check somewhere, like there is for other similar macro fragments:

if !recursion_limit.value_within_limit(self.cx.current_expansion.depth) {

@jyn514
Copy link
Member Author

jyn514 commented Apr 5, 2022

@rustbot label +E-mentor +E-easy

@rustbot rustbot added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. labels Apr 5, 2022
@vincenzopalazzo
Copy link
Member

@rustbot claim

@vincenzopalazzo
Copy link
Member

vincenzopalazzo commented Apr 9, 2022

Today I tried to reproduce the problem on my machine and try to have simplify the minimal reproducible example.

/// Code that cause the rust issue #95698
macro_rules! from_cow_impls {
    ($( $from: ty ),+ $(,)? ) => {
        // recursion call
        from_cow_impls!(
            $( $from, Cow::from ),+
        );
    };

    ($( $from: ty, $normalizer: expr ),+ $(,)? ) => {
        $( impl<'a> From<$from> for LhsValue<'a> {
            fn from(val: $from) -> Self {
                LhsValue::Bytes($normalizer(val))
            }
        } )+
    };
}

from_cow_impls!(
    &'a [u8], /*callback*/,
    Vec<u8>, /*callback*/,
);

In particular, it looks like the recursion problem happens when we have the optional parameter null!

@vincenzopalazzo
Copy link
Member

vincenzopalazzo commented Apr 9, 2022

looks like a parser error, this is the list of tokens that return the workaround

TokenStream produced with workaround solution!
TokenStream([(Delimited(DelimSpan { open: ../../../../../.sandbox/workaround_infinite_recursion.rs:25:5: 25:6 (#0), close: ../../../../../.sandbox/workaround_infinite_recursion.rs:25:51: 25:52 (#0) }, Paren, TokenStream([(Token(Token { kind: BinOp(And), span: ../../../../../.sandbox/workaround_infinite_recursion.rs:25:6: 25:7 (#0) }), Alone), (Token(Token { kind: Lifetime("'a"), span: ../../../../../.sandbox/workaround_infinite_recursion.rs:25:7: 25:9 (#0) }), Alone), (Token(Token { kind: Ident("str", false), span: ../../../../../.sandbox/workaround_infinite_recursion.rs:25:10: 25:13 (#0) }), Joint), (Token(Token { kind: Comma, span: ../../../../../.sandbox/workaround_infinite_recursion.rs:25:13: 25:14 (#0) }), Alone), (Token(Token { kind: BinOp(Or), span: ../../../../../.sandbox/workaround_infinite_recursion.rs:25:15: 25:16 (#0) }), Alone), (Token(Token { kind: Ident("x", false), span: ../../../../../.sandbox/workaround_infinite_recursion.rs:25:16: 25:17 (#0) }), Joint), (Token(Token { kind: Colon, span: ../../../../../.sandbox/workaround_infinite_recursion.rs:25:17: 25:18 (#0) }), Alone), (Token(Token { kind: BinOp(And), span: ../../../../../.sandbox/workaround_infinite_recursion.rs:25:19: 25:20 (#0) }), Alone), (Token(Token { kind: Lifetime("'a"), span: ../../../../../.sandbox/workaround_infinite_recursion.rs:25:20: 25:22 (#0) }), Alone), (Token(Token { kind: Ident("str", false), span: ../../../../../.sandbox/workaround_infinite_recursion.rs:25:23: 25:26 (#0) }), Joint), (Token(Token { kind: BinOp(Or), span: ../../../../../.sandbox/workaround_infinite_recursion.rs:25:26: 25:27 (#0) }), Alone), (Token(Token { kind: Ident("Cow", false), span: ../../../../../.sandbox/workaround_infinite_recursion.rs:25:28: 25:31 (#0) }), Joint), (Token(Token { kind: ModSep, span: ../../../../../.sandbox/workaround_infinite_recursion.rs:25:31: 25:33 (#0) }), Alone), (Token(Token { kind: Ident("from", false), span: ../../../../../.sandbox/workaround_infinite_recursion.rs:25:33: 25:37 (#0) }), Alone), (Delimited(DelimSpan { open: ../../../../../.sandbox/workaround_infinite_recursion.rs:25:37: 25:38 (#0), close: ../../../../../.sandbox/workaround_infinite_recursion.rs:25:50: 25:51 (#0) }, Paren, TokenStream([(Token(Token { kind: Ident("x", false), span: ../../../../../.sandbox/workaround_infinite_recursion.rs:25:38: 25:39 (#0) }), Joint), (Token(Token { kind: Dot, span: ../../../../../.sandbox/workaround_infinite_recursion.rs:25:39: 25:40 (#0) }), Alone), (Token(Token { kind: Ident("as_bytes", false), span: ../../../../../.sandbox/workaround_infinite_recursion.rs:25:40: 25:48 (#0) }), Alone), (Delimited(DelimSpan { open: ../../../../../.sandbox/workaround_infinite_recursion.rs:25:48: 25:49 (#0), close: ../../../../../.sandbox/workaround_infinite_recursion.rs:25:49: 25:50 (#0) }, Paren, TokenStream([])), Alone)])), Alone)])), Alone), (Token(Token { kind: Comma, span: ../../../../../.sandbox/workaround_infinite_recursion.rs:25:52: 25:53 (#0) }), Alone), (Delimited(DelimSpan { open: ../../../../../.sandbox/workaround_infinite_recursion.rs:26:5: 26:6 (#0), close: ../../../../../.sandbox/workaround_infinite_recursion.rs:26:51: 26:52 (#0) }, Paren, TokenStream([(Token(Token { kind: Ident("String", false), span: ../../../../../.sandbox/workaround_infinite_recursion.rs:26:6: 26:12 (#0) }), Joint), (Token(Token { kind: Comma, span: ../../../../../.sandbox/workaround_infinite_recursion.rs:26:12: 26:13 (#0) }), Alone), (Token(Token { kind: BinOp(Or), span: ../../../../../.sandbox/workaround_infinite_recursion.rs:26:14: 26:15 (#0) }), Alone), (Token(Token { kind: Ident("x", false), span: ../../../../../.sandbox/workaround_infinite_recursion.rs:26:15: 26:16 (#0) }), Joint), (Token(Token { kind: Colon, span: ../../../../../.sandbox/workaround_infinite_recursion.rs:26:16: 26:17 (#0) }), Alone), (Token(Token { kind: Ident("String", false), span: ../../../../../.sandbox/workaround_infinite_recursion.rs:26:18: 26:24 (#0) }), Joint), (Token(Token { kind: BinOp(Or), span: ../../../../../.sandbox/workaround_infinite_recursion.rs:26:24: 26:25 (#0) }), Alone), (Token(Token { kind: Ident("Cow", false), span: ../../../../../.sandbox/workaround_infinite_recursion.rs:26:26: 26:29 (#0) }), Joint), (Token(Token { kind: ModSep, span: ../../../../../.sandbox/workaround_infinite_recursion.rs:26:29: 26:31 (#0) }), Alone), (Token(Token { kind: Ident("from", false), span: ../../../../../.sandbox/workaround_infinite_recursion.rs:26:31: 26:35 (#0) }), Alone), (Delimited(DelimSpan { open: ../../../../../.sandbox/workaround_infinite_recursion.rs:26:35: 26:36 (#0), close: ../../../../../.sandbox/workaround_infinite_recursion.rs:26:50: 26:51 (#0) }, Paren, TokenStream([(Token(Token { kind: Ident("x", false), span: ../../../../../.sandbox/workaround_infinite_recursion.rs:26:36: 26:37 (#0) }), Joint), (Token(Token { kind: Dot, span: ../../../../../.sandbox/workaround_infinite_recursion.rs:26:37: 26:38 (#0) }), Alone), (Token(Token { kind: Ident("into_bytes", false), span: ../../../../../.sandbox/workaround_infinite_recursion.rs:26:38: 26:48 (#0) }), Alone), (Delimited(DelimSpan { open: ../../../../../.sandbox/workaround_infinite_recursion.rs:26:48: 26:49 (#0), close: ../../../../../.sandbox/workaround_infinite_recursion.rs:26:49: 26:50 (#0) }, Paren, TokenStream([])), Alone)])), Alone)])), Alone), (Token(Token { kind: Comma, span: ../../../../../.sandbox/workaround_infinite_recursion.rs:26:52: 26:53 (#0) }), Alone)])

TokenStream produced with buggy code!
TokenStream([(Token(Token { kind: Interpolated(NtTy(..)), span: ../../../../../.sandbox/expands_macros.rs:6:16: 6:21 (#6) }), Alone), (Token(Token { kind: Comma, span: ../../../../../.sandbox/expands_macros.rs:6:21: 6:22 (#6) }), Alone), (Token(Token { kind: Ident("Cow", false), span: ../../../../../.sandbox/expands_macros.rs:6:23: 6:26 (#6) }), Alone), (Token(Token { kind: ModSep, span: ../../../../../.sandbox/expands_macros.rs:6:26: 6:28 (#6) }), Alone), (Token(Token { kind: Ident("from", false), span: ../../../../../.sandbox/expands_macros.rs:6:28: 6:32 (#6) }), Alone), (Token(Token { kind: Comma, span: ../../../../../.sandbox/expands_macros.rs:6:34: 6:35 (#0) }), Alone), (Token(Token { kind: Interpolated(NtTy(..)), span: ../../../../../.sandbox/expands_macros.rs:6:16: 6:21 (#6) }), Alone), (Token(Token { kind: Comma, span: ../../../../../.sandbox/expands_macros.rs:6:21: 6:22 (#6) }), Alone), (Token(Token { kind: Ident("Cow", false), span: ../../../../../.sandbox/expands_macros.rs:6:23: 6:26 (#6) }), Alone), (Token(Token { kind: ModSep, span: ../../../../../.sandbox/expands_macros.rs:6:26: 6:28 (#6) }), Alone), (Token(Token { kind: Ident("from", false), span: ../../../../../.sandbox/expands_macros.rs:6:28: 6:32 (#6) }), Alone), (Token(Token { kind: Comma, span: ../../../../../.sandbox/expands_macros.rs:6:34: 6:35 (#0) }), Alone), (Token(Token { kind: Interpolated(NtTy(..)), span: ../../../../../.sandbox/expands_macros.rs:6:16: 6:21 (#6) }), Alone), (Token(Token { kind: Comma, span: ../../../../../.sandbox/expands_macros.rs:6:21: 6:22 (#6) }), Alone), (Token(Token { kind: Ident("Cow", false), span: ../../../../../.sandbox/expands_macros.rs:6:23: 6:26 (#6) }), Alone), (Token(Token { kind: ModSep, span: ../../../../../.sandbox/expands_macros.rs:6:26: 6:28 (#6) }), Alone), (Token(Token { kind: Ident("from", false), span: ../../../../../.sandbox/expands_macros.rs:6:28: 6:32 (#6) }), Alone), (Token(Token { kind: Comma, span: ../../../../../.sandbox/expands_macros.rs:6:34: 6:35 (#0) }), Alone), (Token(Token { kind: Interpolated(NtTy(..)), span: ../../../../../.sandbox/expands_macros.rs:6:16: 6:21 (#6) }), Alone), (Token(Token { kind: Comma, span: ../../../../../.sandbox/expands_macros.rs:6:21: 6:22 (#6) }), Alone), (Token(Token { kind: Ident("Cow", false), span: ../../../../../.sandbox/expands_macros.rs:6:23: 6:26 (#6) }), Alone), (Token(Token { kind: ModSep, span: ../../../../../.sandbox/expands_macros.rs:6:26: 6:28 (#6) }), Alone), (Token(Token { kind: Ident("from", false), span: ../../../../../.sandbox/expands_macros.rs:6:28: 6:32 (#6) }), Alone), (Token(Token { kind: Comma, span: ../../../../../.sandbox/expands_macros.rs:6:34: 6:35 (#0) }), Alone), (Token(Token { kind: Interpolated(NtTy(..)), span: ../../../../../.sandbox/expands_macros.rs:6:16: 6:21 (#6) }), Alone), (Token(Token { kind: Comma, span: ../../../../../.sandbox/expands_macros.rs:6:21: 6:22 (#6) }), Alone), (Token(Token { kind: Ident("Cow", false), span: ../../../../../.sandbox/expands_macros.rs:6:23: 6:26 (#6) }), Alone), (Token(Token { kind: ModSep, span: ../../../../../.sandbox/expands_macros.rs:6:26: 6:28 (#6) }), Alone), (Token(Token { kind: Ident("from", false), span: ../../../../../.sandbox/expands_macros.rs:6:28: 6:32 (#6) }), Alone), (Token(Token { kind: Comma, span: ../../../../../.sandbox/expands_macros.rs:6:34: 6:35 (#0) }), Alone), (Token(Token { kind: Interpolated(NtTy(..)), span: ../../../../../.sandbox/expands_macros.rs:6:16: 6:21 (#6) }), Alone), (Token(Token { kind: Comma, span: ../../../../../.sandbox/expands_macros.rs:6:21: 6:22 (#6) }), Alone), (Token(Token { kind: Ident("Cow", false), span: ../../../../../.sandbox/expands_macros.rs:6:23: 6:26 (#6) }), Alone), (Token(Token { kind: ModSep, span: ../../../../../.sandbox/expands_macros.rs:6:26: 6:28 (#6) }), Alone), (Token(Token { kind: Ident("from", false), span: ../../../../../.sandbox/expands_macros.rs:6:28: 6:32 (#6) }), Alone), (Token(Token { kind: Comma, span: ../../../../../.sandbox/expands_macros.rs:6:34: 6:35 (#0) }), Alone), (Token(Token { kind: Interpolated(NtTy(..)), span: ../../../../../.sandbox/expands_macros.rs:6:16: 6:21 (#6) }), Alone), (Token(Token { kind: Comma, span: ../../../../../.sandbox/expands_macros.rs:6:21: 6:22 (#6) }), Alone), (Token(Token { kind: Ident("Cow", false), span: ../../../../../.sandbox/expands_macros.rs:6:23: 6:26 (#6) }), Alone), (Token(Token { kind: ModSep, span: ../../../../../.sandbox/expands_macros.rs:6:26: 6:28 (#6) }), Alone), (Token(Token { kind: Ident("from", false), span: ../../../../../.sandbox/expands_macros.rs:6:28: 6:32 (#6) }), Alone), (Token(Token { kind: Comma, span: ../../../../../.sandbox/expands_macros.rs:6:34: 6:35 (#0) }), Alone), (Token(Token { kind: Interpolated(NtTy(..)), span: ../../../../../.sandbox/expands_macros.rs:6:16: 6:21 (#6) }), Alone), (Token(Token { kind: Comma, span: ../../../../../.sandbox/expands_macros.rs:6:21: 6:22 (#6) }), Alone), (Token(Token { kind: Ident("Cow", false), span: ../../../../../.sandbox/expands_macros.rs:6:23: 6:26 (#6) }), Alone), (Token(Token { kind: ModSep, span: ../../../../../.sandbox/expands_macros.rs:6:26: 6:28 (#6) }), Alone), (Token(Token { kind: Ident("from", false), span: ../../../../../.sandbox/expands_macros.rs:6:28: 6:32 (#6) }), Alone)])

The Tokens continue to accumulate, and max deep is never reached.

@rustbot label +T-compiler

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Apr 9, 2022
@yash-dani
Copy link

There doesn't seem to be a PR associated with this issue, @vincenzopalazzo @jyn514 can I claim this?

@vincenzopalazzo
Copy link
Member

vincenzopalazzo commented Oct 13, 2022

There is some work on my side on this reported in the zulip chat and I have some half work around some branch.

However, my solution it is not super clean, do you have the solution on how to implement it? if yes, so feel free to claim it and can you ping me when you open the PR? I'm super curious to read the solution code

@vincenzopalazzo
Copy link
Member

@rustbot label -E-easy

This require to develop a new attribute for the rustc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) C-bug Category: This is a bug. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants