From a4729389164652d71c63a4dc3a0e2f73267991f9 Mon Sep 17 00:00:00 2001 From: nyash-codex Date: Sun, 28 Sep 2025 12:32:26 +0900 Subject: [PATCH] =?UTF-8?q?builder:=20pin=20receiver=20in=20emit=5Fbox=5Fo?= =?UTF-8?q?r=5Fplugin=5Fcall=20to=20prevent=20undefined=20recv=20across=20?= =?UTF-8?q?blocks=20(Patch=E2=80=91A)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mir/builder/utils.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mir/builder/utils.rs b/src/mir/builder/utils.rs index 59cea6f7..56bb010f 100644 --- a/src/mir/builder/utils.rs +++ b/src/mir/builder/utils.rs @@ -76,6 +76,10 @@ impl super::MirBuilder { args: Vec, effects: super::EffectMask, ) -> Result<(), String> { + // Ensure receiver has a definition in the current block to avoid undefined use across + // block boundaries (LoopForm/header, if-joins, etc.). + // Pinning creates a local Copy that participates in PHI when needed. + let box_val = self.pin_to_slot(box_val, "@recv").unwrap_or(box_val); // Check environment variable for unified call usage, with safe overrides for core/user boxes let use_unified_env = super::calls::call_unified::is_unified_call_enabled(); // First, try to determine the box type