Revamp foreign code not to consider the Rust modes. This requires - #5298
Closed
nikomatsakis wants to merge 1 commit into
Closed
Revamp foreign code not to consider the Rust modes. This requires#5298nikomatsakis wants to merge 1 commit into
nikomatsakis wants to merge 1 commit into
Conversation
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.
Contributor
Author
|
Note: I did some 'tidying up' while I was editing this code. I expected to need deeper changes than I did, in retrospect I could have this patch more targeted, but oh well. |
Merged
Contributor
Author
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
…ip1995,Manishearth needless_doc_main: only check rust code This fixes rust-lang#5280 by checking the language attribute on code blocks. --- changelog: none
U007D
pushed a commit
to U007D/rust-mos
that referenced
this pull request
Aug 21, 2026
5298: Better caret placement when filling match arms 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
Add `llvm.x86.aesni.aeskeygenassist` support
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.
Revamp foreign code not to consider the Rust modes. This requires
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 Fooas aFoo*. So I added some code into the adapters tofix 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.
r? @brson