mirror of
https://gitee.com/openharmony/third_party_rust_cxx
synced 2024-11-27 17:30:38 +00:00
Remove multiple arg lifetimes check
This was made obsolete by support for explicit lifetime annotations in cxx 1.0.26.
This commit is contained in:
parent
5b97fc4e06
commit
47b820940c
@ -469,8 +469,6 @@ fn check_api_fn(cx: &mut Check, efn: &ExternFn) {
|
||||
if efn.lang == Lang::Cxx {
|
||||
check_mut_return_restriction(cx, efn);
|
||||
}
|
||||
|
||||
check_multiple_arg_lifetimes(cx, efn);
|
||||
}
|
||||
|
||||
fn check_api_type_alias(cx: &mut Check, alias: &TypeAlias) {
|
||||
@ -564,35 +562,6 @@ fn check_mut_return_restriction(cx: &mut Check, efn: &ExternFn) {
|
||||
);
|
||||
}
|
||||
|
||||
fn check_multiple_arg_lifetimes(cx: &mut Check, efn: &ExternFn) {
|
||||
if efn.lang == Lang::Cxx && efn.trusted {
|
||||
return;
|
||||
}
|
||||
|
||||
match &efn.ret {
|
||||
Some(Type::Ref(_)) => {}
|
||||
_ => return,
|
||||
}
|
||||
|
||||
let mut reference_args = 0;
|
||||
for arg in &efn.args {
|
||||
if let Type::Ref(_) = &arg.ty {
|
||||
reference_args += 1;
|
||||
}
|
||||
}
|
||||
|
||||
if efn.receiver.is_some() {
|
||||
reference_args += 1;
|
||||
}
|
||||
|
||||
if reference_args != 1 {
|
||||
cx.error(
|
||||
efn,
|
||||
"functions that return a reference must take exactly one input reference",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
fn check_reserved_name(cx: &mut Check, ident: &Ident) {
|
||||
if ident == "Box"
|
||||
|| ident == "UniquePtr"
|
||||
|
Loading…
Reference in New Issue
Block a user