many clippy fixes

This commit is contained in:
Anton-4 2023-04-24 16:21:46 +02:00
parent 7bbb37a843
commit 9748e4a4dc
No known key found for this signature in database
GPG key ID: 0971D718C0A9B937
17 changed files with 455 additions and 600 deletions

View file

@ -614,8 +614,8 @@ pub fn construct_optimization_passes<'a>(
(mpm, fpm)
}
fn promote_to_main_function<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
fn promote_to_main_function<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
mod_solutions: &'a ModSolutions,
symbol: Symbol,
@ -653,8 +653,8 @@ fn promote_to_main_function<'a, 'ctx, 'env>(
(main_fn_name, main_fn)
}
fn promote_to_wasm_test_wrapper<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
fn promote_to_wasm_test_wrapper<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
mod_solutions: &'a ModSolutions,
symbol: Symbol,
@ -746,8 +746,8 @@ fn promote_to_wasm_test_wrapper<'a, 'ctx, 'env>(
(main_fn_name, main_fn)
}
fn int_with_precision<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
fn int_with_precision<'ctx>(
env: &Env<'_, 'ctx, '_>,
value: i128,
int_width: IntWidth,
) -> IntValue<'ctx> {
@ -762,8 +762,8 @@ fn int_with_precision<'a, 'ctx, 'env>(
}
}
fn float_with_precision<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
fn float_with_precision<'ctx>(
env: &Env<'_, 'ctx, '_>,
value: f64,
float_width: FloatWidth,
) -> BasicValueEnum<'ctx> {
@ -773,8 +773,8 @@ fn float_with_precision<'a, 'ctx, 'env>(
}
}
pub fn build_exp_literal<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
pub fn build_exp_literal<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &STLayoutInterner<'a>,
parent: FunctionValue<'ctx>,
layout: InLayout<'_>,
@ -817,8 +817,8 @@ pub fn build_exp_literal<'a, 'ctx, 'env>(
}
}
fn build_string_literal<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
fn build_string_literal<'ctx>(
env: &Env<'_, 'ctx, '_>,
parent: FunctionValue<'ctx>,
str_literal: &str,
) -> BasicValueEnum<'ctx> {
@ -844,8 +844,8 @@ fn build_string_literal<'a, 'ctx, 'env>(
}
}
fn const_str_alloca_ptr<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
fn const_str_alloca_ptr<'ctx>(
env: &Env<'_, 'ctx, '_>,
parent: FunctionValue<'ctx>,
ptr: PointerValue<'ctx>,
len: IntValue<'ctx>,
@ -862,8 +862,8 @@ fn const_str_alloca_ptr<'a, 'ctx, 'env>(
alloca
}
fn small_str_ptr_width_8<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
fn small_str_ptr_width_8<'ctx>(
env: &Env<'_, 'ctx, '_>,
parent: FunctionValue<'ctx>,
str_literal: &str,
) -> PointerValue<'ctx> {
@ -890,10 +890,7 @@ fn small_str_ptr_width_8<'a, 'ctx, 'env>(
const_str_alloca_ptr(env, parent, ptr, len, cap)
}
fn small_str_ptr_width_4<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
str_literal: &str,
) -> StructValue<'ctx> {
fn small_str_ptr_width_4<'ctx>(env: &Env<'_, 'ctx, '_>, str_literal: &str) -> StructValue<'ctx> {
debug_assert_eq!(env.target_info.ptr_width() as u8, 4);
let mut array = [0u8; 12];
@ -921,8 +918,8 @@ fn small_str_ptr_width_4<'a, 'ctx, 'env>(
)
}
pub fn build_exp_call<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
pub fn build_exp_call<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
layout_ids: &mut LayoutIds<'a>,
func_spec_solutions: &FuncSpecSolutions,
@ -1068,8 +1065,8 @@ fn struct_pointer_from_fields<'a, 'ctx, 'env, I>(
}
}
pub fn build_exp_expr<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
pub fn build_exp_expr<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
layout_ids: &mut LayoutIds<'a>,
func_spec_solutions: &FuncSpecSolutions,
@ -1489,8 +1486,8 @@ pub fn build_exp_expr<'a, 'ctx, 'env>(
}
}
fn build_wrapped_tag<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
fn build_wrapped_tag<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
scope: &Scope<'a, 'ctx>,
union_layout: &UnionLayout<'a>,
@ -1568,8 +1565,8 @@ fn build_wrapped_tag<'a, 'ctx, 'env>(
}
}
pub fn entry_block_alloca_zerofill<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
pub fn entry_block_alloca_zerofill<'ctx>(
env: &Env<'_, 'ctx, '_>,
basic_type: BasicTypeEnum<'ctx>,
name: &str,
) -> PointerValue<'ctx> {
@ -1583,8 +1580,8 @@ pub fn entry_block_alloca_zerofill<'a, 'ctx, 'env>(
create_entry_block_alloca(env, parent, basic_type, name)
}
fn build_tag_field_value<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
fn build_tag_field_value<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
value: BasicValueEnum<'ctx>,
tag_field_layout: InLayout<'a>,
@ -1643,8 +1640,8 @@ fn build_tag_fields<'a, 'r, 'ctx, 'env>(
(field_types, field_values)
}
fn build_struct<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
fn build_struct<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
scope: &Scope<'a, 'ctx>,
sorted_fields: &[Symbol],
@ -1685,8 +1682,8 @@ fn build_struct<'a, 'ctx, 'env>(
struct_from_fields(env, struct_type, field_vals.into_iter().enumerate())
}
fn build_tag<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
fn build_tag<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
scope: &Scope<'a, 'ctx>,
union_layout: &UnionLayout<'a>,
@ -1844,8 +1841,8 @@ fn build_tag<'a, 'ctx, 'env>(
}
}
fn tag_pointer_set_tag_id<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
fn tag_pointer_set_tag_id<'ctx>(
env: &Env<'_, 'ctx, '_>,
tag_id: u8,
pointer: PointerValue<'ctx>,
) -> PointerValue<'ctx> {
@ -1870,8 +1867,8 @@ pub fn tag_pointer_tag_id_bits_and_mask(target_info: TargetInfo) -> (u64, u64) {
}
}
pub fn tag_pointer_read_tag_id<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
pub fn tag_pointer_read_tag_id<'ctx>(
env: &Env<'_, 'ctx, '_>,
pointer: PointerValue<'ctx>,
) -> IntValue<'ctx> {
let (_, mask) = tag_pointer_tag_id_bits_and_mask(env.target_info);
@ -1886,8 +1883,8 @@ pub fn tag_pointer_read_tag_id<'a, 'ctx, 'env>(
.build_int_cast_sign_flag(masked, env.context.i8_type(), false, "to_u8")
}
pub fn tag_pointer_clear_tag_id<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
pub fn tag_pointer_clear_tag_id<'ctx>(
env: &Env<'_, 'ctx, '_>,
pointer: PointerValue<'ctx>,
) -> PointerValue<'ctx> {
let ptr_int = env.ptr_int();
@ -1908,8 +1905,8 @@ pub fn tag_pointer_clear_tag_id<'a, 'ctx, 'env>(
.build_int_to_ptr(masked, pointer.get_type(), "to_ptr")
}
fn allocate_tag<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
fn allocate_tag<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
parent: FunctionValue<'ctx>,
reuse_allocation: Option<PointerValue<'ctx>>,
@ -1968,8 +1965,8 @@ fn allocate_tag<'a, 'ctx, 'env>(
}
}
pub fn get_tag_id<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
pub fn get_tag_id<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
parent: FunctionValue<'ctx>,
union_layout: &UnionLayout<'a>,
@ -2051,8 +2048,8 @@ pub fn get_tag_id<'a, 'ctx, 'env>(
}
}
fn lookup_at_index_ptr<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
fn lookup_at_index_ptr<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
field_layouts: &[InLayout<'a>],
index: usize,
@ -2086,8 +2083,8 @@ fn lookup_at_index_ptr<'a, 'ctx, 'env>(
cast_if_necessary_for_opaque_recursive_pointers(env.builder, result, target_loaded_type)
}
fn lookup_at_index_ptr2<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
fn lookup_at_index_ptr2<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
field_layouts: &'a [InLayout<'a>],
index: usize,
@ -2129,8 +2126,8 @@ fn lookup_at_index_ptr2<'a, 'ctx, 'env>(
cast_if_necessary_for_opaque_recursive_pointers(env.builder, result, target_loaded_type)
}
pub fn reserve_with_refcount<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
pub fn reserve_with_refcount<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
layout: InLayout<'a>,
) -> PointerValue<'ctx> {
@ -2142,8 +2139,8 @@ pub fn reserve_with_refcount<'a, 'ctx, 'env>(
reserve_with_refcount_help(env, basic_type, stack_size, alignment_bytes)
}
fn reserve_with_refcount_union_as_block_of_memory<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
fn reserve_with_refcount_union_as_block_of_memory<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
union_layout: UnionLayout<'a>,
fields: &[&[InLayout<'a>]],
@ -2177,8 +2174,8 @@ fn reserve_with_refcount_help<'a, 'ctx, 'env>(
allocate_with_refcount_help(env, basic_type, alignment_bytes, value_bytes_intvalue)
}
pub fn allocate_with_refcount<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
pub fn allocate_with_refcount<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
layout: InLayout<'a>,
value: BasicValueEnum<'ctx>,
@ -2213,8 +2210,8 @@ pub fn allocate_with_refcount_help<'a, 'ctx, 'env>(
.build_pointer_cast(ptr, ptr_type, "alloc_cast_to_desired")
}
fn list_literal<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
fn list_literal<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
parent: FunctionValue<'ctx>,
scope: &Scope<'a, 'ctx>,
@ -2382,8 +2379,8 @@ fn list_literal<'a, 'ctx, 'env>(
}
}
pub fn load_roc_value<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
pub fn load_roc_value<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
layout: InLayout<'a>,
source: PointerValue<'ctx>,
@ -2402,8 +2399,8 @@ pub fn load_roc_value<'a, 'ctx, 'env>(
}
}
pub fn use_roc_value<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
pub fn use_roc_value<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
layout: InLayout<'a>,
source: BasicValueEnum<'ctx>,
@ -2424,8 +2421,8 @@ pub fn use_roc_value<'a, 'ctx, 'env>(
}
}
pub fn store_roc_value_opaque<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
pub fn store_roc_value_opaque<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
layout: InLayout<'a>,
opaque_destination: PointerValue<'ctx>,
@ -2440,8 +2437,8 @@ pub fn store_roc_value_opaque<'a, 'ctx, 'env>(
store_roc_value(env, layout_interner, layout, destination, value)
}
pub fn store_roc_value<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
pub fn store_roc_value<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
layout: InLayout<'a>,
destination: PointerValue<'ctx>,
@ -2481,8 +2478,8 @@ pub fn store_roc_value<'a, 'ctx, 'env>(
}
}
pub fn build_exp_stmt<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
pub fn build_exp_stmt<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
layout_ids: &mut LayoutIds<'a>,
func_spec_solutions: &FuncSpecSolutions,
@ -3048,7 +3045,7 @@ pub fn build_exp_stmt<'a, 'ctx, 'env>(
}
}
pub fn load_symbol<'a, 'ctx>(scope: &Scope<'a, 'ctx>, symbol: &Symbol) -> BasicValueEnum<'ctx> {
pub fn load_symbol<'ctx>(scope: &Scope<'_, 'ctx>, symbol: &Symbol) -> BasicValueEnum<'ctx> {
match scope.get(symbol) {
Some((_, ptr)) => *ptr,
@ -3059,8 +3056,8 @@ pub fn load_symbol<'a, 'ctx>(scope: &Scope<'a, 'ctx>, symbol: &Symbol) -> BasicV
}
}
pub(crate) fn load_symbol_and_layout<'a, 'ctx, 'b>(
scope: &'b Scope<'a, 'ctx>,
pub(crate) fn load_symbol_and_layout<'a, 'ctx>(
scope: &Scope<'a, 'ctx>,
symbol: &Symbol,
) -> (BasicValueEnum<'ctx>, InLayout<'a>) {
match scope.get(symbol) {
@ -3172,8 +3169,8 @@ pub fn complex_bitcast<'ctx>(
/// Check the size of the input and output types. Pretending we have more bytes at a pointer than
/// we actually do can lead to faulty optimizations and weird segfaults/crashes
pub fn complex_bitcast_check_size<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
pub fn complex_bitcast_check_size<'ctx>(
env: &Env<'_, 'ctx, '_>,
from_value: BasicValueEnum<'ctx>,
to_type: BasicTypeEnum<'ctx>,
name: &str,
@ -3284,8 +3281,8 @@ fn complex_bitcast_to_bigger_than_from<'ctx>(
}
/// get the tag id out of a pointer to a wrapped (i.e. stores the tag id at runtime) layout
fn get_tag_id_wrapped<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
fn get_tag_id_wrapped<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
union_layout: UnionLayout<'a>,
from_value: PointerValue<'ctx>,
@ -3308,8 +3305,8 @@ fn get_tag_id_wrapped<'a, 'ctx, 'env>(
.into_int_value()
}
pub fn get_tag_id_non_recursive<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
pub fn get_tag_id_non_recursive<'ctx>(
env: &Env<'_, 'ctx, '_>,
tag: StructValue<'ctx>,
) -> IntValue<'ctx> {
env.builder
@ -3326,7 +3323,7 @@ struct SwitchArgsIr<'a, 'ctx> {
pub ret_type: BasicTypeEnum<'ctx>,
}
fn const_i128<'a, 'ctx, 'env>(env: &Env<'a, 'ctx, 'env>, value: i128) -> IntValue<'ctx> {
fn const_i128<'ctx>(env: &Env<'_, 'ctx, '_>, value: i128) -> IntValue<'ctx> {
// truncate the lower 64 bits
let value = value as u128;
let a = value as u64;
@ -3339,7 +3336,7 @@ fn const_i128<'a, 'ctx, 'env>(env: &Env<'a, 'ctx, 'env>, value: i128) -> IntValu
.const_int_arbitrary_precision(&[a, b])
}
fn const_u128<'a, 'ctx, 'env>(env: &Env<'a, 'ctx, 'env>, value: u128) -> IntValue<'ctx> {
fn const_u128<'ctx>(env: &Env<'_, 'ctx, '_>, value: u128) -> IntValue<'ctx> {
// truncate the lower 64 bits
let value = value;
let a = value as u64;
@ -3352,8 +3349,8 @@ fn const_u128<'a, 'ctx, 'env>(env: &Env<'a, 'ctx, 'env>, value: u128) -> IntValu
.const_int_arbitrary_precision(&[a, b])
}
fn build_switch_ir<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
fn build_switch_ir<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
layout_ids: &mut LayoutIds<'a>,
func_spec_solutions: &FuncSpecSolutions,
@ -3557,8 +3554,8 @@ fn build_switch_ir<'a, 'ctx, 'env>(
}
/// Creates a new stack allocation instruction in the entry block of the function.
pub fn create_entry_block_alloca<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
pub fn create_entry_block_alloca<'ctx>(
env: &Env<'_, 'ctx, '_>,
parent: FunctionValue<'_>,
basic_type: BasicTypeEnum<'ctx>,
name: &str,
@ -3574,8 +3571,8 @@ pub fn create_entry_block_alloca<'a, 'ctx>(
builder.build_alloca(basic_type, name)
}
fn expose_function_to_host<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
fn expose_function_to_host<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
symbol: Symbol,
roc_function: FunctionValue<'ctx>,
@ -3607,8 +3604,8 @@ fn expose_function_to_host<'a, 'ctx, 'env>(
);
}
fn expose_function_to_host_help_c_abi_generic<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
fn expose_function_to_host_help_c_abi_generic<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
roc_function: FunctionValue<'ctx>,
arguments: &[InLayout<'a>],
@ -3753,8 +3750,8 @@ fn expose_function_to_host_help_c_abi_generic<'a, 'ctx, 'env>(
c_function
}
fn expose_function_to_host_help_c_abi_gen_test<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
fn expose_function_to_host_help_c_abi_gen_test<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
ident_string: &str,
roc_function: FunctionValue<'ctx>,
@ -3915,8 +3912,8 @@ fn expose_function_to_host_help_c_abi_gen_test<'a, 'ctx, 'env>(
c_function
}
fn expose_function_to_host_help_c_abi_v2<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
fn expose_function_to_host_help_c_abi_v2<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
roc_function: FunctionValue<'ctx>,
arguments: &[InLayout<'a>],
@ -4151,8 +4148,8 @@ fn expose_function_to_host_help_c_abi_v2<'a, 'ctx, 'env>(
c_function
}
fn expose_function_to_host_help_c_abi<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
fn expose_function_to_host_help_c_abi<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
ident_string: &str,
roc_function: FunctionValue<'ctx>,
@ -4237,7 +4234,7 @@ fn expose_function_to_host_help_c_abi<'a, 'ctx, 'env>(
c_function
}
pub fn get_sjlj_buffer<'a, 'ctx, 'env>(env: &Env<'a, 'ctx, 'env>) -> PointerValue<'ctx> {
pub fn get_sjlj_buffer<'ctx>(env: &Env<'_, 'ctx, '_>) -> PointerValue<'ctx> {
// The size of jump_buf is target-dependent.
// - AArch64 needs 3 machine-sized words
// - LLVM says the following about the SJLJ intrinsic:
@ -4269,7 +4266,7 @@ pub fn get_sjlj_buffer<'a, 'ctx, 'env>(env: &Env<'a, 'ctx, 'env>) -> PointerValu
)
}
pub fn build_setjmp_call<'a, 'ctx, 'env>(env: &Env<'a, 'ctx, 'env>) -> BasicValueEnum<'ctx> {
pub fn build_setjmp_call<'ctx>(env: &Env<'_, 'ctx, '_>) -> BasicValueEnum<'ctx> {
let jmp_buf = get_sjlj_buffer(env);
if cfg!(target_arch = "aarch64") {
// Due to https://github.com/roc-lang/roc/issues/2965, we use a setjmp we linked in from Zig
@ -4336,7 +4333,7 @@ pub fn build_setjmp_call<'a, 'ctx, 'env>(env: &Env<'a, 'ctx, 'env>) -> BasicValu
}
/// Pointer to RocStr which is the panic message.
pub fn get_panic_msg_ptr<'a, 'ctx, 'env>(env: &Env<'a, 'ctx, 'env>) -> PointerValue<'ctx> {
pub fn get_panic_msg_ptr<'ctx>(env: &Env<'_, 'ctx, '_>) -> PointerValue<'ctx> {
let str_typ = zig_str_type(env);
let global_name = "roc_panic_msg_str";
@ -4351,7 +4348,7 @@ pub fn get_panic_msg_ptr<'a, 'ctx, 'env>(env: &Env<'a, 'ctx, 'env>) -> PointerVa
/// Pointer to the panic tag.
/// Only non-zero values must be written into here.
pub fn get_panic_tag_ptr<'a, 'ctx, 'env>(env: &Env<'a, 'ctx, 'env>) -> PointerValue<'ctx> {
pub fn get_panic_tag_ptr<'ctx>(env: &Env<'_, 'ctx, '_>) -> PointerValue<'ctx> {
let i64_typ = env.context.i64_type();
let global_name = "roc_panic_msg_tag";
@ -4364,8 +4361,8 @@ pub fn get_panic_tag_ptr<'a, 'ctx, 'env>(env: &Env<'a, 'ctx, 'env>) -> PointerVa
global.as_pointer_value()
}
fn set_jump_and_catch_long_jump<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
fn set_jump_and_catch_long_jump<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
parent: FunctionValue<'ctx>,
roc_function: FunctionValue<'ctx>,
@ -4446,8 +4443,8 @@ fn set_jump_and_catch_long_jump<'a, 'ctx, 'env>(
)
}
fn make_exception_catcher<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
fn make_exception_catcher<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
roc_function: FunctionValue<'ctx>,
return_layout: InLayout<'a>,
@ -4477,8 +4474,8 @@ fn roc_call_result_layout<'a>(
Layout::struct_no_name_order(arena.alloc(elements))
}
fn roc_call_result_type<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
fn roc_call_result_type<'ctx>(
env: &Env<'_, 'ctx, '_>,
return_type: BasicTypeEnum<'ctx>,
) -> StructType<'ctx> {
env.context.struct_type(
@ -4491,8 +4488,8 @@ fn roc_call_result_type<'a, 'ctx, 'env>(
)
}
fn make_good_roc_result<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
fn make_good_roc_result<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
return_layout: InLayout<'a>,
return_value: BasicValueEnum<'ctx>,
@ -4530,8 +4527,8 @@ fn make_good_roc_result<'a, 'ctx, 'env>(
v3.into_struct_value().into()
}
fn make_exception_catching_wrapper<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
fn make_exception_catching_wrapper<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
roc_function: FunctionValue<'ctx>,
return_layout: InLayout<'a>,
@ -4607,8 +4604,8 @@ fn make_exception_catching_wrapper<'a, 'ctx, 'env>(
wrapper_function
}
pub fn build_proc_headers<'a, 'r, 'ctx, 'env>(
env: &'r Env<'a, 'ctx, 'env>,
pub fn build_proc_headers<'a, 'r, 'ctx>(
env: &'r Env<'a, 'ctx, '_>,
layout_interner: &'r mut STLayoutInterner<'a>,
mod_solutions: &'a ModSolutions,
procedures: MutMap<(Symbol, ProcLayout<'a>), roc_mono::ir::Proc<'a>>,
@ -4655,8 +4652,8 @@ pub fn build_proc_headers<'a, 'r, 'ctx, 'env>(
headers
}
pub fn build_procedures<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
pub fn build_procedures<'a>(
env: &Env<'a, '_, '_>,
layout_interner: &mut STLayoutInterner<'a>,
opt_level: OptLevel,
procedures: MutMap<(Symbol, ProcLayout<'a>), roc_mono::ir::Proc<'a>>,
@ -4711,8 +4708,8 @@ pub fn build_procedures<'a, 'ctx, 'env>(
}
}
pub fn build_wasm_test_wrapper<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
pub fn build_wasm_test_wrapper<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
opt_level: OptLevel,
procedures: MutMap<(Symbol, ProcLayout<'a>), roc_mono::ir::Proc<'a>>,
@ -4736,8 +4733,8 @@ pub fn build_wasm_test_wrapper<'a, 'ctx, 'env>(
)
}
pub fn build_procedures_return_main<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
pub fn build_procedures_return_main<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
opt_level: OptLevel,
procedures: MutMap<(Symbol, ProcLayout<'a>), roc_mono::ir::Proc<'a>>,
@ -4761,8 +4758,8 @@ pub fn build_procedures_return_main<'a, 'ctx, 'env>(
)
}
pub fn build_procedures_expose_expects<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
pub fn build_procedures_expose_expects<'a>(
env: &Env<'a, '_, '_>,
layout_interner: &mut STLayoutInterner<'a>,
opt_level: OptLevel,
expects: &'a [Symbol],
@ -4832,8 +4829,8 @@ pub fn build_procedures_expose_expects<'a, 'ctx, 'env>(
expect_names
}
fn build_procedures_help<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
fn build_procedures_help<'a>(
env: &Env<'a, '_, '_>,
layout_interner: &mut STLayoutInterner<'a>,
opt_level: OptLevel,
procedures: MutMap<(Symbol, ProcLayout<'a>), roc_mono::ir::Proc<'a>>,
@ -4957,8 +4954,8 @@ fn func_spec_name<'a>(
buf
}
fn build_proc_header<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
fn build_proc_header<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
func_spec: FuncSpec,
symbol: Symbol,
@ -5024,8 +5021,8 @@ fn build_proc_header<'a, 'ctx, 'env>(
fn_val
}
fn expose_alias_to_host<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
fn expose_alias_to_host<'a>(
env: &Env<'a, '_, '_>,
layout_interner: &mut STLayoutInterner<'a>,
mod_solutions: &'a ModSolutions,
fn_name: &str,
@ -5105,8 +5102,8 @@ fn expose_alias_to_host<'a, 'ctx, 'env>(
}
}
fn build_closure_caller<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
fn build_closure_caller<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
def_name: &str,
evaluator: FunctionValue<'ctx>,
@ -5236,8 +5233,8 @@ fn build_closure_caller<'a, 'ctx, 'env>(
);
}
fn build_host_exposed_alias_size<'a, 'r, 'ctx, 'env>(
env: &'r Env<'a, 'ctx, 'env>,
fn build_host_exposed_alias_size<'a, 'r>(
env: &'r Env<'a, '_, '_>,
layout_interner: &'r mut STLayoutInterner<'a>,
def_name: &str,
alias_symbol: Symbol,
@ -5252,8 +5249,8 @@ fn build_host_exposed_alias_size<'a, 'r, 'ctx, 'env>(
)
}
fn build_host_exposed_alias_size_help<'a, 'ctx, 'env>(
env: &'a Env<'a, 'ctx, 'env>,
fn build_host_exposed_alias_size_help<'a, 'ctx>(
env: &'a Env<'a, 'ctx, '_>,
def_name: &str,
_alias_symbol: Symbol,
opt_label: Option<&str>,
@ -5286,8 +5283,8 @@ fn build_host_exposed_alias_size_help<'a, 'ctx, 'env>(
builder.build_return(Some(&size));
}
fn build_proc<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
fn build_proc<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
mod_solutions: &'a ModSolutions,
layout_ids: &mut LayoutIds<'a>,
@ -5371,8 +5368,8 @@ pub fn verify_fn(fn_val: FunctionValue<'_>) {
}
}
pub(crate) fn function_value_by_func_spec<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
pub(crate) fn function_value_by_func_spec<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
func_spec: FuncSpec,
symbol: Symbol,
arguments: &[InLayout<'a>],
@ -5385,8 +5382,8 @@ pub(crate) fn function_value_by_func_spec<'a, 'ctx, 'env>(
function_value_by_name_help(env, arguments, niche, result, symbol, fn_name)
}
fn function_value_by_name_help<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
fn function_value_by_name_help<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
arguments: &[InLayout<'a>],
_niche: Niche<'a>,
result: InLayout<'a>,
@ -5425,8 +5422,8 @@ fn function_value_by_name_help<'a, 'ctx, 'env>(
}
#[inline(always)]
fn roc_call_with_args<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
fn roc_call_with_args<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
argument_layouts: &[InLayout<'a>],
result_layout: InLayout<'a>,
@ -5446,8 +5443,8 @@ fn roc_call_with_args<'a, 'ctx, 'env>(
call_roc_function(env, layout_interner, fn_val, result_layout, arguments)
}
pub fn call_roc_function<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
pub fn call_roc_function<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
roc_function: FunctionValue<'ctx>,
result_layout: InLayout<'a>,
@ -5561,8 +5558,8 @@ pub struct RocFunctionCall<'ctx> {
pub data_is_owned: IntValue<'ctx>,
}
pub(crate) fn roc_function_call<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
pub(crate) fn roc_function_call<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
layout_ids: &mut LayoutIds<'a>,
transform: FunctionValue<'ctx>,
@ -5616,8 +5613,8 @@ pub(crate) fn roc_function_call<'a, 'ctx, 'env>(
///
/// As an example, structs that fit inside an integer type should
/// (this does not currently happen here) be coerced to that integer type.
fn to_cc_type<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
fn to_cc_type<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
layout: InLayout<'a>,
) -> BasicTypeEnum<'ctx> {
@ -5630,8 +5627,8 @@ fn to_cc_type<'a, 'ctx, 'env>(
}
}
fn to_cc_type_builtin<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
fn to_cc_type_builtin<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
builtin: &Builtin<'a>,
) -> BasicTypeEnum<'ctx> {
match builtin {
@ -5691,8 +5688,8 @@ impl RocReturn {
}
}
pub(crate) fn from_layout<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
pub(crate) fn from_layout<'a>(
env: &Env<'a, '_, '_>,
layout_interner: &mut STLayoutInterner<'a>,
layout: InLayout<'a>,
) -> Self {
@ -5832,8 +5829,8 @@ impl<'ctx> FunctionSpec<'ctx> {
}
/// According to the C ABI, how should we return a value with the given layout?
pub fn to_cc_return<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
pub fn to_cc_return<'a>(
env: &Env<'a, '_, '_>,
layout_interner: &mut STLayoutInterner<'a>,
layout: InLayout<'a>,
) -> CCReturn {
@ -5855,16 +5852,16 @@ pub fn to_cc_return<'a, 'ctx, 'env>(
}
}
fn function_arguments<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
fn function_arguments<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
arguments: &[BasicTypeEnum<'ctx>],
) -> Vec<'a, BasicMetadataTypeEnum<'ctx>> {
let it = arguments.iter().map(|x| (*x).into());
Vec::from_iter_in(it, env.arena)
}
fn build_foreign_symbol<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
fn build_foreign_symbol<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
layout_interner: &mut STLayoutInterner<'a>,
scope: &mut Scope<'a, 'ctx>,
foreign: &roc_module::ident::ForeignSymbol,
@ -6038,8 +6035,8 @@ fn build_foreign_symbol<'a, 'ctx, 'env>(
)
}
fn define_global_str_literal_ptr<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
fn define_global_str_literal_ptr<'ctx>(
env: &Env<'_, 'ctx, '_>,
message: &str,
) -> PointerValue<'ctx> {
let global = define_global_str_literal(env, message);
@ -6065,8 +6062,8 @@ fn define_global_str_literal_ptr<'a, 'ctx, 'env>(
ptr
}
fn define_global_str_literal<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
fn define_global_str_literal<'ctx>(
env: &Env<'_, 'ctx, '_>,
message: &str,
) -> inkwell::values::GlobalValue<'ctx> {
let module = env.module;
@ -6119,8 +6116,8 @@ fn define_global_str_literal<'a, 'ctx, 'env>(
}
}
pub(crate) fn throw_internal_exception<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
pub(crate) fn throw_internal_exception<'ctx>(
env: &Env<'_, 'ctx, '_>,
parent: FunctionValue<'ctx>,
message: &str,
) {
@ -6133,8 +6130,8 @@ pub(crate) fn throw_internal_exception<'a, 'ctx, 'env>(
builder.build_unreachable();
}
pub(crate) fn throw_exception<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
pub(crate) fn throw_exception<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>,
scope: &mut Scope<'a, 'ctx>,
message: &Symbol,
tag: CrashTag,
@ -6146,8 +6143,8 @@ pub(crate) fn throw_exception<'a, 'ctx, 'env>(
env.builder.build_unreachable();
}
fn get_foreign_symbol<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
fn get_foreign_symbol<'ctx>(
env: &Env<'_, 'ctx, '_>,
foreign_symbol: roc_module::ident::ForeignSymbol,
function_spec: FunctionSpec<'ctx>,
) -> FunctionValue<'ctx> {