1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-12-23 15:01:49 +02:00
Commit Graph

1445 Commits

Author SHA1 Message Date
Martin Geisler
27a5836a94 docs: improve language in Android section (#2890)
I asked Gemini to review the English for inconsistencies and grammar
mistakes. This is the result and I hope it's useful!

As a non-native speaker, it is hard for me to evaluate the finer
details, so let me know if you would like to see changes (or even
better: make them directly in the PR with the suggestion function).

---------

Co-authored-by: Dmitri Gribenko <gribozavr@gmail.com>
2025-09-06 17:05:14 +00:00
Martin Geisler
56a3b7c6d9 docs: improve language in root files (#2894)
I asked Gemini to review the English for inconsistencies and grammar
mistakes. This is the result and I hope it's useful!

As a non-native speaker, it is hard for me to evaluate the finer
details, so let me know if you would like to see changes (or even
better: make them directly in the PR with the suggestion function).
2025-09-06 19:02:15 +02:00
Martin Geisler
9b4f56167e docs: improve language in cargo section (#2892)
I asked Gemini to review the English for inconsistencies and grammar
mistakes. This is the result and I hope it's useful!

As a non-native speaker, it is hard for me to evaluate the finer
details, so let me know if you would like to see changes (or even
better: make them directly in the PR with the suggestion function).
2025-09-06 18:59:44 +02:00
Martin Geisler
3fb6b7e164 docs: improve language in types-and-values section (#2874)
I asked Gemini to review the English for inconsistencies and grammar
mistakes. This is the result and I hope it's useful!

As a non-native speaker, it is hard for me to evaluate the finer
details, so let me know if you would like to see changes (or even
better: make them directly in the PR with the suggestion function).

---------

Co-authored-by: Dmitri Gribenko <gribozavr@gmail.com>
2025-09-06 16:57:33 +00:00
Martin Geisler
969668a552 docs: improve language in std-types section (#2876)
I asked Gemini to review the English for inconsistencies and grammar
mistakes. This is the result and I hope it's useful!

As a non-native speaker, it is hard for me to evaluate the finer
details, so let me know if you would like to see changes (or even
better: make them directly in the PR with the suggestion function).

---------

Co-authored-by: Dmitri Gribenko <gribozavr@gmail.com>
2025-09-06 16:55:15 +00:00
Martin Geisler
afcc3a47c0 docs: improve language in error-handling section (#2886)
I asked Gemini to review the English for inconsistencies and grammar
mistakes. This is the result and I hope it's useful!

As a non-native speaker, it is hard for me to evaluate the finer
details, so let me know if you would like to see changes (or even
better: make them directly in the PR with the suggestion function).
2025-09-06 16:51:21 +00:00
Martin Geisler
041fa6b9c2 docs: improve language in control-flow-basics section (#2887)
I asked Gemini to review the English for inconsistencies and grammar
mistakes. This is the result and I hope it's useful!

As a non-native speaker, it is hard for me to evaluate the finer
details, so let me know if you would like to see changes (or even
better: make them directly in the PR with the suggestion function).

---------

Co-authored-by: Dmitri Gribenko <gribozavr@gmail.com>
2025-09-06 16:49:57 +00:00
Martin Geisler
513c450e7c docs: improve language in closures section (#2888)
I asked Gemini to review the English for inconsistencies and grammar
mistakes. This is the result and I hope it's useful!

As a non-native speaker, it is hard for me to evaluate the finer
details, so let me know if you would like to see changes (or even
better: make them directly in the PR with the suggestion function).
2025-09-06 18:41:25 +02:00
Martin Geisler
93de441a6d docs: improve language in generics section (#2884)
I asked Gemini to review the English for inconsistencies and grammar
mistakes. This is the result and I hope it's useful!

As a non-native speaker, it is hard for me to evaluate the finer
details, so let me know if you would like to see changes (or even
better: make them directly in the PR with the suggestion function).
2025-09-06 16:18:45 +00:00
Martin Geisler
6043672c2f docs: improve language in user-defined-types section (#2873)
I asked Gemini to review the English for inconsistencies and grammar
mistakes. This is the result.

As a non-native speaker, it is hard for me to evaluate the finer details
of this, so let me know if you would like to see changes (or even
better:
make them directly in the PR with the suggestion function).
2025-09-06 17:41:30 +02:00
Martin Geisler
f72d5ce585 docs: improve language in methods-and-traits section (#2881)
I asked Gemini to review the English for inconsistencies and grammar
mistakes. This is the result and I hope it's useful!

As a non-native speaker, it is hard for me to evaluate the finer
details, so let me know if you would like to see changes (or even
better: make them directly in the PR with the suggestion function).

---------

Co-authored-by: Dmitri Gribenko <gribozavr@gmail.com>
2025-09-06 17:20:10 +02:00
Martin Geisler
118bf78365 docs: improve language in running-the-course section (#2877)
I asked Gemini to review the English for inconsistencies and grammar
mistakes. This is the result and I hope it's useful!

As a non-native speaker, it is hard for me to evaluate the finer
details, so let me know if you would like to see changes (or even
better: make them directly in the PR with the suggestion function).
2025-09-06 17:19:35 +02:00
Martin Geisler
3f479b920b docs: improve language in modules section (#2880)
I asked Gemini to review the English for inconsistencies and grammar
mistakes. This is the result and I hope it's useful!

As a non-native speaker, it is hard for me to evaluate the finer
details, so let me know if you would like to see changes (or even
better: make them directly in the PR with the suggestion function).
2025-09-06 17:08:26 +02:00
Martin Geisler
b7aea9ce22 docs: improve language in memory-management section (#2882)
I asked Gemini to review the English for inconsistencies and grammar
mistakes. This is the result and I hope it's useful!

As a non-native speaker, it is hard for me to evaluate the finer
details, so let me know if you would like to see changes (or even
better: make them directly in the PR with the suggestion function).
2025-09-06 17:05:45 +02:00
Martin Geisler
79324df571 docs: improve language in hello-world section (#2883)
I asked Gemini to review the English for inconsistencies and grammar
mistakes. This is the result and I hope it's useful!

As a non-native speaker, it is hard for me to evaluate the finer
details, so let me know if you would like to see changes (or even
better: make them directly in the PR with the suggestion function).
2025-09-06 17:04:50 +02:00
dependabot[bot]
7339c04b9c cargo: bump the patch group with 8 updates (#2862)
Bumps the patch group with 8 updates:

| Package | From | To |
| --- | --- | --- |
| [anyhow](https://github.com/dtolnay/anyhow) | `1.0.98` | `1.0.99` |
| [clap](https://github.com/clap-rs/clap) | `4.5.42` | `4.5.46` |
| [regex](https://github.com/rust-lang/regex) | `1.11.1` | `1.11.2` |
| [serde_json](https://github.com/serde-rs/json) | `1.0.142` | `1.0.143`
|
| [tokio](https://github.com/tokio-rs/tokio) | `1.47.0` | `1.47.1` |
| [tokio-websockets](https://github.com/Gelbpunkt/tokio-websockets) |
`0.12.0` | `0.12.1` |
| [reqwest](https://github.com/seanmonstar/reqwest) | `0.12.22` |
`0.12.23` |
| [thiserror](https://github.com/dtolnay/thiserror) | `2.0.12` |
`2.0.16` |

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-09-01 13:05:20 +01:00
dependabot[bot]
6252183538 cargo: bump the minor group with 2 updates (#2861)
Bumps the minor group with 2 updates:
[scraper](https://github.com/causal-agent/scraper) and
[tempfile](https://github.com/Stebalien/tempfile).

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-09-01 10:24:31 +01:00
dependabot[bot]
59d698c579 cargo: bump the patch group in /src/bare-metal/aps/examples with 2 updates (#2860)
Bumps the patch group in /src/bare-metal/aps/examples with 2 updates:
arm-pl011-uart and [bitflags](https://github.com/bitflags/bitflags).

Updates `arm-pl011-uart` from 0.3.1 to 0.3.2

Updates `bitflags` from 2.9.1 to 2.9.3

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-09-01 10:23:50 +01:00
dependabot[bot]
5a310d840e cargo: bump the patch group in /src/exercises/bare-metal/rtc with 3 updates (#2859)
Bumps the patch group in /src/exercises/bare-metal/rtc with 3 updates:
arm-gic, arm-pl011-uart and
[bitflags](https://github.com/bitflags/bitflags).

Updates `arm-gic` from 0.6.0 to 0.6.1

Updates `arm-pl011-uart` from 0.3.1 to 0.3.2

Updates `bitflags` from 2.9.1 to 2.9.3

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-09-01 10:23:09 +01:00
Nicole L
9620f8967f Move closures section to beginning of day 2 afternoon (#2854) 2025-08-22 14:03:08 -07:00
Dustin J. Mitchell
144fe6b971 Add speaker note regarding passing slices instead (#2851)
This section covers both references and slices, but the exercise focuses
on references. This speaker note briefly discusses the option to use
slices instead, and a cost of doing so.
2025-08-20 11:13:37 +02:00
dependabot[bot]
7fbaa23a2e cargo: bump the minor group in /src/exercises/bare-metal/rtc with 2 updates (#2835)
Bumps the minor group in /src/exercises/bare-metal/rtc with 2 updates:
[aarch64-paging](https://github.com/google/aarch64-paging) and
[arm-gic](https://github.com/google/arm-gic).

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Andrew Walbran <qwandor@google.com>
2025-08-06 17:24:36 +00:00
dependabot[bot]
bb1f5646f9 cargo: bump aarch64-paging from 0.9.1 to 0.10.0 in /src/bare-metal/aps/examples in the minor group (#2834)
Bumps the minor group in /src/bare-metal/aps/examples with 1 update:
[aarch64-paging](https://github.com/google/aarch64-paging).

Updates `aarch64-paging` from 0.9.1 to 0.10.0
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/google/aarch64-paging/releases">aarch64-paging's
releases</a>.</em></p>
<blockquote>
<h2>0.10.0</h2>
<h2>New features</h2>
<ul>
<li>Added <code>Attributes::GP</code> bit for BTI guarded pages.</li>
</ul>
<h2>Breaking changes</h2>
<ul>
<li><code>zerocopy</code> feature has been removed.
<code>PageTable::write_to</code> is provided instead.</li>
<li><code>IdMap::activate</code> now returns the previous TTBR value
rather than storing it, and
<code>IdMap::deactivate</code> takes the TTBR value to restore as a
parameter. <code>IdMap::mark_active</code> no longer
takes a previous TTBR value parameter. The same applies to the
equivalent methods on <code>LinearMap</code>.</li>
<li>Renamed <code>Mapping::activate_raw</code> to <code>activate</code>,
and added previous TTBR value parameter to
<code>Mapping::deactivate</code>.</li>
<li>A page table may be activated multiple times (e.g. on multiple
cores) and will keep track of how
many times it has been activated. It will only be considered inactive
once it has been deactivated
the same number of times.</li>
<li><code>MapError::PteUpdateFault</code> now contains a
<code>usize</code> rather than a <code>Descriptor</code>.</li>
<li><code>Descriptor</code> no longer implements <code>Copy</code>,
<code>Clone</code>, <code>Default</code>, <code>PartialEq</code> or
<code>Eq</code>, as it now
contains an <code>AtomicUsize</code> rather than just a
<code>usize</code>. Various methods on <code>Descriptor</code> now take
<code>&amp;self</code> rather than <code>self</code>.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/google/aarch64-paging/blob/main/CHANGELOG.md">aarch64-paging's
changelog</a>.</em></p>
<blockquote>
<h2>0.10.0</h2>
<h3>New features</h3>
<ul>
<li>Added <code>Attributes::GP</code> bit for BTI guarded pages.</li>
</ul>
<h3>Breaking changes</h3>
<ul>
<li><code>zerocopy</code> feature has been removed.
<code>PageTable::write_to</code> is provided instead.</li>
<li><code>IdMap::activate</code> now returns the previous TTBR value
rather than storing it, and
<code>IdMap::deactivate</code> takes the TTBR value to restore as a
parameter. <code>IdMap::mark_active</code> no longer
takes a previous TTBR value parameter. The same applies to the
equivalent methods on <code>LinearMap</code>.</li>
<li>Renamed <code>Mapping::activate_raw</code> to <code>activate</code>,
and added previous TTBR value parameter to
<code>Mapping::deactivate</code>.</li>
<li>A page table may be activated multiple times (e.g. on multiple
cores) and will keep track of how
many times it has been activated. It will only be considered inactive
once it has been deactivated
the same number of times.</li>
<li><code>MapError::PteUpdateFault</code> now contains a
<code>usize</code> rather than a <code>Descriptor</code>.</li>
<li><code>Descriptor</code> no longer implements <code>Copy</code>,
<code>Clone</code>, <code>Default</code>, <code>PartialEq</code> or
<code>Eq</code>, as it now
contains an <code>AtomicUsize</code> rather than just a
<code>usize</code>. Various methods on <code>Descriptor</code> now take
<code>&amp;self</code> rather than <code>self</code>.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="3aa97a9233"><code>3aa97a9</code></a>
Prepare for 0.10.0 release.</li>
<li><a
href="426f0eb2b8"><code>426f0eb</code></a>
Add changes to changelog. (<a
href="https://redirect.github.com/google/aarch64-paging/issues/81">#81</a>)</li>
<li><a
href="3046d1f8ba"><code>3046d1f</code></a>
Add changes to changelog.</li>
<li><a
href="ffaefdd6eb"><code>ffaefdd</code></a>
Add support for GP bit (<a
href="https://redirect.github.com/google/aarch64-paging/issues/80">#80</a>)</li>
<li><a
href="f7073ed3ef"><code>f7073ed</code></a>
Bump bitflags from 2.9.0 to 2.9.1 (<a
href="https://redirect.github.com/google/aarch64-paging/issues/78">#78</a>)</li>
<li><a
href="3146fc9472"><code>3146fc9</code></a>
Deal with memory ordering in page tables</li>
<li><a
href="83c51b4006"><code>83c51b4</code></a>
Drop dependency on zerocopy</li>
<li><a
href="73cf4deb34"><code>73cf4de</code></a>
Mark page tables active before loading them into the MMU</li>
<li><a
href="c58a108b2e"><code>c58a108</code></a>
Move TTBR preserve/restore out of the API</li>
<li><a
href="0d3a2d6339"><code>0d3a2d6</code></a>
Revert &quot;Factor out Mapping::activate_raw.&quot;</li>
<li>Additional commits viewable in <a
href="https://github.com/google/aarch64-paging/compare/0.9.1...0.10.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=aarch64-paging&package-manager=cargo&previous-version=0.9.1&new-version=0.10.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore <dependency name> major version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's major version (unless you unignore this specific
dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's minor version (unless you unignore this specific
dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR
and stop Dependabot creating any more for the specific dependency
(unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore
conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will
remove the ignore condition of the specified dependency and ignore
conditions


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-06 09:52:14 +02:00
dependabot[bot]
90c0879239 cargo: bump aarch64-rt from 0.2.1 to 0.2.2 in /src/exercises/bare-metal/rtc in the patch group (#2836)
Bumps the patch group in /src/exercises/bare-metal/rtc with 1 update:
[aarch64-rt](https://github.com/google/aarch64-rt).

Updates `aarch64-rt` from 0.2.1 to 0.2.2
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/google/aarch64-rt/blob/main/CHANGELOG.md">aarch64-rt's
changelog</a>.</em></p>
<blockquote>
<h2>0.2.2</h2>
<h3>Improvements</h3>
<ul>
<li>Added optional parameters to <code>initial_pagetable!</code> to
allow initial MAIR, TCR and SCTLR values to
be specified. The default values are exposed as constants.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="2ba1c5153b"><code>2ba1c51</code></a>
Prepare for 0.2.2 release.</li>
<li><a
href="02b0802d0a"><code>02b0802</code></a>
Merge pull request <a
href="https://redirect.github.com/google/aarch64-rt/issues/17">#17</a>
from google/pagetable</li>
<li><a
href="442899cec7"><code>442899c</code></a>
Specify MAIR in example.</li>
<li><a
href="141090a51c"><code>141090a</code></a>
Allow just MAIR to be specified.</li>
<li><a
href="5720896eee"><code>5720896</code></a>
Allow initial MAIR, TCR and SCTLR values to be specified.</li>
<li><a
href="76b1699a3d"><code>76b1699</code></a>
Bump smccc from 0.2.1 to 0.2.2 (<a
href="https://redirect.github.com/google/aarch64-rt/issues/16">#16</a>)</li>
<li>See full diff in <a
href="https://github.com/google/aarch64-rt/compare/0.2.1...0.2.2">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=aarch64-rt&package-manager=cargo&previous-version=0.2.1&new-version=0.2.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore <dependency name> major version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's major version (unless you unignore this specific
dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's minor version (unless you unignore this specific
dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR
and stop Dependabot creating any more for the specific dependency
(unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore
conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will
remove the ignore condition of the specified dependency and ignore
conditions


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-06 09:51:28 +02:00
Dustin J. Mitchell
d7f8eb045f Remove reference to discontuned async-std package (#2841)
Fixes #2839.
2025-08-06 09:50:46 +02:00
Dustin J. Mitchell
6e2c393364 Fix typo (#2842)
Fixes #2840
2025-08-06 09:50:19 +02:00
dependabot[bot]
196dafc7e8 cargo: bump the minor group with 2 updates (#2838)
Bumps the minor group with 2 updates:
[tokio](https://github.com/tokio-rs/tokio) and
[tokio-websockets](https://github.com/Gelbpunkt/tokio-websockets).
2025-08-02 12:17:56 -04:00
dependabot[bot]
426f3f783a cargo: bump the patch group with 3 updates (#2837)
Bumps the patch group with 3 updates:
[clap](https://github.com/clap-rs/clap),
[serde_json](https://github.com/serde-rs/json) and
[reqwest](https://github.com/seanmonstar/reqwest).
2025-08-02 12:17:06 -04:00
Vinh Tran
16d25dbed7 Clarify Matching Values section (#2833) 2025-07-29 22:09:51 -04:00
Jason Lin
a0edd51120 Add a note about using rust-bindgen (#2818)
Co-authored-by: Dmitri Gribenko <gribozavr@gmail.com>
2025-07-28 02:29:32 +00:00
Vinh Tran
e157487e6e Fix typo in Matching Values section (#2832)
Given 

```
#[rustfmt::skip]
fn main() {
    let input = '1';
    match input {
        key if key.is_lowercase() => println!("Lowercase: {key}"),
        'q'                       => println!("Quitting"),
        'a' | 's' | 'w' | 'd'     => println!("Moving around"),
        '0'..='9'                 => println!("Number input"),
        _                         => println!("Something else"),
    }
}
```

the output will be

```
Number input
```

So in practice, failing the condition does result to the other arms if
the other arms are after that (if I'm reading this correctly).
2025-07-27 18:52:11 +02:00
Nicole L
a76b50a0df Remove unnecessary dependencies on libbinder_rs (#2782)
These dependencies turned out not to be necessary, since depending on
the generated `com.example.birthdayservice-rust` also exports the common
binder functionality.
2025-07-25 11:11:56 +02:00
Nicole L
047b2b2255 Add note to binary-tree exercise about duplicate values (#2790)
Just a small note to clarify a minor point of confusion with the
exercise.
2025-07-25 11:11:17 +02:00
Nicole L
f37402066d Remove unnecessary type cast in C ffi example (#2783)
A `&T` can automatically coerce to a `*const T`, so the manual cast
isn't necessary here.
2025-07-25 11:10:31 +02:00
Nicole L
1a3c11b03e Add speaker note that arrays go on the stack (#2826) 2025-07-23 10:37:19 -07:00
Michalina Sidor
4dbbcce4b8 Fix typo in embedded-hal.md (#2828) 2025-07-22 16:39:59 +00:00
Tim McNamara
8994e390af Fix missing link (fixes #2822) (#2823)
This change fixes a broken link when markdown source is rendered as HTML
by mdbook.
2025-07-18 11:48:46 +02:00
Tim McNamara
22d6af4abd Add Unsafe Rust Deep Dive (#2806)
Adds the start of an unsafe deep dive to Comprehensive Rust. 

The `unsafe` keyword is easy to type, but hard to master. When used
appropriately, it forms a useful and indeed essential part of the Rust
programming language.

By the end of this deep dive, you'll know how to work with `unsafe` code, 
review others' changes that include the `unsafe` keyword, and produce 
your own.

What you'll learn:

- What the terms undefined behavior, soundness, and safety mean
- Why the `unsafe` keyword exists in the Rust language
- How to write your own code using `unsafe` safely
- How to review `unsafe` code

Here is a tentative outline of a 10h (2 day) treatment:

Day 1: Using and Reviewing Unsafe

- Welcome
- Motivations: explain why the `unsafe` keyword exists
- Foundations: provide background knowledge; what is soundness? what is
undefined behavior? what is validity in respect to pointers?
- Mechanics: what a safe `unsafe` block should look like
- Representations and Interoperability: explore how data is laid out in
memory and how that can be sent across the wire and/or stored on disk.
- Reviewing unsafe
- Patterns for safer unsafe: Encapsulating unsafe code in safe-to-use
abstractions, such as marking a type's constructor as `unsafe` so that
invariants only need to be enforced once by the programmer.

Day 2: Deploying Unsafe to Build Abstractions

- Welcome
- Validity in detail: A refresher. Emphasis on the details of the
invariants that are being upheld by a “typical” unsafe block, such as
aliasing, alignment, data validity, padding.
- Concurrency and thread safety: understanding `Send` and `Sync`,
knowing how to implement them on a user-defined type
- Case study: Small string optimization
- Case study: Zero-copy parsing
- Review

---------

Co-authored-by: Dmitri Gribenko <gribozavr@gmail.com>
2025-07-17 14:03:31 +12:00
Enes Aydın
0a485b5a4c Update destructuring-structs.md (#2807)
In the #2749 , the match arm order has changed. Therefore, the word
"second" should be changed to "first" in the notes.
2025-07-16 18:31:04 +02:00
Enes Aydın
a55ce1d24f Fix typo: "appenix" → "appendix" (#2815)
If I'm not mistaken...
2025-07-13 12:54:05 +00:00
Jason Lin
0f41f32be1 Correct a minor mistake in the code in lifetime-elision.md (#2814) 2025-07-10 13:12:46 +00:00
Sam McCall
7eecb9bb77 Link to rust-api-guidelines (#2813)
This has a lot of detailed and high-quality API advice.

I think it's particularly useful to developers experienced in other
languages, who may default to carrying over design idioms where Rust has
better options.
2025-07-09 21:09:08 +02:00
Luca Palmieri
4483602cd2 Introduce 'Idiomatic Rust' learning module (#2800)
This PR introduces:

- A new section for the "Idiomatic Rust" learning module
- (The beginning of) the section on newtype patterns

---------

Co-authored-by: Dmitri Gribenko <gribozavr@gmail.com>
2025-07-09 21:03:41 +02:00
Martin Geisler
c2ffbd7f5b Update cargo.md (#2780)
Now that there is a `rustup` package, we can take away the scary
language and ask people to install that. This has the advantage that
people get a trusted tool to download the latest Rust compiler.
2025-07-09 18:03:06 +02:00
Enes Aydın
d4729bfec0 Update exercise.md (#2808)
The point at which the generics segment will be covered has changed
multiple times. After the last change, the 'logger trait' section was
not updated to reflect when it will now be covered. To keep it more
general, I suggest not specifying when it will be covered.
2025-07-07 16:58:09 -04:00
Enes Aydın
e35f6d684d Update vec.md (#2810)
With #1898 the slices were moved to day 1. So I deleted the day 3 slice
reference sentence in day 2 vec.md.
2025-07-06 23:01:54 +00:00
Frances Wingerter
8419b3095e A few fixes for the unsafe chapter (#2805)
See individual commits in https://github.com/google/comprehensive-rust/pull/2805. Fixes #2734.
2025-07-05 17:46:42 +00:00
dependabot[bot]
010b443615 cargo: bump the patch group in /src/bare-metal/aps/examples with 3 updates (#2799)
Bumps the patch group in /src/bare-metal/aps/examples with 3 updates:
[aarch64-rt](https://github.com/google/aarch64-rt),
[smccc](https://github.com/google/smccc) and
[zerocopy](https://github.com/google/zerocopy).

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-07-01 11:15:41 +01:00
dependabot[bot]
fb95fb377d cargo: bump the patch group in /src/exercises/bare-metal/rtc with 3 updates (#2796)
Bumps the patch group in /src/exercises/bare-metal/rtc with 3 updates:
[aarch64-rt](https://github.com/google/aarch64-rt),
[smccc](https://github.com/google/smccc) and
[zerocopy](https://github.com/google/zerocopy).

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-07-01 11:02:18 +01:00
dependabot[bot]
6194ac4abb cargo: bump the patch group with 4 updates (#2795)
Bumps the patch group with 4 updates:
[clap](https://github.com/clap-rs/clap),
[googletest](https://github.com/google/googletest-rust),
[zerocopy](https://github.com/google/zerocopy) and
[reqwest](https://github.com/seanmonstar/reqwest).

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-07-01 11:01:37 +01:00