Skip to content

Conversation

@AprilNEA
Copy link
Contributor

@AprilNEA AprilNEA commented Dec 29, 2025

Part of #116971.

Add FileCheck annotations to tests/mir-opt/retag.rs, removing the // skip-filecheck directive.

The added CHECK directives verify that the AddRetag pass correctly inserts Retag statements:

  • At function entry for self and reference parameters (Retag([fn entry] _1), Retag([fn entry] _2))
  • Uses CHECK-NEXT to verify Retag statements appear immediately after bb0: {
  • After reborrows for shared reference return values (Retag(_0))
  • For closures (main::{closure#0}) with proper entry retags
  • For array_casts function (testing retags through &raw)
  • For box_to_raw_mut function with [raw] retag (Retag([raw] _0))

r? @cjgillot

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 29, 2025
- Add CHECK for closure (main::{closure#0})
- Use CHECK-NEXT to verify Retag statements order after bb0
- Verify Retag for both self (_1) and reference parameters (_2)
@AprilNEA AprilNEA marked this pull request as ready for review December 29, 2025 09:31
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 29, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 29, 2025

⚠️ Warning ⚠️

  • There are issue links (such as #123) in the commit messages of the following commits.
    Please move them to the PR description, to avoid spamming the issues with references to the commit, and so this bot can automatically canonicalize them to avoid issues with subtree.

// CHECK: bb0: {
// CHECK-NEXT: Retag([fn entry] _1);
// CHECK-NEXT: Retag([fn entry] _2);
// CHECK: Retag(_0);
Copy link
Contributor

Choose a reason for hiding this comment

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

We are checking that we retag just after assigning to _0.

Suggested change
// CHECK: Retag(_0);
// CHECK: _0 = {{.*}};
// CHECK-NEXT: Retag(_0);

// EMIT_MIR retag.main-{closure#0}.SimplifyCfg-pre-optimizations.after.mir
pub fn main() {
// CHECK-LABEL: fn main(
// CHECK: Retag(_{{[0-9]+}});
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you elaborate a bit? There should be 7 retags in this function.

// CHECK-LABEL: fn main::{closure#0}(
// CHECK: bb0: {
// CHECK-NEXT: Retag([fn entry] _1);
// CHECK-NEXT: Retag([fn entry] _2);
Copy link
Contributor

Choose a reason for hiding this comment

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

What about the Retag(_3)?

/// Casting directly to an array should also go through `&raw` and thus add appropriate retags.
// EMIT_MIR retag.array_casts.SimplifyCfg-pre-optimizations.after.mir
// CHECK-LABEL: fn array_casts(
// CHECK: Retag(
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you elaborate? There are 4 retags in this function.

@cjgillot cjgillot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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