forked from M-Labs/nac3
1
0
Fork 0

core: Remove Box from GenCallCallback type alias

So that references to the function type can be taken.
This commit is contained in:
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, name: &'static str,
ret_ty: Type, ret_ty: Type,
param_ty: &[(Type, &'static str)], param_ty: &[(Type, &'static str)],
codegen_callback: GenCallCallback, codegen_callback: Box<GenCallCallback>,
) -> Arc<RwLock<TopLevelDef>> { ) -> Arc<RwLock<TopLevelDef>> {
Arc::new(RwLock::new(TopLevelDef::Function { Arc::new(RwLock::new(TopLevelDef::Function {
name: name.into(), name: name.into(),

View File

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