rust-lang / rust-lang/rust

canonicalizating placeholders should ignore their `bound_var`

Open
#141,428 0 comments 0 reactions 1 assignee View on GitHub

@lcnr is already working on this.

Since May 23, 2025.

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

Description

Given an instantiated binder for<'a, 'b, 'c>, the goals

  • T: Trait<'!a, '!b>
  • T: Trait<'!b, '!c>
  • T: Trait<'!b, '!a>

should all result in the same canonical input. They currently do not, as we simply reuse the bound_var of the placeholder in the caller as the bound_var of the placeholder in the canonical. This only impacts perf and at least for now, is likely not too relevant.

Concretely, CanonicalVarKind should only store the universe of placeholder vars and instantiating a canonical should be responsible for giving each placeholder a unique bound var.

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.