Small fix

This commit is contained in:
Daniil Gentili 2023-06-29 12:45:29 +02:00
parent 8514614521
commit e658ce890f
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
2 changed files with 14 additions and 14 deletions

View File

@ -376,20 +376,20 @@ fn build_args(
is_str = t.path.is_ident("str");
}
}
hack_tokens.append_all(if is_str {
if is_option {
quote! { let #param = #param.and_then(|__temp| Some(unsafe { ::core::mem::transmute::<&str, &'static str>(__temp) })); }
} else {
quote! { let #param = unsafe { ::core::mem::transmute::<&str, &'static str>(#param) }; }
}
} else {
if is_option {
quote! { let #param = #param.and_then(|__temp| Some(unsafe { ::ext_php_rs::zend::borrow_unchecked(__temp) })); }
} else {
quote! { let #param = unsafe { ::ext_php_rs::zend::borrow_unchecked(#param) }; }
}
});
}
hack_tokens.append_all(if is_str {
if is_option {
quote! { let #param = #param.and_then(|__temp| Some(unsafe { ::core::mem::transmute::<&str, &'static str>(__temp) })); }
} else {
quote! { let #param = unsafe { ::core::mem::transmute::<&str, &'static str>(#param) }; }
}
} else {
if is_option {
quote! { let #param = #param.and_then(|__temp| Some(unsafe { ::ext_php_rs::zend::borrow_unchecked(__temp) })); }
} else {
quote! { let #param = unsafe { ::ext_php_rs::zend::borrow_unchecked(#param) }; }
}
});
let default = defaults.get(&name);
let mut ty = ty.ty.clone();

View File

@ -15,7 +15,7 @@ use lazy_static::lazy_static;
use tokio::runtime::Runtime;
use std::os::fd::AsRawFd;
use super::{borrow_unchecked, printf};
use super::{borrow_unchecked};
lazy_static! {
pub static ref RUNTIME: Runtime = Runtime::new().expect("Could not allocate runtime");