Skip to content

Remove multiple arg lifetimes check #780

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 26, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 0 additions & 31 deletions syntax/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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"
Expand Down