rust-lang / rust-lang/rust

`fn compute_closure_requirements_modulo_opaques` shouldn't clone all its inputs

Open
#146,079 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-cleanup T-compiler T-types
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

#145925 added fn compute_closure_requirements_modulo_opaques which clones a bunch of borrowck state to be able to compute the propagated closure requirements for nested bodies without actually finishing borowck for it.

We should change the code to take at least some of the fields by reference/Rc instead of just cloning everything. See the relevant FIXME(#146079) in the source

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

Locate the relevant FIXME(#146079) and inspect compute_closure_requirements_modulo_opaques, its callers, and the borrowck state it clones. Identify which inputs can be passed by reference or Rc without changing the propagated closure requirements, then verify that the compiler tests covering nested bodies still pass.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.