mirror of
https://gitee.com/openharmony/third_party_rust_cxx
synced 2024-11-23 07:10:29 +00:00
Preserve clippy attrs on extern "Rust" fn
#[cxx::bridge] mod ffi { extern "Rust" { #[allow(clippy::too_many_arguments)] fn repro(a: i32, b: i32, c: i32, d: i32, e: i32, f: i32, g: i32, h: i32) -> bool; } } Before: warning: this function has too many arguments (8/7) --> src/main.rs:5:12 | 5 | fn repro(a: i32, b: i32, c: i32, d: i32, e: i32, f: i32, g: i32, h: i32) -> bool; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(clippy::too_many_arguments)]` on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments After: no lint.
This commit is contained in:
parent
d8892fecd3
commit
66ba9a0a66
@ -787,6 +787,7 @@ fn expand_function_pointer_trampoline(
|
||||
prevent_unwind_label,
|
||||
None,
|
||||
Some(&efn.generics),
|
||||
&efn.attrs,
|
||||
body_span,
|
||||
);
|
||||
let var = &var.rust;
|
||||
@ -937,6 +938,7 @@ fn expand_rust_function_shim(efn: &ExternFn, types: &Types) -> TokenStream {
|
||||
prevent_unwind_label,
|
||||
invoke,
|
||||
None,
|
||||
&efn.attrs,
|
||||
body_span,
|
||||
)
|
||||
}
|
||||
@ -949,6 +951,7 @@ fn expand_rust_function_shim_impl(
|
||||
prevent_unwind_label: String,
|
||||
invoke: Option<&Ident>,
|
||||
outer_generics: Option<&Generics>,
|
||||
attrs: &OtherAttrs,
|
||||
body_span: Span,
|
||||
) -> TokenStream {
|
||||
let generics = outer_generics.unwrap_or(&sig.generics);
|
||||
@ -1123,6 +1126,7 @@ fn expand_rust_function_shim_impl(
|
||||
};
|
||||
|
||||
quote_spanned! {span=>
|
||||
#attrs
|
||||
#[doc(hidden)]
|
||||
#[export_name = #link_name]
|
||||
unsafe extern "C" fn #local_name #generics(#(#all_args,)* #outparam #pointer) #ret {
|
||||
|
Loading…
Reference in New Issue
Block a user