add closure problem error reporting

This commit is contained in:
Folkert 2021-02-16 00:05:00 +01:00
parent 83f875ddca
commit fdf020d89a

View file

@ -721,7 +721,9 @@ pub fn build_exp_call<'a, 'ctx, 'env>(
) )
} }
CallType::ByPointer { name, .. } => { CallType::ByPointer {
name, full_layout, ..
} => {
let sub_expr = load_symbol(scope, name); let sub_expr = load_symbol(scope, name);
let mut arg_vals: Vec<BasicValueEnum> = let mut arg_vals: Vec<BasicValueEnum> =
@ -737,8 +739,8 @@ pub fn build_exp_call<'a, 'ctx, 'env>(
} }
non_ptr => { non_ptr => {
panic!( panic!(
"Tried to call by pointer, but encountered a non-pointer: {:?}", "Tried to call by pointer, but encountered a non-pointer: {:?} {:?} {:?}",
non_ptr name, non_ptr, full_layout
); );
} }
}; };
@ -2250,6 +2252,8 @@ pub fn build_exp_stmt<'a, 'ctx, 'env>(
let value_ptr = value.into_pointer_value(); let value_ptr = value.into_pointer_value();
let refcount_ptr = PointerToRefcount::from_ptr_to_data(env, value_ptr); let refcount_ptr = PointerToRefcount::from_ptr_to_data(env, value_ptr);
refcount_ptr.decrement(env, layout); refcount_ptr.decrement(env, layout);
} else {
eprint!("we're likely leaking memory; see issue #985 for details");
} }
} }