Skip to content
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

Outdated error on signature returning reference without reference arguments #764

Closed
dtolnay opened this issue Mar 25, 2021 · 0 comments · Fixed by #780
Closed

Outdated error on signature returning reference without reference arguments #764

dtolnay opened this issue Mar 25, 2021 · 0 comments · Fixed by #780

Comments

@dtolnay
Copy link
Owner

dtolnay commented Mar 25, 2021

The message "functions that return a reference must take exactly one input reference" was accurate only until #608. Now that a signature can be annotated with explicit lifetimes, either a 'static output lifetime would also be fine, or multiple input lifetimes would also be fine.

Current behavior:

#[cxx::bridge]
mod ffi {
    extern "C++" {
        unsafe fn f() -> &i32;
    }
}
error[cxxbridge]: functions that return a reference must take exactly one input reference
  ┌─ src/main.rs:4:16

4 │         unsafe fn f() -> &i32;
  │                ^^^^^^^^^^^^^^^ functions that return a reference must take exactly one input reference
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant