rust/compiler/rustc_trait_selection
Matthias Krüger 6606fd9a14
Rollup merge of #141332 - compiler-errors:no-fold-const, r=lcnr
Do not eagerly fold consts in `normalize_param_env_or_error` if new solver

Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/213

Given:

```
trait Trait: Deref<Target = [u8; { 1 + 1 }]> {}
```

when elaborating param env for `Trait`, we have `Self: Trait`, `Self: Deref<Target = [u8; {anon const}]>`.

Before this PR, we would fold the anon consts away *before* elaborating. However, we end up getting another *un-folded* copy of the anon const from elaborating `Self: Trait`. This leads to normalization ambiguity.

r? lcnr
2025-05-21 15:38:11 +02:00
..
2025-05-09 12:09:15 +02:00