forked from M-Labs/nac3
1
0
Fork 0

core/numpy: Add missing lifetime parameters

This commit is contained in:
David Mak 2024-04-29 23:21:57 +08:00
parent f58c3a11f8
commit 7b4253ccd8
1 changed files with 17 additions and 17 deletions

View File

@ -316,15 +316,15 @@ fn ndarray_fill_flattened<'ctx, 'a, G, ValueFn>(
/// Generates LLVM IR for populating the entire `NDArray` using a lambda with the dimension-indices /// Generates LLVM IR for populating the entire `NDArray` using a lambda with the dimension-indices
/// as its input. /// as its input.
fn ndarray_fill_indexed<'ctx, G, ValueFn>( fn ndarray_fill_indexed<'ctx, 'a, G, ValueFn>(
generator: &mut G, generator: &mut G,
ctx: &mut CodeGenContext<'ctx, '_>, ctx: &mut CodeGenContext<'ctx, 'a>,
ndarray: NDArrayValue<'ctx>, ndarray: NDArrayValue<'ctx>,
value_fn: ValueFn, value_fn: ValueFn,
) -> Result<(), String> ) -> Result<(), String>
where where
G: CodeGenerator + ?Sized, G: CodeGenerator + ?Sized,
ValueFn: Fn(&mut G, &mut CodeGenContext<'ctx, '_>, &TypedArrayLikeAdapter<'ctx, IntValue<'ctx>>) -> Result<BasicValueEnum<'ctx>, String>, ValueFn: Fn(&mut G, &mut CodeGenContext<'ctx, 'a>, &TypedArrayLikeAdapter<'ctx, IntValue<'ctx>>) -> Result<BasicValueEnum<'ctx>, String>,
{ {
ndarray_fill_flattened( ndarray_fill_flattened(
generator, generator,
@ -343,16 +343,16 @@ fn ndarray_fill_indexed<'ctx, G, ValueFn>(
) )
} }
fn ndarray_fill_mapping<'ctx, G, MapFn>( fn ndarray_fill_mapping<'ctx, 'a, G, MapFn>(
generator: &mut G, generator: &mut G,
ctx: &mut CodeGenContext<'ctx, '_>, ctx: &mut CodeGenContext<'ctx, 'a>,
src: NDArrayValue<'ctx>, src: NDArrayValue<'ctx>,
dest: NDArrayValue<'ctx>, dest: NDArrayValue<'ctx>,
map_fn: MapFn, map_fn: MapFn,
) -> Result<(), String> ) -> Result<(), String>
where where
G: CodeGenerator + ?Sized, G: CodeGenerator + ?Sized,
MapFn: Fn(&mut G, &mut CodeGenContext<'ctx, '_>, BasicValueEnum<'ctx>) -> Result<BasicValueEnum<'ctx>, String>, MapFn: Fn(&mut G, &mut CodeGenContext<'ctx, 'a>, BasicValueEnum<'ctx>) -> Result<BasicValueEnum<'ctx>, String>,
{ {
ndarray_fill_flattened( ndarray_fill_flattened(
generator, generator,
@ -391,9 +391,9 @@ fn ndarray_assert_is_broadcastable<'ctx, G: CodeGenerator + ?Sized>(
/// Generates the LLVM IR for populating the entire `NDArray` from two `ndarray` or scalar value /// Generates the LLVM IR for populating the entire `NDArray` from two `ndarray` or scalar value
/// with broadcast-compatible shapes. /// with broadcast-compatible shapes.
fn ndarray_broadcast_fill<'ctx, G, ValueFn>( fn ndarray_broadcast_fill<'ctx, 'a, G, ValueFn>(
generator: &mut G, generator: &mut G,
ctx: &mut CodeGenContext<'ctx, '_>, ctx: &mut CodeGenContext<'ctx, 'a>,
res: NDArrayValue<'ctx>, res: NDArrayValue<'ctx>,
lhs: (BasicValueEnum<'ctx>, bool), lhs: (BasicValueEnum<'ctx>, bool),
rhs: (BasicValueEnum<'ctx>, bool), rhs: (BasicValueEnum<'ctx>, bool),
@ -401,7 +401,7 @@ fn ndarray_broadcast_fill<'ctx, G, ValueFn>(
) -> Result<NDArrayValue<'ctx>, String> ) -> Result<NDArrayValue<'ctx>, String>
where where
G: CodeGenerator + ?Sized, G: CodeGenerator + ?Sized,
ValueFn: Fn(&mut G, &mut CodeGenContext<'ctx, '_>, (BasicValueEnum<'ctx>, BasicValueEnum<'ctx>)) -> Result<BasicValueEnum<'ctx>, String>, ValueFn: Fn(&mut G, &mut CodeGenContext<'ctx, 'a>, (BasicValueEnum<'ctx>, BasicValueEnum<'ctx>)) -> Result<BasicValueEnum<'ctx>, String>,
{ {
let llvm_usize = generator.get_size_type(ctx.ctx); let llvm_usize = generator.get_size_type(ctx.ctx);
@ -684,17 +684,17 @@ fn ndarray_copy_impl<'ctx, G: CodeGenerator + ?Sized>(
Ok(ndarray) Ok(ndarray)
} }
pub fn ndarray_elementwise_unaryop_impl<'ctx, G, MapFn>( pub fn ndarray_elementwise_unaryop_impl<'ctx, 'a, G, MapFn>(
generator: &mut G, generator: &mut G,
ctx: &mut CodeGenContext<'ctx, '_>, ctx: &mut CodeGenContext<'ctx, 'a>,
elem_ty: Type, elem_ty: Type,
res: Option<NDArrayValue<'ctx>>, res: Option<NDArrayValue<'ctx>>,
operand: NDArrayValue<'ctx>, operand: NDArrayValue<'ctx>,
map_fn: MapFn, map_fn: MapFn,
) -> Result<NDArrayValue<'ctx>, String> ) -> Result<NDArrayValue<'ctx>, String>
where where
G: CodeGenerator, G: CodeGenerator + ?Sized,
MapFn: Fn(&mut G, &mut CodeGenContext<'ctx, '_>, BasicValueEnum<'ctx>) -> Result<BasicValueEnum<'ctx>, String>, MapFn: Fn(&mut G, &mut CodeGenContext<'ctx, 'a>, BasicValueEnum<'ctx>) -> Result<BasicValueEnum<'ctx>, String>,
{ {
let res = res.unwrap_or_else(|| { let res = res.unwrap_or_else(|| {
create_ndarray_dyn_shape( create_ndarray_dyn_shape(
@ -745,9 +745,9 @@ pub fn ndarray_elementwise_unaryop_impl<'ctx, G, MapFn>(
/// # Panic /// # Panic
/// ///
/// This function will panic if neither input operands (`lhs` or `rhs`) is a `ndarray`. /// This function will panic if neither input operands (`lhs` or `rhs`) is a `ndarray`.
pub fn ndarray_elementwise_binop_impl<'ctx, G, ValueFn>( pub fn ndarray_elementwise_binop_impl<'ctx, 'a, G, ValueFn>(
generator: &mut G, generator: &mut G,
ctx: &mut CodeGenContext<'ctx, '_>, ctx: &mut CodeGenContext<'ctx, 'a>,
elem_ty: Type, elem_ty: Type,
res: Option<NDArrayValue<'ctx>>, res: Option<NDArrayValue<'ctx>>,
lhs: (BasicValueEnum<'ctx>, bool), lhs: (BasicValueEnum<'ctx>, bool),
@ -755,8 +755,8 @@ pub fn ndarray_elementwise_binop_impl<'ctx, G, ValueFn>(
value_fn: ValueFn, value_fn: ValueFn,
) -> Result<NDArrayValue<'ctx>, String> ) -> Result<NDArrayValue<'ctx>, String>
where where
G: CodeGenerator, G: CodeGenerator + ?Sized,
ValueFn: Fn(&mut G, &mut CodeGenContext<'ctx, '_>, (BasicValueEnum<'ctx>, BasicValueEnum<'ctx>)) -> Result<BasicValueEnum<'ctx>, String>, ValueFn: Fn(&mut G, &mut CodeGenContext<'ctx, 'a>, (BasicValueEnum<'ctx>, BasicValueEnum<'ctx>)) -> Result<BasicValueEnum<'ctx>, String>,
{ {
let llvm_usize = generator.get_size_type(ctx.ctx); let llvm_usize = generator.get_size_type(ctx.ctx);