rust-lang / rust-lang/rust

delegation: OOM

Open
#155,060 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug F-fn_delegation I-compilemem needs-triage
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

I tried this code:

#![feature(fn_delegation)]
trait Trait<T> {
    fn foo<U>(&self, _: dyn Trait) {}
}

reuse Trait::<_>::foo::<i32> as x;

fn main() {}

I expected to see this happen:
no oom

Instead, this happened:
oom

Meta

rustc --version --verbose:

rustc 1.96.0-nightly (a87c9b960 2026-04-09)
binary: rustc
commit-hash: a87c9b96031d4d8698bb0cd6533e83bc6d77ddaa
commit-date: 2026-04-09
host: x86_64-unknown-linux-gnu
release: 1.96.0-nightly
LLVM version: 22.1.2
Backtrace

   8,68%  librustc_driver-5ecf1647954ff888.so             [.] rustc_query_impl::execution::collect_active_query_jobs
   4,59%  librustc_driver-5ecf1647954ff888.so             [.] rustc_query_impl::execution::collect_active_query_jobs_inner::<rustc_middle::query::caches::DefIdCache<rustc_middle::query::erase::ErasedData<[u8; 16]>>>
   3,57%  librustc_driver-5ecf1647954ff888.so             [.] rustc_query_impl::execution::collect_active_query_jobs_inner::<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::ErasedData<[u8; 0]>, rustc_middle::dep_graph::graph::DepNodeIndex>>

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

Start by compiling the supplied fn_delegation reproducer with the reported nightly compiler and confirm the out-of-memory behavior. Use the included query-job backtrace as the initial investigation lead; done means the reproducer no longer exhausts memory without regressing delegation behavior.

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
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.