rust-lang / rust-lang/rust

rustc hangs in misc_checking_1

Open
#142,834 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-trait-system C-bug fixed-by-next-solver I-hang T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

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>
  |                       +++

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the report with the reduced test.rs input using the nightly rustc version and inspect the misc_checking_1 phase, where the report identifies the hang. Trace how the shown generic-parameter and missing-generic diagnostics are handled there. Done means the input completes without hanging while preserving correct diagnostics.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.