diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2025-01-07 21:39:41 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-07 21:39:41 +0100 |
| commit | 3e12d4d152e7fff87af413853a628c0571ad44e8 (patch) | |
| tree | bbc183051a0a4f1ab2bef8b0200e6dea9cb9069f /compiler/rustc_codegen_llvm/src/llvm/mod.rs | |
| parent | a20d0d5a5c256a2b2249454d695b91187781bcaf (diff) | |
| parent | 86d8b79d0dc800e9aacd455c31836c1a72dc676f (diff) | |
| download | rust-3e12d4d152e7fff87af413853a628c0571ad44e8.tar.gz rust-3e12d4d152e7fff87af413853a628c0571ad44e8.zip | |
Rollup merge of #135149 - compiler-errors:mangle, r=oli-obk
Use a post-monomorphization typing env when mangling components that come from impls When mangling associated methods of impls, we were previously using the wrong param-env. Instead of using a fully monomorphized param-env like we usually do in codegen, we were taking the post-analysis param-env, and treating it as an early binder to *re-substitute* the impl args. I've pointed out the problematic old code in an inline comment. This would give us param-envs with possibly trivial predicates that would prevent normalization via param-env shadowing. In the example test linked below, `tests/ui/symbol-names/normalize-in-param-env.rs`, this happens when we mangle the impl `impl<P: Point2> MyFrom<P::S> for P` with the substitution `P = Vec2`. Because the where clause of the impl is `P: Point2`, which elaborates to `[P: Point2, P: Point, <P as Point>::S projects-to <P as Point2>::S2]` and the fact that `impl Point2 for Vec2` normalizes `Vec2::S2` to `Vec2::S`, this causes a cycle. The proper fix here is to use a fully monomorphized param-env for the case where the impl is properly substituted. Fixes #135143 While #134081 uncovered this bug for legacy symbol mangling, it was preexisting for v0 symbol mangling. This PR fixes both. The test requires a "hack" because we strip the args of the instance we're printing for legacy symbol mangling except for drop glue, so we box a closure to ensure we generate drop glue. r? oli-obk
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/llvm/mod.rs')
0 files changed, 0 insertions, 0 deletions
