Remove by val mode - #5307
Merged
Merged
Conversation
Contributor
Author
|
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 |
Contributor
|
Yay! |
Contributor
|
Great work and great documentation, as always. |
Contributor
|
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. |
Contributor
|
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).
bors
added a commit
that referenced
this pull request
Mar 13, 2013
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
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
May 2, 2020
Rustup to rust-lang#69674 changelog: none
U007D
pushed a commit
to U007D/rust-mos
that referenced
this pull request
Aug 21, 2026
5307: disable profiling r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
RalfJung
added a commit
to RalfJung/rust
that referenced
this pull request
Sep 5, 2026
Automatic Rustup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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