Skip to content

Hang:rustc hang in misc_checking_1 #142834

Open
@sososopy

Description

@sososopy

The code is generated by a fuzzer and reduced manually

I tried this code:

trait Trait {}
struct W<T>(T);
impl<T, U> Trait for W
where
    W<T>: Trait,
    W<U>: Trait,
{
    type NewAssoc<T, U>
        = (&'a (), &'b ())
    where
        W<U>: Trait;
}
fn main() {
}

Meta

rustc --version --verbose:

rustc 1.89.0-nightly (5526a2f47 2025-06-20)
binary: rustc
commit-hash: 5526a2f47cd676ceeedc08cf71ae75ce2e9284ae
commit-date: 2025-06-20
host: x86_64-pc-windows-msvc
release: 1.89.0-nightly
LLVM version: 20.1.7

-Z time-passes

time:   0.000; rss:   16MB ->   17MB (   +1MB)  parse_crate
time:   0.000; rss:   19MB ->   20MB (   +0MB)  crate_injection
time:   0.007; rss:   20MB ->   22MB (   +3MB)  expand_crate
time:   0.008; rss:   20MB ->   22MB (   +3MB)  macro_expand_crate
time:   0.000; rss:   22MB ->   23MB (   +0MB)  AST_validation
time:   0.000; rss:   23MB ->   23MB (   +0MB)  finalize_imports
time:   0.000; rss:   23MB ->   23MB (   +0MB)  compute_effective_visibilities
time:   0.000; rss:   23MB ->   23MB (   +0MB)  finalize_macro_resolutions
error[E0403]: the name `T` is already used for a generic parameter in this item's generic parameters
 --> .\test.rs:8:19
  |
3 | impl<T, U> Trait for W
  |      - first use of `T`
...
8 |     type NewAssoc<T, U>
  |                   ^ already used

error[E0403]: the name `U` is already used for a generic parameter in this item's generic parameters
 --> .\test.rs:8:22
  |
3 | impl<T, U> Trait for W
  |         - first use of `U`
...
8 |     type NewAssoc<T, U>
  |                      ^ already used

error[E0437]: type `NewAssoc` is not a member of trait `Trait`
  --> .\test.rs:8:5
   |
8  | /     type NewAssoc<T, U>
9  | |         = (&'a (), &'b ())
10 | |     where
11 | |         W<U>: Trait;
   | |____________________^ not a member of trait `Trait`

error[E0261]: use of undeclared lifetime name `'a`
 --> .\test.rs:9:13
  |
9 |         = (&'a (), &'b ())
  |             ^^ undeclared lifetime
  |
help: consider introducing lifetime `'a` here
  |
8 |     type NewAssoc<'a, T, U>
  |                   +++
help: consider introducing lifetime `'a` here
  |
3 | impl<'a, T, U> Trait for W
  |      +++

error[E0261]: use of undeclared lifetime name `'b`
 --> .\test.rs:9:21
  |
9 |         = (&'a (), &'b ())
  |                     ^^ undeclared lifetime
  |
help: consider introducing lifetime `'b` here
  |
8 |     type NewAssoc<'b, T, U>
  |                   +++
help: consider introducing lifetime `'b` here
  |
3 | impl<'b, T, U> Trait for W
  |      +++

time:   0.093; rss:   23MB ->   28MB (   +5MB)  late_resolve_crate
time:   0.000; rss:   28MB ->   28MB (   +0MB)  resolve_main
time:   0.000; rss:   28MB ->   28MB (   +0MB)  resolve_check_unused
time:   0.000; rss:   28MB ->   28MB (   +0MB)  resolve_postprocess
time:   0.099; rss:   23MB ->   28MB (   +6MB)  resolve_crate
time:   0.001; rss:   28MB ->   28MB (   +0MB)  write_dep_info
time:   0.000; rss:   28MB ->   28MB (   +0MB)  complete_gated_feature_checking
time:   0.000; rss:   29MB ->   29MB (   +0MB)  drop_ast
time:   0.000; rss:   30MB ->   30MB (   +0MB)  looking_for_entry_point
time:   0.000; rss:   30MB ->   30MB (   +0MB)  looking_for_derive_registrar
time:   0.000; rss:   31MB ->   31MB (   +0MB)  unused_lib_feature_checking
time:   0.003; rss:   30MB ->   31MB (   +1MB)  misc_checking_1
error[E0107]: missing generics for struct `W`
 --> .\test.rs:3:22
  |
3 | impl<T, U> Trait for W
  |                      ^ expected 1 generic argument
  |
note: struct defined here, with 1 generic parameter: `T`
 --> .\test.rs:2:8
  |
2 | struct W<T>(T);
  |        ^ -
help: add missing generic argument
  |
3 | impl<T, U> Trait for W<T>
  |                       +++

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-trait-systemArea: Trait systemC-bugCategory: This is a bug.I-hangIssue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.fixed-by-next-solverFixed by the next-generation trait solver, `-Znext-solver`.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions