Skip to content

Emit retags in codegen to support BorrowSanitizer (part 4)#158100

Open
icmccorm wants to merge 3 commits into
rust-lang:mainfrom
BorrowSanitizer:codegen-emit-retag-4
Open

Emit retags in codegen to support BorrowSanitizer (part 4)#158100
icmccorm wants to merge 3 commits into
rust-lang:mainfrom
BorrowSanitizer:codegen-emit-retag-4

Conversation

@icmccorm

@icmccorm icmccorm commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Tracking issue: #154760
Zulip Thread

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

This PR emits our retag intrinsics based on the structure of a RetagPlan. The feature works end-to-end now! But, it has two limitations:

  • We do not track interior mutable or pinned ranges precisely. This will come in the next PR, which should be the last one that we need to complete this feature (excluding documentation and compile tests).

  • We recurse into repr(simd) types when building a RetagPlan, but we do not emit retags for their fields. We would need BuilderMethods::insert_element, which isn't available. I'm not sure what the best workaround would be for this.

Related: #157825, #156210, #156208

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 18, 2026
@rust-log-analyzer

This comment has been minimized.

) -> Option<RetagPlan<Bx::Value>> {
None
let tcx = bx.tcx();
let opts = tcx.sess.opts.unstable_opts.codegen_emit_retag.unwrap_or_default();

@saethlin saethlin Jun 21, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't opts unused?

View changes since the review

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, you've allowed the lint for this module because the plumbing was incomplete. I suspect now is probably a good time to remove the allow?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whups! Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants