Repository: rust
Issue: Compiler crashes on complex type-aliases and associate types
Labels: I-ICE,T-compiler,C-bug

<!--
Thank you for finding an Internal Compiler Error! 🧊  If possible, try to provide
a minimal verifiable example. You can read "Rust Bug Minimization Patterns" for
how to create smaller examples.
http://blog.pnkfx.org/blog/2019/11/18/rust-bug-minimization-patterns/
-->

The bug arises when I remove the module nesting around a very complex piece of code, which I have absolutely no idea how to simplify for this bug report. I have tried to loopify as much as physically possible.

Given the following [piece of code](https://github.com/Equilibris/n-orm/blob/aef05109d127a50657a621ff084b1cf1de5ede27/syn-state-machine/src/impls/sum.rs). If i try to simplify the code the compiler crashes. If i try to take it out of the module tree and turn it into its own file it passes. This may have something to do with how its used in nested complex types in the other files. The error only occures in `cargo test`

### Code

```Rust
mod new_sum {
    use proc_macro2::TokenTree;

    use crate::*;
    use std::ops::ControlFlow::*;

    pub type E1Next<T, A> = <T as Cons<A>>::Next;
    pub type E2Next<T, A, B> = E1Next<E1Next<T, A>, B>;
    pub type E3Next<T, A, B, C> = E1Next<E2Next<T, A, B>, C>;
    pub type E4Next<T, A, B, C, D> = E1Next<E3Next<T, A, B, C>, D>;
    pub type E5Next<T, A, B, C, D, E> = E1Next<E4Next<T, A, B, C, D>, E>;
    pub type E6Next<T, A, B, C, D, E, F> = E1Next<E5Next<T, A, B, C, D, E>, F>;
    pub type E7Next<T, A, B, C, D, E, F, G> = E1Next<E6Next<T, A, B, C, D, E, F>, G>;
    pub type E8Next<T, A, B, C, D, E, F, G, H> = E1Next<E7Next<T, A, B, C, D, E, F, G>, H>;
    pub type E9Next<T, A, B, C, D, E, F, G, H, I> = E1Next<E8Next<T, A, B, C, D, E, F, G, H>, I>;
    pub type E10Next<T, A, B, C, D, E, F, G, H, I, J> =
        E1Next<E9Next<T, A, B, C, D, E, F, G, H, I>, J>;
    pub type E11Next<T, A, B, C, D, E, F, G, H, I, J, K> =
        E1Next<E10Next<T, A, B, C, D, E, F, G, H, I, J>, K>;
    pub type E12Next<T, A, B, C, D, E, F, G, H, I, J, K, L> =
        E1Next<E11Next<T, A, B, C, D, E, F, G, H, I, J, K>, L>;
    pub type E13Next<T, A, B, C, D, E, F, G, H, I, J, K, L, M> =
        E1Next<E12Next<T, A, B, C, D, E, F, G, H, I, J, K, L>, M>;
    pub type E14Next<T, A, B, C, D, E, F, G, H, I, J, K, L, M, N> =
        E1Next<E13Next<T, A, B, C, D, E, F, G, H, I, J, K, L, M>, N>;

    // This may be able to be used to impl monads and typeclasses in rsut
    pub trait Cons<T> {
        type Next;

        fn next(self, v: T) -> Self::Next;
    }

    #[derive(Default, Debug, thiserror::Error)]
    #[error("BlackHole")]
    pub struct BlackHole;
    impl<T> Cons<T> for BlackHole {
        type Next = BlackHole;

        fn next(self, _: T) -> Self::Next {
            BlackHole
        }
    }

    #[derive(Default, Debug, thiserror::Error)]
    #[error("")]
    pub struct Sum0Err {}
    impl<T: std::error::Error> Cons<T> for Sum0Err {
        type Next = Sum1Err<T>;

        fn next(self, a: T) -> Self::Next {
            Sum1Err { a }
        }
    }

    macro_rules! sum_n_err {
        (!$name:ident, $err:literal, $($p:ident $s:ident),*; $fp:ident $fs:ident) => {
            #[derive(Debug, thiserror::Error)]
            #[error($err, $(. $p),*)]
            pub struct $name <$($s: std::error::Error),*>{
                $(pub $p: $s,)*
            }
        };
        ($name:ident, $next:ident, $err:literal, $($p:ident $s:ident),*; $fp:ident $fs:ident) => {
            sum_n_err!(!$name, $err, $($p $s),*; $fp $fs);

            impl<$($s: std::error::Error,)*$fs : std::error::Error> Cons<$fs> for $name <$($s),*> {
                type Next = $next<$($s,)*$fs >;

                fn next(self, $fp: $fs) -> Self::Next {
                    let Self { $($p,)* } = self;

                    $next { $($p,)* $fp }
                }
            }
        };
    }

    sum_n_err!(Sum1Err,  Sum2Err,  "e0: ({})", a A; b B);
    sum_n_err!(Sum2Err,  Sum3Err,  "e0: ({}) e1: ({})", a A, b B; c C);
    sum_n_err!(Sum3Err,  Sum4Err,  "e0: ({}) e1: ({}) e2: ({})", a A, b B, c C; d D);
    sum_n_err!(Sum4Err,  Sum5Err,  "e0: ({}) e1: ({}) e2: ({}) e3: ({})", a A, b B, c C, d D; e E);
    sum_n_err!(Sum5Err,  Sum6Err,  "e0: ({}) e1: ({}) e2: ({}) e3: ({}) e4: ({})", a A, b B, c C, d D, e E; f F);
    sum_n_err!(Sum6Err,  Sum7Err,  "e0: ({}) e1: ({}) e2: ({}) e3: ({}) e4: ({}) e5: ({})", a A, b B, c C, d D, e E, f F; g G);
    sum_n_err!(Sum7Err,  Sum8Err,  "e0: ({}) e1: ({}) e2: ({}) e3: ({}) e4: ({}) e5: ({}) e6: ({})", a A, b B, c C, d D, e E, f F, g G; h H);
    sum_n_err!(Sum8Err,  Sum9Err,  "e0: ({}) e1: ({}) e2: ({}) e3: ({}) e4: ({}) e5: ({}) e6: ({}) e7: ({})", a A, b B, c C, d D, e E, f F, g G, h H; i I);
    sum_n_err!(Sum9Err,  Sum10Err, "e0: ({}) e1: ({}) e2: ({}) e3: ({}) e4: ({}) e5: ({}) e6: ({}) e7: ({}) e8: ({})", a A, b B, c C, d D, e E, f F, g G, h H, i I; j J);
    sum_n_err!(Sum10Err, Sum11Err, "e0: ({}) e1: ({}) e2: ({}) e3: ({}) e4: ({}) e5: ({}) e6: ({}) e7: ({}) e8: ({}) e9: ({})", a A, b B, c C, d D, e E, f F, g G, h H, i I, j J; k K);
    sum_n_err!(Sum11Err, Sum12Err, "e0: ({}) e1: ({}) e2: ({}) e3: ({}) e4: ({}) e5: ({}) e6: ({}) e7: ({}) e8: ({}) e9: ({}) e10: ({})", a A, b B, c C, d D, e E, f F, g G, h H, i I, j J, k K; l L);
    sum_n_err!(Sum12Err, Sum13Err, "e0: ({}) e1: ({}) e2: ({}) e3: ({}) e4: ({}) e5: ({}) e6: ({}) e7: ({}) e8: ({}) e9: ({}) e10: ({}) e11: ({})", a A, b B, c C, d D, e E, f F, g G, h H, i I, j J, k K, l L; m M);
    sum_n_err!(Sum13Err, Sum14Err, "e0: ({}) e1: ({}) e2: ({}) e3: ({}) e4: ({}) e5: ({}) e6: ({}) e7: ({}) e8: ({}) e9: ({}) e10: ({}) e11: ({}) e12: ({})", a A, b B, c C, d D, e E, f F, g G, h H, i I, j J, k K, l L, m M; n N);
    sum_n_err!(!Sum14Err,          "e0: ({}) e1: ({}) e2: ({}) e3: ({}) e4: ({}) e5: ({}) e6: ({}) e7: ({}) e8: ({}) e9: ({}) e10: ({}) e11: ({}) e12: ({}) e13: ({})", a A, b B, c C, d D, e E, f F, g G, h H, i I, j J, k K, l L, m M, n N; p P);

    macro_rules! sum_n {
        (
            $name:ident, $mname:ident, $errored_name:ident
            $(
                ; $sum:ident
                , $next:ident
                , $gen:ident
                , ($fst:ident $($err_type:ident)*)
                , $bound:ident
            )*
            : $f_sum:ident
            , $f_gen:ident
            , ($f_fst:ident $($f_err_type:ident)*)
            , $f_bound:ident
            , ($ff_fst:ident $($final:ident)*)
            ) => {

            pub struct $errored_name<
                A: Parsable,
                $($gen: Parsable,)*
                $f_gen: Parsable,
                E0
            > (std::marker::PhantomData<(A, $($gen,)* $f_gen, E0)>);

            impl<
                A: Parsable,
                $($gen: Parsable,)*
                $f_gen: Parsable,
                E0
            > Parsable for $errored_name<
                A,
                $($gen,)*
                $f_gen,
                E0
            >
            where
                E0: Cons<SmErr<A>> + Default,
                $(
                    $fst<E0, $(SmErr<$err_type>,)*>: Cons<SmErr<$bound>>,
                )*
                $f_fst<E0, $(SmErr<$f_err_type>,)*>: Cons<SmErr<$f_bound>>,
                $ff_fst<E0, $(SmErr<$final>, )*>: std::error::Error,
            {
                type StateMachine = $mname<
                    A::StateMachine,
                    $($gen::StateMachine,)*
                    $f_gen::StateMachine,
                    E0
                >;
            }

            #[derive(Clone, Debug)]
            pub enum $name<A, $($gen,)* $f_gen> {
                Val0(A),
                $($sum($gen),)*
                $f_sum($f_gen)
            }
            pub enum $mname<
                A: StateMachine,
                $($gen: StateMachine,)*
                $f_gen: StateMachine,
                E0
            >
            where
                E0: Cons<A::Error>,
                $(
                    $fst<E0, $($err_type::Error,)*>: Cons<$bound::Error>,
                )*
                $f_fst<E0, $($f_err_type::Error,)*>: Cons<$f_bound::Error>,
                $ff_fst<E0, $($final::Error, )*>: std::error::Error,
            {
                Val0(Vec<TokenTree>, E0, A),
                // Val1(Vec<TokenTree>, E1Next<E0, A::Error>, B),
                $(
                    $sum(Vec<TokenTree>, $fst<E0, $($err_type::Error,)*>, $gen),
                )*
                $f_sum(Vec<TokenTree>, $f_fst<E0, $($f_err_type::Error,)*>, $f_gen)
            }

            impl<
                A: StateMachine,
                $($gen: StateMachine,)*
                $f_gen: StateMachine,
                E0
            > Default for $mname<A, $($gen,)* $f_gen, E0>
            where
                E0: Default + Cons<A::Error>,
                $(
                    $fst<E0, $($err_type::Error,)*>: Cons<$bound::Error>,
                )*
                $f_fst<E0, $($f_err_type::Error,)*>: Cons<$f_bound::Error>,
                $ff_fst<E0, $($final::Error,)*>: std::error::Error,
            {
                fn default() -> Self {
                    loop {}
                }
            }

            impl<
                A: Parsable,
                $($gen: Parsable,)*
                $f_gen: Parsable
            > Parsable for $name<A, $($gen,)* $f_gen> {
                type StateMachine = $mname<
                    A::StateMachine,
                    $($gen::StateMachine,)*
                    $f_gen::StateMachine,
                    Sum0Err
                >;
            }

            impl<
                A: StateMachine,
                $($gen: StateMachine,)*
                $f_gen: StateMachine,
                E0
            > StateMachine for $mname<A, $($gen,)* $f_gen, E0>
            where
                E0: Default + Cons<A::Error>,
                $(
                    $fst<E0, $($err_type::Error,)*>: Cons<$bound::Error>,
                )*
                $f_fst<E0, $($f_err_type::Error,)*>: Cons<$f_bound::Error>,
                $ff_fst<E0, $($final::Error,)*>: std::error::Error,
            {
                type Output = $name<A::Output, $($gen::Output,)* $f_gen::Output>;
                type Error = $ff_fst<E0, $($final::Error,)*>;

                fn drive(
                    self,
                    _: &TokenTree,
                ) -> std::ops::ControlFlow<SmResult<Self::Output, Self::Error>, Self> {
                    loop {}
                }

                fn terminate(self) -> SmResult<Self::Output, Self::Error> {
                    loop {}
                }
            }
        };
    }

    sum_n!(
        Sum2, Sum2M, ESum2
        : Val1, B, (E1Next A), B
        ,          (E2Next A B)
    );
    sum_n!(
        Sum3, Sum3M, ESum3
        ; Val1, Val2, B, (E1Next A), B
        : Val2, C,       (E2Next A B), C
        ,                (E3Next A B C)
    );
    sum_n!(
        Sum4, Sum4M, ESum4
        ; Val1, Val2, B, (E1Next A), B
        ; Val2, Val3, C, (E2Next A B), C
        : Val3, D,       (E3Next A B C), D
        ,                (E4Next A B C D)
    );
    sum_n!(
        Sum5, Sum5M, ESum5
        ; Val1, Val2, B, (E1Next A), B
        ; Val2, Val3, C, (E2Next A B), C
        ; Val3, Val4, D, (E3Next A B C), D
        : Val4, E,       (E4Next A B C D), E
        ,                (E5Next A B C D E)
    );
    sum_n!(
        Sum6, Sum6M, ESum6
        ; Val1, Val2, B, (E1Next A), B
        ; Val2, Val3, C, (E2Next A B), C
        ; Val3, Val4, D, (E3Next A B C), D
        ; Val4, Val5, E, (E4Next A B C D), E
        : Val5, F,       (E5Next A B C D E), F
        ,                (E6Next A B C D E F)
    );
    sum_n!(
        Sum7, Sum7M, ESum7
        ; Val1, Val2, B, (E1Next A), B
        ; Val2, Val3, C, (E2Next A B), C
        ; Val3, Val4, D, (E3Next A B C), D
        ; Val4, Val5, E, (E4Next A B C D), E
        ; Val5, Val6, F, (E5Next A B C D E), F
        : Val6, G,       (E6Next A B C D E F), G
        ,                (E7Next A B C D E F G)
    );
    sum_n!(
        Sum8, Sum8M, ESum8
        ; Val1, Val2, B, (E1Next A), B
        ; Val2, Val3, C, (E2Next A B), C
        ; Val3, Val4, D, (E3Next A B C), D
        ; Val4, Val5, E, (E4Next A B C D), E
        ; Val5, Val6, F, (E5Next A B C D E), F
        ; Val6, Val7, G, (E6Next A B C D E F), G
        : Val7, H,       (E7Next A B C D E F G), H
        ,                (E8Next A B C D E F G H)
    );
    sum_n!(
        Sum9, Sum9M, ESum9
        ; Val1, Val2, B, (E1Next A), B
        ; Val2, Val3, C, (E2Next A B), C
        ; Val3, Val4, D, (E3Next A B C), D
        ; Val4, Val5, E, (E4Next A B C D), E
        ; Val5, Val6, F, (E5Next A B C D E), F
        ; Val6, Val7, G, (E6Next A B C D E F), G
        ; Val7, Val8, H, (E7Next A B C D E F G), H
        : Val8, I,       (E8Next A B C D E F G H), I
        ,                (E9Next A B C D E F G H I)
    );
    sum_n!(
        Sum10, Sum10M, ESum10
        ; Val1, Val2, B, (E1Next A), B
        ; Val2, Val3, C, (E2Next A B), C
        ; Val3, Val4, D, (E3Next A B C), D
        ; Val4, Val5, E, (E4Next A B C D), E
        ; Val5, Val6, F, (E5Next A B C D E), F
        ; Val6, Val7, G, (E6Next A B C D E F), G
        ; Val7, Val8, H, (E7Next A B C D E F G), H
        ; Val8, Val9, I, (E8Next A B C D E F G H), I
        : Val9, J,       (E9Next A B C D E F G H I), J
        ,                (E10Next A B C D E F G H I J)
    );
    sum_n!(
        Sum11, Sum11M, ESum11
        ; Val1, Val2,  B,  (E1Next A), B
        ; Val2, Val3,  C,  (E2Next A B), C
        ; Val3, Val4,  D,  (E3Next A B C), D
        ; Val4, Val5,  E,  (E4Next A B C D), E
        ; Val5, Val6,  F,  (E5Next A B C D E), F
        ; Val6, Val7,  G,  (E6Next A B C D E F), G
        ; Val7, Val8,  H,  (E7Next A B C D E F G), H
        ; Val8, Val9,  I,  (E8Next A B C D E F G H), I
        ; Val9, Val10, J,  (E9Next A B C D E F G H I), J
        : Val10, K,       (E10Next A B C D E F G H I J), K
        ,                 (E11Next A B C D E F G H I J K)
    );
    sum_n!(
        Sum12, Sum12M, ESum12
        ; Val1, Val2,   B,  (E1Next A), B
        ; Val2, Val3,   C,  (E2Next A B), C
        ; Val3, Val4,   D,  (E3Next A B C), D
        ; Val4, Val5,   E,  (E4Next A B C D), E
        ; Val5, Val6,   F,  (E5Next A B C D E), F
        ; Val6, Val7,   G,  (E6Next A B C D E F), G
        ; Val7, Val8,   H,  (E7Next A B C D E F G), H
        ; Val8, Val9,   I,  (E8Next A B C D E F G H), I
        ; Val9, Val10,  J,  (E9Next A B C D E F G H I), J
        ; Val10, Val11, K, (E10Next A B C D E F G H I J), K
        : Val11, L,        (E11Next A B C D E F G H I J K), L
        ,                  (E12Next A B C D E F G H I J K L)
    );
    sum_n!(
        Sum13, Sum13M, ESum13
        ; Val1, Val2,   B,  (E1Next A), B
        ; Val2, Val3,   C,  (E2Next A B), C
        ; Val3, Val4,   D,  (E3Next A B C), D
        ; Val4, Val5,   E,  (E4Next A B C D), E
        ; Val5, Val6,   F,  (E5Next A B C D E), F
        ; Val6, Val7,   G,  (E6Next A B C D E F), G
        ; Val7, Val8,   H,  (E7Next A B C D E F G), H
        ; Val8, Val9,   I,  (E8Next A B C D E F G H), I
        ; Val9, Val10,  J,  (E9Next A B C D E F G H I), J
        ; Val10, Val11, K, (E10Next A B C D E F G H I J), K
        ; Val11, Val12, L, (E11Next A B C D E F G H I J K), L
        : Val12, M,        (E12Next A B C D E F G H I J K L), M
        ,                  (E13Next A B C D E F G H I J K L M)
    );
    sum_n!(
        Sum14, Sum14M, ESum14
        ; Val1, Val2,   B,  (E1Next A), B
        ; Val2, Val3,   C,  (E2Next A B), C
        ; Val3, Val4,   D,  (E3Next A B C), D
        ; Val4, Val5,   E,  (E4Next A B C D), E
        ; Val5, Val6,   F,  (E5Next A B C D E), F
        ; Val6, Val7,   G,  (E6Next A B C D E F), G
        ; Val7, Val8,   H,  (E7Next A B C D E F G), H
        ; Val8, Val9,   I,  (E8Next A B C D E F G H), I
        ; Val9, Val10,  J,  (E9Next A B C D E F G H I), J
        ; Val10, Val11, K, (E10Next A B C D E F G H I J), K
        ; Val11, Val12, L, (E11Next A B C D E F G H I J K), L
        ; Val12, Val13, M, (E12Next A B C D E F G H I J K L), M
        : Val13, N,        (E13Next A B C D E F G H I J K L M), N
        ,                  (E14Next A B C D E F G H I J K L M N)
    );
}

pub use new_sum::*;
// We can actually fix the memory scaling issue by transforming the problem to a state where we
// just iteratively map a series of options until reach a valid value. We must hold an iterative
// error term tho. This could optionally be boxed. An idea is also making it generic across a
// monoid error composer. This would result in a sum that is (with a forgetful error mapping) O(1)
// sized where n is the amount of types its summed over. This would be a great improvement from
// the current O(n) sizing scheme
//
// This is done in the module `self::new_sum`

#[cfg(test)]
mod tests {
    use crate::*;

    type P = Punct;

    insta_match_test!(
        it_matches_highest_priority,
        Sum5<
            (P,P,P,P,P),
            (P,P,P,P,),
            (P,P,P,),
            (P,P,),
            (P,),
        > : ....);

    insta_match_test!(it_matches_sum_2_0, Sum2<Ident, Punct> : hello);
    insta_match_test!(it_matches_sum_2_1, Sum2<Ident, Punct> : <);
}
```

### Meta
<!--
If you're using the stable version of the compiler, you should also check if the
bug also exists in the beta or nightly versions.
-->

`rustc --version --verbose`:
```
rustc 1.71.0-nightly (5ea3f0ae0 2023-05-23)
binary: rustc
commit-hash: 5ea3f0ae08c07472239a94ce55601e9b63eb1f45
commit-date: 2023-05-23
host: x86_64-unknown-linux-gnu
release: 1.71.0-nightly
LLVM version: 16.0.4
```

### Error output

```
thread 'rustc' panicked at 'Failed to extract DefId: opt_local_def_id_to_hir_id 4f8e9e9944886d83-ee3bb765f01576f', compiler/rustc_middle/src/dep_graph/dep_node.rs:1
81:17
stack backtrace:
   0: rust_begin_unwind
             at /rustc/5ea3f0ae08c07472239a94ce55601e9b63eb1f45/library/std/src/panicking.rs:578:5
   1: core::panicking::panic_fmt
             at /rustc/5ea3f0ae08c07472239a94ce55601e9b63eb1f45/library/core/src/panicking.rs:67:14
   2: <rustc_query_system::dep_graph::dep_node::DepNode<rustc_middle::dep_graph::dep_node::DepKind> as rustc_middle::dep_graph::dep_node::DepNodeExt>::extract_def_i
d::{closure#0}
   3: <rustc_query_system::dep_graph::dep_node::DepNode<rustc_middle::dep_graph::dep_node::DepKind> as rustc_middle::dep_graph::dep_node::DepNodeExt>::extract_def_i
d
   4: <rustc_query_impl::plumbing::query_callback<rustc_query_impl::query_impl::opt_local_def_id_to_hir_id::QueryType>::{closure#0} as core::ops::function::FnOnce<(
rustc_middle::ty::context::TyCtxt, rustc_query_system::dep_graph::dep_node::DepNode<rustc_middle::dep_graph::dep_node::DepKind>)>>::call_once
   5: <rustc_query_system::dep_graph::graph::DepGraphData<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryC
txt>
   6: <rustc_query_system::dep_graph::graph::DepGraphData<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryC
txt>
   7: <rustc_query_system::dep_graph::graph::DepGraphData<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryC
txt>
   8: <rustc_query_system::dep_graph::graph::DepGraphData<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryC
txt>
   9: <rustc_query_system::dep_graph::graph::DepGraphData<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryC
txt>
  10: <rustc_query_system::dep_graph::graph::DepGraphData<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryC
txt>
  11: <rustc_query_system::dep_graph::graph::DepGraphData<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryC
txt>
  12: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefaultCache<rustc_middle::infer::
canonical::Canonical<rustc_middle::ty::ParamEnvAnd<rustc_middle::ty::Predicate>>, rustc_middle::query::erase::Erased<[u8; 2]>>, false, false, false>, rustc_query_im
pl::plumbing::QueryCtxt, true>
  13: <rustc_trait_selection::traits::fulfill::FulfillProcessor as rustc_data_structures::obligation_forest::ObligationProcessor>::process_obligation
  14: <rustc_data_structures::obligation_forest::ObligationForest<rustc_trait_selection::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_
trait_selection::traits::fulfill::FulfillProcessor>
  15: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_argument_types
  16: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_call
  17: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  18: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_decl
  19: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_block_with_expected
  20: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  21: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_argument_types
  22: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_call
  23: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  24: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  25: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_argument_types
  26: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_call
  27: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  28: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  29: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  30: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_argument_types
  31: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_call
  32: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  33: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_argument_types
  34: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_call
  35: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  36: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_decl
  37: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_block_with_expected
  38: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  39: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_decl
  40: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_block_with_expected
  41: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  42: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_block_with_expected
  43: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  44: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_return_expr
  45: rustc_hir_typeck::check::check_fn
  46: rustc_hir_typeck::typeck
  47: rustc_hir_analysis::check_crate
  48: rustc_interface::passes::analysis
  49: <rustc_middle::ty::context::GlobalCtxt>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#4}, core::result::Result<(), rustc_span::
ErrorGuaranteed>>
  50: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_int
erface::queries::Linker>, rustc_span::ErrorGuaranteed>>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.71.0-nightly (5ea3f0ae0 2023-05-23) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [evaluate_obligation] evaluating trait selection obligation `impls::map::MappedMachine<common_tokens::macro_invocation::MacroInvocationSemi>: core::marker::Sized
`  |  = note: this failure-note originates in the macro `insta_match_test` (in Nightly builds, run with -Z macro-backtrace for more info)

#1 [typeck] type-checking `common_tokens::external_blocks::tests::it_matches_item`
#2 [used_trait_imports] finding used_trait_imports `common_tokens::external_blocks::tests::it_matches_item`
#3 [analysis] running analysis passes on this crate
end of query stack
there was a panic while trying to force a dep node
try_mark_green dep node stack:
#0 opt_def_kind(thread 'rustc' panicked at 'Failed to extract DefId: opt_def_kind 4f8e9e9944886d83-ee3bb765f01576f', compiler/rustc_middle/src/dep_graph/dep_node.rs
:181:17
stack backtrace:
   0: rust_begin_unwind
             at /rustc/5ea3f0ae08c07472239a94ce55601e9b63eb1f45/library/std/src/panicking.rs:578:5
   1: core::panicking::panic_fmt
             at /rustc/5ea3f0ae08c07472239a94ce55601e9b63eb1f45/library/core/src/panicking.rs:67:14
   2: <rustc_query_system::dep_graph::dep_node::DepNode<rustc_middle::dep_graph::dep_node::DepKind> as rustc_middle::dep_graph::dep_node::DepNodeExt>::extract_def_i
d::{closure#0}
   3: <rustc_query_system::dep_graph::dep_node::DepNode<rustc_middle::dep_graph::dep_node::DepKind> as rustc_middle::dep_graph::dep_node::DepNodeExt>::extract_def_i
d
   4: <rustc_middle::dep_graph::dep_node::DepKind as rustc_query_system::dep_graph::DepKind>::debug_node
   5: core::fmt::rt::Argument::fmt
             at /rustc/5ea3f0ae08c07472239a94ce55601e9b63eb1f45/library/core/src/fmt/rt.rs:138:9
   6: core::fmt::write
             at /rustc/5ea3f0ae08c07472239a94ce55601e9b63eb1f45/library/core/src/fmt/mod.rs:1094:21
   7: std::io::Write::write_fmt
             at /rustc/5ea3f0ae08c07472239a94ce55601e9b63eb1f45/library/std/src/io/mod.rs:1712:15
   8: <&std::io::stdio::Stderr as std::io::Write>::write_fmt
             at /rustc/5ea3f0ae08c07472239a94ce55601e9b63eb1f45/library/std/src/io/stdio.rs:945:9
   9: <std::io::stdio::Stderr as std::io::Write>::write_fmt
             at /rustc/5ea3f0ae08c07472239a94ce55601e9b63eb1f45/library/std/src/io/stdio.rs:919:9
  10: std::io::stdio::print_to
             at /rustc/5ea3f0ae08c07472239a94ce55601e9b63eb1f45/library/std/src/io/stdio.rs:1018:21
  11: std::io::stdio::_eprint
             at /rustc/5ea3f0ae08c07472239a94ce55601e9b63eb1f45/library/std/src/io/stdio.rs:1106:5
  12: rustc_query_system::dep_graph::graph::print_markframe_trace::<rustc_middle::dep_graph::dep_node::DepKind>
  13: <rustc_query_system::dep_graph::graph::DepGraphData<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryC
txt>
  14: <rustc_query_system::dep_graph::graph::DepGraphData<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryC
txt>
  15: <rustc_query_system::dep_graph::graph::DepGraphData<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryC
txt>
  16: <rustc_query_system::dep_graph::graph::DepGraphData<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryC
txt>
  17: <rustc_query_system::dep_graph::graph::DepGraphData<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryC
txt>
  18: <rustc_query_system::dep_graph::graph::DepGraphData<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryC
txt>
  19: <rustc_query_system::dep_graph::graph::DepGraphData<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryC
txt>
  20: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefaultCache<rustc_middle::infer::
canonical::Canonical<rustc_middle::ty::ParamEnvAnd<rustc_middle::ty::Predicate>>, rustc_middle::query::erase::Erased<[u8; 2]>>, false, false, false>, rustc_query_im
pl::plumbing::QueryCtxt, true>
  21: <rustc_trait_selection::traits::fulfill::FulfillProcessor as rustc_data_structures::obligation_forest::ObligationProcessor>::process_obligation
  22: <rustc_data_structures::obligation_forest::ObligationForest<rustc_trait_selection::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_
trait_selection::traits::fulfill::FulfillProcessor>
  23: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_argument_types
  24: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_call
  25: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  26: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_decl
  27: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_block_with_expected
  28: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  29: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_argument_types
  30: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_call
  31: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  32: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  33: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_argument_types
  34: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_call
  35: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  36: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  37: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  38: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_argument_types
  39: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_call
  40: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  41: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_argument_types
  42: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_call
  43: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  44: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_decl
  45: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_block_with_expected
  46: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  47: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_decl
  48: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_block_with_expected
  49: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  50: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_block_with_expected
  51: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  52: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_return_expr
  53: rustc_hir_typeck::check::check_fn
  54: rustc_hir_typeck::typeck
  55: rustc_hir_analysis::check_crate
  56: rustc_interface::passes::analysis
  57: <rustc_middle::ty::context::GlobalCtxt>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#4}, core::result::Result<(), rustc_span::
ErrorGuaranteed>>
  58: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_int
erface::queries::Linker>, rustc_span::ErrorGuaranteed>>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.71.0-nightly (5ea3f0ae0 2023-05-23) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [evaluate_obligation] evaluating trait selection obligation `impls::map::MappedMachine<common_tokens::macro_invocation::MacroInvocationSemi>: core::marker::Sized
`  |  = note: this failure-note originates in the macro `insta_match_test` (in Nightly builds, run with -Z macro-backtrace for more info)

#1 [typeck] type-checking `common_tokens::external_blocks::tests::it_matches_item`
#2 [used_trait_imports] finding used_trait_imports `common_tokens::external_blocks::tests::it_matches_item`
#3 [analysis] running analysis passes on this crate
end of query stack
there was a panic while trying to force a dep node
try_mark_green dep node stack:
#0 used_trait_imports(syn_state_machine[4f8e]::common_tokens::external_blocks::tests::it_matches_item#1)
end of try_mark_green dep node stack
```

Backtrace did not change the result of the error