rust-lang / rust-lang/rust

MGCA: Avoid code duplication between HIR ty lowering and elsewhere

Open
#150,621 2 comments 0 reactions 1 assignee View on GitHub

@LaneAsade is already working on this.

Since Feb 25, 2026.

A-HIR-ty-lowering A-technical-debt C-cleanup E-needs-design F-min_generic_const_args T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Currently the HIR ty lowering logic for direct const arguments has a lot of overlap with code elsewhere in the compiler. For example:

  • We have logic in HIR type check for resolving type relative paths, and also logic in HIR ty lowering
  • We have logic in HIR type check for type checking struct expressions, and we have very similar logic in HIR ty lowering for validating that a direct struct expression has the right amount of fields.

I'm not sure what the right way to avoid this code duplication is, but we should fix this before this code duplication becomes something that affects stable code.

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.