Skip to content

Emit retags in codegen to support BorrowSanitizer (part 3)#157825

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
BorrowSanitizer:codegen-emit-retag-3
Jun 13, 2026
Merged

Emit retags in codegen to support BorrowSanitizer (part 3)#157825
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
BorrowSanitizer:codegen-emit-retag-3

Conversation

@icmccorm

@icmccorm icmccorm commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Tracking issue: #154760
Zulip Thread

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: #156208, #156210

cc: @RalfJung
r? @saethlin

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 12, 2026
@saethlin

Copy link
Copy Markdown
Member

@bors r+ rollup

I understand the separation you did here between building a retag plan and using it, but in general I prefer to reason about code that is used and that I can try out for myself.

@rust-bors

rust-bors Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

📌 Commit dea3ed8 has been approved by saethlin

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 13, 2026
rust-bors Bot pushed a commit that referenced this pull request Jun 13, 2026
…uwer

Rollup of 5 pull requests

Successful merges:

 - #157518 (Add xdg_basedir API)
 - #157752 (Rename `errors.rs` file to `diagnostics.rs` (6/N))
 - #157769 (Match expressions had not been updated to also show the match_source,…)
 - #157825 (Emit retags in codegen to support BorrowSanitizer (part 3))
 - #157861 (Rename `errors.rs` file to `diagnostics.rs` (7/N))
@rust-bors rust-bors Bot merged commit fafa5b2 into rust-lang:main Jun 13, 2026
12 checks passed
@rustbot rustbot added this to the 1.98.0 milestone Jun 13, 2026
rust-timer added a commit that referenced this pull request Jun 13, 2026
Rollup merge of #157825 - BorrowSanitizer:codegen-emit-retag-3, r=saethlin

Emit retags in codegen to support BorrowSanitizer (part 3)

Tracking issue: #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: #156208, #156210

cc: @RalfJung
r? @saethlin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants