diff --git a/src/mir/phi_core/loopform_builder.rs b/src/mir/phi_core/loopform_builder.rs index d5a5568d..8b516bc2 100644 --- a/src/mir/phi_core/loopform_builder.rs +++ b/src/mir/phi_core/loopform_builder.rs @@ -502,6 +502,15 @@ impl LoopFormBuilder { let mut body_local_set: std::collections::HashSet = std::collections::HashSet::new(); for (_block_id, snapshot) in exit_snapshots { for var_name in snapshot.keys() { + // Step 5-5-D: Skip __pin$ temporary variables in exit PHI generation + // These are BodyLocalInternal and should NOT get exit PHIs + if var_name.starts_with("__pin$") && var_name.contains("$@") { + if debug { + eprintln!("[DEBUG/exit_phi] SKIP __pin$ variable: {}", var_name); + } + continue; + } + let is_pinned = self.pinned.iter().any(|p| &p.name == var_name); let is_carrier = self.carriers.iter().any(|c| &c.name == var_name); if !is_pinned && !is_carrier && !body_local_set.contains(var_name) {