core: Remove Box from GenCallCallback type alias

So that references to the function type can be taken.
pull/400/head
David Mak 2024-04-23 14:35:11 +08:00
parent 64a3751fc2
commit d0766a116f
2 changed files with 5 additions and 6 deletions

View File

@ -108,7 +108,7 @@ fn create_fn_by_codegen(
name: &'static str,
ret_ty: Type,
param_ty: &[(Type, &'static str)],
codegen_callback: GenCallCallback,
codegen_callback: Box<GenCallCallback>,
) -> Arc<RwLock<TopLevelDef>> {
Arc::new(RwLock::new(TopLevelDef::Function {
name: name.into(),

View File

@ -32,7 +32,7 @@ use type_annotation::*;
#[cfg(test)]
mod test;
type GenCallCallback = Box<
type GenCallCallback =
dyn for<'ctx, 'a> Fn(
&mut CodeGenContext<'ctx, 'a>,
Option<(Type, ValueEnum<'ctx>)>,
@ -41,16 +41,15 @@ type GenCallCallback = Box<
&mut dyn CodeGenerator,
) -> Result<Option<BasicValueEnum<'ctx>>, String>
+ Send
+ Sync,
>;
+ Sync;
pub struct GenCall {
fp: GenCallCallback,
fp: Box<GenCallCallback>,
}
impl GenCall {
#[must_use]
pub fn new(fp: GenCallCallback) -> GenCall {
pub fn new(fp: Box<GenCallCallback>) -> GenCall {
GenCall { fp }
}