Files
rust/compiler/rustc_codegen_ssa
Jonathan Brouwer fafa5b2e6b Rollup merge of #157825 - BorrowSanitizer:codegen-emit-retag-3, r=saethlin
Emit retags in codegen to support BorrowSanitizer (part 3)

Tracking issue: https://github.com/rust-lang/rust/issues/154760
[Zulip Thread](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Staging.20for.20emitting.20retags.20in.20codegen/with/593004012)

This is one of several PRs that will add experimental support for emitting retags as function calls in codegen.

This PR adds `RetagPlan`, which describes where the pointers that need to be retagged live within the layout of a type. We create a `RetagPlan` ahead of time because only a subset of the variants of a type might contain retagable values. We only want to branch to these variants, and ignore all of the others. If a type can generate a `RetagPlan`, then we will use it as a guide for inserting calls to our retag intrinsics. If a type does not generate a `RetagPlan`, then it does not need to be retagged, and we can skip it.

This does not emit a `RetagPlan::EmitRetag` yet. That will come in a subsequent PR.

Previous parts: rust-lang/rust#156208, rust-lang/rust#156210

cc: @RalfJung
r? @saethlin
2026-06-13 16:50:26 +02:00
..
…

Please read the rustc-dev-guide chapter on Backend Agnostic Codegen.