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

Update Interoperability section #351

Merged
merged 2 commits into from
May 8, 2023

Conversation

abt8601
Copy link
Contributor

@abt8601 abt8601 commented May 6, 2023

Following the discussion on #348, this PR proposes the following changes to the Interoperability section:

  • Update descriptions regarding the availability of core::ffi.
  • Remove mentions of std::os::raw.

I intentionally kept mentions of the cty crate and the cstr_core crate since the next section uses the former. We may also consider updating the following section to use core::ffi instead of the cty crate.

This PR also introduces two additional changes.

First, it changes the descriptions regarding the implicit conversion between C and Rust types. The book says that the compiler implicitly converts between the two types, but it doesn't sound right to say that the example (reproduced below) works because of the conversion. It works simply because, on platforms where unsigned int is 32-bit long, c_uint and u32 are the same type because the former is a type alias of the latter. This PR also removes the unsafe from the example since I believe it plays no role.

unsafe fn foo(num: u32) {
    let c_num: c_uint = num;
    let r_num: u32 = c_num;
}

Second, it changes the text formatting in the type correspondence table. The types in the table now use code formatting. Also, the presentation of C pointer types is updated (e.g. *charchar *).

Closes #348.

- Update descriptions regarding the availability of `core::ffi`.

- Remove mentions of `std::os::raw`.

- Change descriptions regarding the implicit conversion between C and
  Rust types.

- Change the text formatting in the type correspondence table.
@abt8601 abt8601 requested a review from a team as a code owner May 6, 2023 06:23
32 bit → 32-bit
Copy link
Member

@eldruin eldruin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thank you!
bors r+

@bors
Copy link
Contributor

bors bot commented May 8, 2023

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

  • build

@bors bors bot merged commit d9eb4c3 into rust-embedded:master May 8, 2023
@abt8601 abt8601 deleted the update-interoperability-index branch May 8, 2023 10:11
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request May 9, 2023
Update books

## rust-lang/edition-guide

1 commits in 6038be9d37d7251c966b486154af621d1794d7af..f63e578b92ff43e8cc38fcaa257b660f45c8a8c2
2023-04-26 18:40:19 UTC to 2023-04-26 18:40:19 UTC

- Fix grammar (rust-lang/edition-guide#281)

## rust-embedded/book

2 commits in 897fcf566f16bf87bf37199bdddec1801fd00532..d9eb4c3f75435b008881062ffa77bf0d1527b37d
2023-05-08 10:06:29 UTC to 2023-05-08 07:19:03 UTC

- Update Interoperability section (rust-embedded/book#351)
- Update c-with-rust.md (rust-embedded/book#352)

## rust-lang/reference

3 commits in 1f8dc727e94ae4ef92adf70df979521a1ea1143e..28dc0f3576b55f5e57c5d6e65cd68ba3161e9fd5
2023-05-06 20:25:36 UTC to 2023-05-05 01:51:00 UTC

- Add an entry for macro_rules in the "Weak keywords" lexer block (rust-lang/reference#1356)
- Document f16c target feature (rust-lang/reference#1337)
- Fix example for non-x86 targets (rust-lang/reference#1334)

## rust-lang/rust-by-example

4 commits in 31961fe22521a779070a44a8f30a2b00a20b6212..8ee9528b72b927cff8fd32346db8bbd1198816f0
2023-05-01 21:18:34 UTC to 2023-04-25 11:19:41 UTC

- add: zero padding example (rust-lang/rust-by-example#1706)
- Update reenter_question_mark.md (rust-lang/rust-by-example#1705)
- Clarify array out-of-bounds behavior. (rust-lang/rust-by-example#1703)
- Update README.md (rust-lang/rust-by-example#1704)

## rust-lang/rustc-dev-guide

2 commits in 2a5eb92197e9cf8fe91164dcbf4f9b88c0d7e73d..28dbeaf5c44bc7f5111ad412e99f2d7c5cec6c90
2023-05-02 02:20:21 UTC to 2023-04-26 19:09:10 UTC

- Add unset-exec-env compiletest header. (rust-lang/rustc-dev-guide#1682)
- extend the sixth trait system requirement (rust-lang/rustc-dev-guide#1671)
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 this pull request may close these issues.

Interoperability: On the availability of std::ffi and std::os::raw in core
2 participants