Skip to content

Commit

Permalink
Ch. 20: tell folks to see the Reference for more ABI info
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskrycho committed Dec 16, 2024
1 parent ad2011d commit 415d5c7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions ci/dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ personal_ws-1.1 en 0 utf-8
abcabcabc
abcd
abcdefghijklmnopqrstuvwxyz
ABIs
AddAssign
Addr
adfb
Expand Down
8 changes: 5 additions & 3 deletions src/ch20-01-unsafe-rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,8 @@ Within the `unsafe extern "C"` block, we list the names and signatures of
external functions from another language we want to call. The `"C"` part defines
which _application binary interface (ABI)_ the external function uses: the ABI
defines how to call the function at the assembly level. The `"C"` ABI is the
most common and follows the C programming language’s ABI.
most common and follows the C programming language’s ABI. Information about all
the ABIs Rust supports is available in [the Rust Reference][ABI].

This particular function does not have any memory safety considerations, though.
In fact, we know that any call to `abs` will always be safe for any `i32`, so we
Expand Down Expand Up @@ -481,7 +482,7 @@ _union_. A `union` is similar to a `struct`, but only one declared field is
used in a particular instance at one time. Unions are primarily used to
interface with unions in C code. Accessing union fields is unsafe because Rust
cant guarantee the type of the data currently being stored in the union
instance. You can learn more about unions in [the Rust Reference][reference].
instance. You can learn more about unions in [the Rust Reference][unions].
### Using Miri to check unsafe code
Expand Down Expand Up @@ -535,9 +536,10 @@ Whenever you write unsafe code, you can use Miri to help you be more confident
that the code you have written upholds Rust’s rules.
[dangling-references]: ch04-02-references-and-borrowing.html#dangling-references
[ABI]: ../reference/items/external-blocks.html#abi
[differences-between-variables-and-constants]: ch03-01-variables-and-mutability.html#constants
[extensible-concurrency-with-the-sync-and-send-traits]: ch16-04-extensible-concurrency-sync-and-send.html#extensible-concurrency-with-the-sync-and-send-traits
[the-slice-type]: ch04-03-slices.html#the-slice-type
[reference]: ../reference/items/unions.html
[unions]: ../reference/items/unions.html
[miri]: https://github.com/rust-lang/miri
[nightly]: appendix-07-nightly-rust.html

0 comments on commit 415d5c7

Please sign in to comment.