Final changes based on feedback and running cargo clippy --tests
This commit is contained in:
parent
dabd99c637
commit
0aa9847a50
@ -842,9 +842,10 @@ pub fn rpc_codegen_callback_fn<'ctx>(
|
||||
} else {
|
||||
let tag_len = tag.len();
|
||||
let arr_ty = int8.array_type(tag_len as u32);
|
||||
let tag_const = int8
|
||||
.const_array(&tag.iter().map(|&b| int8.const_int(b as u64, false)).collect::<Vec<_>>());
|
||||
let arr_gv = ctx.module.add_global(arr_ty, None, &format!("{}.arr", hash));
|
||||
let tag_const = int8.const_array(
|
||||
&tag.iter().map(|&b| int8.const_int(u64::from(b), false)).collect::<Vec<_>>(),
|
||||
);
|
||||
let arr_gv = ctx.module.add_global(arr_ty, None, &format!("{hash}.arr"));
|
||||
arr_gv.set_linkage(Linkage::Private);
|
||||
arr_gv.set_initializer(&tag_const);
|
||||
|
||||
@ -878,10 +879,10 @@ pub fn rpc_codegen_callback_fn<'ctx>(
|
||||
.args
|
||||
.iter()
|
||||
.position(|arg| arg.name == kw_name)
|
||||
.ok_or_else(|| format!("Unknown keyword argument '{}'", kw_name))?;
|
||||
.ok_or_else(|| format!("Unknown keyword argument '{kw_name}'"))?;
|
||||
|
||||
if param_map[param_pos].is_some() {
|
||||
return Err(format!("Multiple values for argument '{}'", kw_name));
|
||||
return Err(format!("Multiple values for argument '{kw_name}'"));
|
||||
}
|
||||
param_map[param_pos] = Some(val_enum);
|
||||
} else {
|
||||
@ -927,7 +928,7 @@ pub fn rpc_codegen_callback_fn<'ctx>(
|
||||
ctx.builder.build_gep(
|
||||
arg_array,
|
||||
&[i32_ty.const_int(i as u64, false)],
|
||||
&format!("rpc.arg_slot_{}", i),
|
||||
&format!("rpc.arg_slot_{i}"),
|
||||
)
|
||||
}
|
||||
.unwrap();
|
||||
@ -959,7 +960,7 @@ pub fn rpc_codegen_callback_fn<'ctx>(
|
||||
.unwrap();
|
||||
call_stackrestore(ctx, stackptr);
|
||||
return Ok(None);
|
||||
} else {
|
||||
}
|
||||
let rpc_send = ctx.module.get_function("rpc_send").unwrap_or_else(|| {
|
||||
ctx.module.add_function(
|
||||
"rpc_send",
|
||||
@ -975,17 +976,12 @@ pub fn rpc_codegen_callback_fn<'ctx>(
|
||||
)
|
||||
});
|
||||
ctx.builder
|
||||
.build_call(
|
||||
rpc_send,
|
||||
&[service_id.into(), tag_ptr.into(), arg_array.into()],
|
||||
"rpc.send",
|
||||
)
|
||||
.build_call(rpc_send, &[service_id.into(), tag_ptr.into(), arg_array.into()], "rpc.send")
|
||||
.unwrap();
|
||||
call_stackrestore(ctx, stackptr);
|
||||
|
||||
let maybe_ret = format_rpc_ret(generator, ctx, fun.0.ret);
|
||||
Ok(maybe_ret)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn attributes_writeback<'ctx>(
|
||||
@ -1074,7 +1070,7 @@ pub fn attributes_writeback<'ctx>(
|
||||
if *is_method {
|
||||
continue;
|
||||
}
|
||||
if gen_rpc_tag(ctx, *field_ty, &mut scratch_buffer).is_ok() {
|
||||
if gen_rpc_tag(ctx, *field_ty, false, &mut scratch_buffer).is_ok() {
|
||||
fields.push(name.to_string());
|
||||
let (index, _) = ctx.get_attr_index(ty, *name);
|
||||
values.push((
|
||||
|
Loading…
Reference in New Issue
Block a user