mirror of
https://github.com/allankoechke/rust.git
synced 2026-12-03 09:32:42 +00:00
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
Please read the rustc-dev-guide chapter on Backend Agnostic Codegen.