diff --git a/crates/compiler/gen_llvm/src/llvm/expect.rs b/crates/compiler/gen_llvm/src/llvm/expect.rs index b3361cd151..73e0728a50 100644 --- a/crates/compiler/gen_llvm/src/llvm/expect.rs +++ b/crates/compiler/gen_llvm/src/llvm/expect.rs @@ -219,7 +219,9 @@ fn build_clone<'a, 'ctx, 'env>( when_recursive, ), - Layout::LambdaSet(_) => unreachable!("cannot compare closures"), + // Since we will never actually display functions (and hence lambda sets), we can just pass + // back the nullptr. + Layout::LambdaSet(_) => env.ptr_int().const_zero(), Layout::Union(union_layout) => { if layout.safe_to_memcpy(env.layout_interner) {