Repository: rust
Issue: rust spent  10 minutes trying to suggest typos
Labels: A-diagnostics,A-resolve,I-compiletime,T-compiler

```rust
enum A<A> {
    A(A),
    A { C: A },
}

// Make sure that we aren't using `self::` in paths, since it doesn't work in
// non-module scopes.
const A: () = {
    #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]
    struct A<A: A>(B)
    where
        A: A<
            {
                #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Default, Hash)]
                struct A<A> {
                    A: A,
                }

                #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]
                struct A<
                    A: A<
                        {
                            #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]
                            struct A<A: A>(B)
                            where
                                A: A<
                                    {
                                        #[derive(
                                            Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash,
                                        )]
                                        struct A<
                                            A: A<
                                                {
                                                    #[derive(
                                                        Copy,
                                                        Clone,
                                                        PartialEq,
                                                        Eq,
                                                        PartialOrd,
                                                        Ord,
                                                        Debug,
                                                        Hash,
                                                    )]
                                                    struct A<A: A>(B)
                                                    where
                                                        A: A<{ continue }>;
                                                },
                                            >,
                                        >(B)
                                        where
                                            A: A<{ continue }>;
                                    },
                                >;

                            #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]
                            enum A<A> {
                                A(),
                                A { A: A },
                            }
                        },
                    >,
                >(B)
                where
                    A: A<{ continue }>;
            },
        >;
};
```

```
time:   0.001; rss:   45MB ->   49MB (   +4MB)	parse_crate
time:   0.000; rss:   49MB ->   53MB (   +4MB)	setup_global_ctxt
error[E0428]: the name `A` is defined multiple times
 --> 894ADFAEF56FD5BE3968F44425D02AB0BFB037BD9F3CC014F7CF27D10A73C642.rs:5:5
  |
4 |     A(A),
  |     ---- previous definition of the type `A` here
5 |     A { C: A },
  |     ^ `A` redefined here
  |
  = note: `A` must be defined only once in the type namespace of this enum

error[E0428]: the name `A` is defined multiple times
  --> 894ADFAEF56FD5BE3968F44425D02AB0BFB037BD9F3CC014F7CF27D10A73C642.rs:22:17
   |
17 |                   struct A<A> {
   |                   ----------- previous definition of the type `A` here
...
22 | /                 struct A<
23 | |                     A: A<
24 | |                         {
25 | |                             #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]
...  |
65 | |                 where
66 | |                     A: A<{ continue }>;
   | |_______________________________________^ `A` redefined here
   |
   = note: `A` must be defined only once in the type namespace of this block

error[E0428]: the name `A` is defined multiple times
  --> 894ADFAEF56FD5BE3968F44425D02AB0BFB037BD9F3CC014F7CF27D10A73C642.rs:58:29
   |
26 | / ...                   struct A<A: A>(B)
27 | | ...                   where
28 | | ...                       A: A<
29 | | ...                           {
...  |
54 | | ...                           },
55 | | ...                       >;
   | |____________________________- previous definition of the type `A` here
...
58 |   ...                   enum A<A> {
   |                         ^^^^^^^^^ `A` redefined here
   |
   = note: `A` must be defined only once in the type namespace of this block

error[E0428]: the name `A` is defined multiple times
  --> 894ADFAEF56FD5BE3968F44425D02AB0BFB037BD9F3CC014F7CF27D10A73C642.rs:60:33
   |
59 | ...                   A(),
   |                       --- previous definition of the type `A` here
60 | ...                   A { A: A },
   |                       ^ `A` redefined here
   |
   = note: `A` must be defined only once in the type namespace of this enum

time:   8.261; rss:   53MB -> 1032MB ( +978MB)	expand_crate
time:   8.261; rss:   53MB -> 1032MB ( +978MB)	macro_expand_crate
time:   1.143; rss: 1032MB -> 1028MB (   -4MB)	AST_validation
time:   0.010; rss: 1028MB -> 1028MB (   +0MB)	check_reexport_ambiguities
time:   0.585; rss: 1028MB -> 1038MB (  +10MB)	finalize_macro_resolutions
```
This probably generates massive amount of code hence the 50mb -> 1gb blowup.
After these lines, it looks like rustc hangs while it spends a lot of time (I killed it after 10 minutes of waiting) inside
```
  29,39%  librustc_driver-e9ace2a97781a33e.so             [.] <rustc_resolve::Resolver>::add_module_candidates::<&<rustc_resolve::late::LateResolutionVisitor>::suggest_typo::{closure#0}>
  27,42%  librustc_driver-e9ace2a97781a33e.so             [.] <rustc_resolve::Resolver>::add_module_candidates::<&<rustc_resolve::late::LateResolutionVisitor>::try_lookup_name_relaxed::{closure#0}>
  13,17%  librustc_driver-e9ace2a97781a33e.so             [.] <rustc_resolve::Resolver>::lookup_import_candidates_from_module::<&&<rustc_resolve::late::LateResolutionVisitor>::try_lookup_name_relaxed::{closure#0}>
   1,27%  librustc_driver-e9ace2a97781a33e.so             [.] <rustc_resolve::ModuleData>::nearest_parent_mod
   1,09%  librustc_driver-e9ace2a97781a33e.so             [.] <rustc_resolve::Resolver>::lookup_import_candidates_from_module::<&&<rustc_resolve::late::LateResolutionVisitor>::try_lookup_name_relaxed::{closure#1}>
```