-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Remove by val mode #5307
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
Remove by val mode #5307
Conversation
As I said before, I also did some minor cleanup and reorganization while revamping the foreign code. I ought to have separately that into its own commit and also separate out the conversion of |
Yay! |
Great work and great documentation, as always. |
Doing some work here on #2064 (returning structs from C functions on x86) and it seems like on your branch it works as expected. Did you fix that purposefully (I didn't see a test)? If so, thanks. |
Oh I see |
adjusting a few foreign functions that were declared with by-ref mode. This also allows us to remove by-val mode in the near future. With copy mode, though, we have to be careful because Rust will implicitly pass somethings by pointer but this may not be the C ABI rules. For example, rust will pass a struct Foo as a Foo*. So I added some code into the adapters to fix this (though the C ABI rules may put the pointer back, oh well). This patch also includes a lint mode for the use of by-ref mode in foreign functions as the semantics of this have changed.
and obsolete `-` mode altogether (it *was* parsed as `+` mode).
This is done in two steps: First, we make foreign functions not consider modes at all. This is because previously ++ mode was the only way to pass structs to foreign functions and so forth. We also add a lint mode warning if you use `&&` mode in a foreign function, since the semantics of that change (it used to pass a pointer to the C function, now it doesn't). Then, we remove by value and make it equivalent to `+` mode. At the same time, we stop parsing `-` mode and convert all uses of it to `+` mode (it was already being parsed to `+` mode anyhow). This obsoletes pull request #5298. r? @brson
Rustup to rust-lang#69674 changelog: none
This is done in two steps:
First, we make foreign functions not consider modes at all. This is because previously ++ mode was the only way to pass structs to foreign functions and so forth. We also add a lint mode warning if you use
&&
mode in a foreign function, since the semantics of that change (it used to pass a pointer to the C function, now it doesn't).Then, we remove by value and make it equivalent to
+
mode. At the same time, we stop parsing-
mode and convert all uses of it to+
mode (it was already being parsed to+
mode anyhow).This obsoletes pull request #5298.
r? @brson