Skip to content

Commit

Permalink
codegen/function: body future handles ownership of slice argument
Browse files Browse the repository at this point in the history
  • Loading branch information
BiagioFesta committed Jun 12, 2024
1 parent c9e32ef commit ee4b75d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/codegen/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -438,9 +438,12 @@ pub fn body_chunk_futures(
let c_par = &analysis.parameters.c_parameters[par.ind_c];

let type_ = env.type_(par.typ);
let is_str = matches!(*type_, library::Type::Basic(library::Basic::Utf8));
let is_str = matches!(type_, library::Type::Basic(library::Basic::Utf8));
let is_slice = matches!(type_, library::Type::CArray(_));

if *c_par.nullable {
if is_slice {
writeln!(body, "let {} = {}.to_vec();", par.name, par.name)?;
} else if *c_par.nullable {
writeln!(
body,
"let {} = {}.map(ToOwned::to_owned);",
Expand Down

0 comments on commit ee4b75d

Please sign in to comment.