Skip to content

Commit

Permalink
Merge pull request #1580 from BiagioFesta/wip/bfesta/fix-future-body-…
Browse files Browse the repository at this point in the history
…slice

codegen/function: body future handles ownership of slice argument
  • Loading branch information
sdroege authored Aug 5, 2024
2 parents 3e1e16c + ee4b75d commit 59451cd
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 59451cd

Please sign in to comment.