{"record":{"id":"cdfd7869cd991b0d","repo":"diem/diem","slug":"ice-invalid-bind-exp-for-single-value","errorCode":null,"errorMessage":"ICE invalid bind_exp for single value","messagePattern":"ICE invalid bind_exp for single value","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"language/move-lang/src/hlir/translate.rs","lineNumber":1264,"sourceCode":"                .map(|(e, tmp_item)| match tmp_item {\n                    TmpItem::Single(s) => H::ExpListItem::Single(e, s),\n                    TmpItem::Splat(loc, ss) => H::ExpListItem::Splat(loc, e, ss),\n                })\n                .collect();\n            HE::ExpList(items)\n        }\n        TE::Borrow(mut_, te, f) => {\n            let e = exp(context, result, None, *te);\n            HE::Borrow(mut_, e, f)\n        }\n        TE::TempBorrow(mut_, te) => {\n            let eb = exp_(context, result, None, *te);\n            let tmp = match bind_exp_impl(context, result, eb, true).exp.value {\n                HE::Move {\n                    from_user: false,\n                    var,\n                } => var,\n                _ => panic!(\"ICE invalid bind_exp for single value\"),\n            };\n            HE::BorrowLocal(mut_, tmp)\n        }\n        TE::Cast(te, rhs_ty) => {\n            use N::BuiltinTypeName_ as BT;\n            let e = exp(context, result, None, *te);\n            let bt = match rhs_ty.value.builtin_name() {\n                Some(bt @ sp!(_, BT::U8))\n                | Some(bt @ sp!(_, BT::U64))\n                | Some(bt @ sp!(_, BT::U128)) => bt.clone(),\n                _ => panic!(\"ICE typing failed for cast\"),\n            };\n            HE::Cast(e, bt)\n        }\n        TE::Annotate(te, rhs_ty) => {\n            let expected_ty = type_(context, *rhs_ty);\n            return exp_(context, result, Some(&expected_ty), *te);\n        }","sourceCodeStart":1246,"sourceCodeEnd":1282,"githubUrl":"https://github.com/diem/diem/blob/fc4714a8ea273b6efe8b13dbce72ea60aad9a16c/language/move-lang/src/hlir/translate.rs#L1246-L1282","documentation":"Internal compiler error in the HLIR translate pass when translating a single-value borrow. The code expects bind_exp_impl to return an expression whose value is HE::Move { from_user: false, var } (a compiler-generated move of a fresh temp); anything else means the temporary-binding invariant established by earlier passes was violated. It is unreachable for well-formed typed expressions.","triggerScenarios":"Translating a borrow of a single (non-list) expression where the bound expression did not lower to a synthetic move of a fresh local — typically only when earlier typing errors exist or an internal pass produced a non-standard expression shape.","commonSituations":"Compiling Move sources with prior type errors where `&expr` or `&mut expr` wraps an already-failed expression; running a modified compiler; compiler version bugs in borrow translation.","solutions":["Fix all earlier compiler diagnostics first — this panic usually occurs while already-erroring code is translated","Upgrade move-compiler to the latest version; if reproducible on clean code, file a minimal repro upstream","Simplify the borrow expression (borrow a local or field directly instead of a complex expression)","Avoid building a patched move-lang without running its test suite"],"exampleFix":"// before\nlet r = &compute(x + y);\n// after\nlet tmp = compute(x + y);\nlet r = &tmp; // borrow a simple local so temp-binding invariants hold","handlingStrategy":"validation","validationCode":"// Ensure type checking succeeded and borrows target simple locals before translation:\nif context.env.has_diags() {\n    return Err(\"abort translation: prior diagnostics present\".into());\n}","typeGuard":null,"tryCatchPattern":"let result = std::panic::catch_unwind(|| translate_program(texp));\nif result.is_err() {\n    eprintln!(\"compiler ICE: invalid bind_exp for single value\");\n    std::process::exit(1);\n}","preventionTips":["Fix all type errors before lower-to-HLIR runs","Borrow local variables/fields directly instead of complex computed expressions","Keep the compiler toolchain on a vetted release","Attach minimal repros when filing compiler bugs"],"tags":["move-compiler","internal-error","borrow","panic"],"backgroundTag":"compiler-internal-error","analyzedSha":"fc4714a8ea273b6efe8b13dbce72ea60aad9a16c","analyzedAt":"2026-09-04T21:07:05.890Z","contentChangedAt":"2026-09-04T21:07:05.890Z","schemaVersion":2},"datasetVersion":"2026-09-12T02:17:10.037Z"}