1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-11-30 00:58:23 +02:00
Commit Graph

1424 Commits

Author SHA1 Message Date
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
Andrew Walbran
5e4feff6d7 Add section about UART driver without safe-mmio back in (#2792)
Having taught the course again since the change to use safe-mmio, it
seems worth keeping this as an intermediate step rather than jumping
straight from pointer arithmetic to safe-mmio's abstractions.
2025-06-30 13:48:32 +01:00
Nicole L
447b31cd45 Remove type annotations from borrowck example (#2791)
These slides are on day 3, I don't think we need the explicit type
annotations at this point.
2025-06-26 15:17:57 -04:00
Nicole L
2e50843812 Move closures section to before libstd sections (#2789)
A lot of stuff in the standard library makes use of closures, so I think
it makes sense to cover those first so that we can more easily reference
libstd functions like `map` and `filter`.
2025-06-26 15:17:32 -04:00
Nicole L
c253b33977 Add note about trait bound in closures exercise (#2788)
I've tried removing this trait bound thinking it's unnecessary only to
then be surprised that it breaks type inference. I think that's worth
calling out to students, so I think a speaker note here would be
appropriate.
2025-06-26 15:09:38 -04:00
Nicole L
39d0588c89 Add direct call to talk in trait implementation slide (#2787)
I think it'd be helpful to also show a direct call to `talk`, so that
it's clear that both trait methods can be called directly.
2025-06-26 15:07:50 -04:00
Nicole L
da28a502bf Make pattern matching exercise code editable (#2786)
I swear I already did this one...

@djmitche it looks like you had removed this `editable` after I last
added it, was there some reason for that?
2025-06-26 15:07:18 -04:00
Nicole L
088744a4c2 Split off function call to make pattern match clearer (#2785)
I think doing the call to `Duration::try_from_secs_f32` in the pattern
match is a bit verbose since the function name is so long. I usually
split this off into a separate variable so that it's easier to see the
pattern match syntax.
2025-06-26 15:01:46 -04:00
Nicole L
40652b6415 Add note about struct-style enum variants in pattern matching (#2784)
Can't forget to demonstrate struct-style enum variants when talking
about pattern matching.
2025-06-26 15:01:04 -04:00
Vinh Tran
f51f0dbb13 Fix typo in arrays.md (#2781)
According to the error I got from trying out-of-bound index, array
accesses seem to be checked at compile time.

```
   Compiling playground v0.0.1 (/playground)
error: this operation will panic at runtime
 --> src/main.rs:3:5
  |
3 |     a[7] = 0;
  |     ^^^^ index out of bounds: the length is 5 but the index is 7
  |
  = note: `#[deny(unconditional_panic)]` on by default

error: could not compile `playground` (bin "playground") due to 1 previous error
```
2025-06-25 21:08:29 +00:00
Nicole L
bb8b35ab74 Add a speaker note about trying to use a variable as a pattern (#2779) 2025-06-18 17:05:32 -07:00
Andrew Walbran
bb1e1c9414 Updates to bare metal day after teaching it again (#2775)
This fixes some issues running some of the examples, and various other
minor issues I found along the way.
2025-06-12 11:27:22 +01:00
dependabot[bot]
74605c345c cargo: bump reqwest from 0.12.18 to 0.12.19 in the patch group (#2770)
Bumps the patch group with 1 update:
[reqwest](https://github.com/seanmonstar/reqwest).

Updates `reqwest` from 0.12.18 to 0.12.19

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-03 14:46:13 +01:00
Dustin J. Mitchell
f9e58d9596 Add a schematic state machine implementing Future (#2048)
@fw-immunant generated something like this on-the-fly in teaching the
course, and I thought it was great. I think having a _schematic_
understanding of what's going on here helps students through some of the
pitfalls. Particularly, it motivates `Pin`, which is where @fw-immunant
did this derivation.
2025-06-03 12:45:22 +00:00
Andrew Walbran
c1773a7fdb Update some speaker notes for bare metal Rust section (#2764) 2025-06-02 19:16:09 +01:00
Andrew Walbran
64ef712d7d Use safe-mmio crate in PL011 UART driver example and RTC exercise solution (#2752) 2025-06-02 15:28:06 +01:00
dependabot[bot]
029c7392a3 cargo: bump bitflags from 2.9.0 to 2.9.1 in /src/bare-metal/aps/examples in the patch group (#2760)
Bumps the patch group in /src/bare-metal/aps/examples with 1 update:
[bitflags](https://github.com/bitflags/bitflags).
2025-06-01 20:12:10 -04:00
dependabot[bot]
53fbe1e71d cargo: bump bitflags from 2.9.0 to 2.9.1 in /src/exercises/bare-metal/rtc in the patch group (#2759)
Bumps the patch group in /src/exercises/bare-metal/rtc with 1 update:
[bitflags](https://github.com/bitflags/bitflags).
2025-06-01 20:06:25 -04:00
dependabot[bot]
1a2081765e cargo: bump the patch group with 4 updates (#2758)
Bumps the patch group with 4 updates:
[clap](https://github.com/clap-rs/clap),
[mdbook](https://github.com/rust-lang/mdBook),
[googletest](https://github.com/google/googletest-rust) and
[reqwest](https://github.com/seanmonstar/reqwest).
2025-06-01 15:30:29 -04:00
dependabot[bot]
4a5a1c3a5c cargo: bump the minor group with 2 updates (#2757)
Bumps the minor group with 2 updates:
[tokio](https://github.com/tokio-rs/tokio) and
[tempfile](https://github.com/Stebalien/tempfile).

Updates `tokio` from 1.44.2 to 1.45.1
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/tokio-rs/tokio/releases">tokio's
releases</a>.</em></p>
<blockquote>
<h2>Tokio v1.45.1</h2>
<h1>1.45.1 (May 24th, 2025)</h1>
<p>This fixes a regression on the wasm32-unknown-unknown target, where
code that previously did not panic due to calls to
<code>Instant::now()</code> started failing. This is due to the
stabilization of the first time-based metric.</p>
<h3>Fixed</h3>
<ul>
<li>Disable time-based metrics on wasm32-unknown-unknown (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/7322">#7322</a>)</li>
</ul>
<p><a
href="https://redirect.github.com/tokio-rs/tokio/issues/7322">#7322</a>:
<a
href="https://redirect.github.com/tokio-rs/tokio/pull/7322">tokio-rs/tokio#7322</a></p>
<h2>Tokio v1.45.0</h2>
<h3>Added</h3>
<ul>
<li>metrics: stabilize <code>worker_total_busy_duration</code>,
<code>worker_park_count</code>, and <code>worker_unpark_count</code> (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/6899">#6899</a>,
<a
href="https://redirect.github.com/tokio-rs/tokio/issues/7276">#7276</a>)</li>
<li>process: add <code>Command::spawn_with</code> (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/7249">#7249</a>)</li>
</ul>
<h3>Changed</h3>
<ul>
<li>io: do not require <code>Unpin</code> for some trait impls (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/7204">#7204</a>)</li>
<li>rt: mark <code>runtime::Handle</code> as unwind safe (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/7230">#7230</a>)</li>
<li>time: revert internal sharding implementation (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/7226">#7226</a>)</li>
</ul>
<h3>Unstable</h3>
<ul>
<li>rt: remove alt multi-threaded runtime (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/7275">#7275</a>)</li>
</ul>
<p><a
href="https://redirect.github.com/tokio-rs/tokio/issues/6899">#6899</a>:
<a
href="https://redirect.github.com/tokio-rs/tokio/pull/6899">tokio-rs/tokio#6899</a>
<a
href="https://redirect.github.com/tokio-rs/tokio/issues/7276">#7276</a>:
<a
href="https://redirect.github.com/tokio-rs/tokio/pull/7276">tokio-rs/tokio#7276</a>
<a
href="https://redirect.github.com/tokio-rs/tokio/issues/7249">#7249</a>:
<a
href="https://redirect.github.com/tokio-rs/tokio/pull/7249">tokio-rs/tokio#7249</a>
<a
href="https://redirect.github.com/tokio-rs/tokio/issues/7204">#7204</a>:
<a
href="https://redirect.github.com/tokio-rs/tokio/pull/7204">tokio-rs/tokio#7204</a>
<a
href="https://redirect.github.com/tokio-rs/tokio/issues/7230">#7230</a>:
<a
href="https://redirect.github.com/tokio-rs/tokio/pull/7230">tokio-rs/tokio#7230</a>
<a
href="https://redirect.github.com/tokio-rs/tokio/issues/7226">#7226</a>:
<a
href="https://redirect.github.com/tokio-rs/tokio/pull/7226">tokio-rs/tokio#7226</a>
<a
href="https://redirect.github.com/tokio-rs/tokio/issues/7275">#7275</a>:
<a
href="https://redirect.github.com/tokio-rs/tokio/pull/7275">tokio-rs/tokio#7275</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="3768696d92"><code>3768696</code></a>
chore: prepare Tokio v1.45.1 (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/7359">#7359</a>)</li>
<li><a
href="421a7b001c"><code>421a7b0</code></a>
rt: do not track time-based metrics on wasm32-unknown-unknown (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/7322">#7322</a>)</li>
<li><a
href="b1bdb3c57b"><code>b1bdb3c</code></a>
ci: update macros_type_mismatch for Rust 1.87.0 (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/7339">#7339</a>)</li>
<li><a
href="00754c8f9c"><code>00754c8</code></a>
chore: prepare Tokio v1.45.0 (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/7308">#7308</a>)</li>
<li><a
href="1ae9434e8e"><code>1ae9434</code></a>
time: revert &quot;use sharding for timer implementation&quot; related
changes (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/7226">#7226</a>)</li>
<li><a
href="8895bba448"><code>8895bba</code></a>
ci: Test AArch64 Windows (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/7288">#7288</a>)</li>
<li><a
href="48ca254d92"><code>48ca254</code></a>
time: update <code>sleep</code> documentation to reflect maximum allowed
duration (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/7302">#7302</a>)</li>
<li><a
href="a0af02a396"><code>a0af02a</code></a>
compat: add more documentation to <code>tokio_util::compat</code> (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/7279">#7279</a>)</li>
<li><a
href="0ce3a1188a"><code>0ce3a11</code></a>
metrics: stabilize <code>worker_park_count</code> and
<code>worker_unpark_count</code> (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/7276">#7276</a>)</li>
<li><a
href="1ea9ce11d4"><code>1ea9ce1</code></a>
ci: fix cfg!(miri) declarations in tests (<a
href="https://redirect.github.com/tokio-rs/tokio/issues/7286">#7286</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/tokio-rs/tokio/compare/tokio-1.44.2...tokio-1.45.1">compare
view</a></li>
</ul>
</details>
<br />

Updates `tempfile` from 3.19.1 to 3.20.0
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/Stebalien/tempfile/blob/master/CHANGELOG.md">tempfile's
changelog</a>.</em></p>
<blockquote>
<h2>3.20.0</h2>
<p>This release mostly unifies the behavior/capabilities around
&quot;keeping&quot; temporary files:</p>
<ul>
<li>Rename <code>Builder::keep(bool)</code> (via deprecation) to
<code>Builder::disable_cleanup(bool)</code> to make it clear that
behaves differently from <code>NamedTempFile::keep()</code>. The former
disables automatic cleanup while the latter <em>consumes</em> the
<code>NamedTempFile</code> object entirely and unsets the
&quot;temporary file&quot; attribute (on Windows).</li>
<li>Rename <code>TempDir::into_path</code> (via deprecation) to
<code>TempDir::keep</code> to mirror
<code>NamedTempFile::keep</code>.</li>
<li>Add <code>TempDir::disable_cleanup</code>,
<code>NamedTempFile::disable_cleanup</code>, and
<code>TempPath::disable_cleanup</code> making it possible to disable
automatic cleanup in-place <em>after</em> creating a temporary
file/directory (equivalent to calling
<code>Builder::disable_cleanup</code> before creating the
file/directory).</li>
</ul>
<p>Additionally, it adds a few spooled temporary file features:</p>
<ul>
<li>Add <code>SpooledTempFile::into_file</code> for turning a
<code>SpooledTempFile</code> into a regular unnamed temporary file,
writing it to the backing storage (&quot;rolling&quot; it) if it was
still stored in-memory.</li>
<li>Add <code>spooled_tempfile_in</code> and
<code>SpooledTempFile::new_in</code> methods for creating spooled
temporary files in a specific directory. This makes it possible to
choose the backing device for your spooled temporary file which is
rather important on Linux where the default temporary directory is
likely backed by memory (defeating the entire point of having a spooled
temporary file).</li>
</ul>
<p>Finally, this release improves documentation, especially the
top-level documentation explaining which temporary file type to use.</p>
<p><strong>BREAKING</strong> for those with
<code>deny(warnings)</code>:</p>
<ul>
<li><code>Builder::keep</code> deprecated in favor of
<code>Builder::disable_cleanup</code>.</li>
<li><code>TempDir::into_path</code> is deprecated in favor of
<code>TempDir::keep</code>.</li>
</ul>
<p><strong>BREAKING</strong>:</p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="99ffea61ad"><code>99ffea6</code></a>
chore: release v3.20.0 (<a
href="https://redirect.github.com/Stebalien/tempfile/issues/358">#358</a>)</li>
<li><a
href="bd2b267442"><code>bd2b267</code></a>
feat: make it possible to disable cleanup in-place after creation (<a
href="https://redirect.github.com/Stebalien/tempfile/issues/355">#355</a>)</li>
<li><a
href="3b30099abd"><code>3b30099</code></a>
ci: really check docs for warnings (<a
href="https://redirect.github.com/Stebalien/tempfile/issues/357">#357</a>)</li>
<li><a
href="f701f52456"><code>f701f52</code></a>
ci: check docs (<a
href="https://redirect.github.com/Stebalien/tempfile/issues/356">#356</a>)</li>
<li><a
href="d34afe99fd"><code>d34afe9</code></a>
doc: improve SpooledData documentation</li>
<li><a
href="6deb42e04c"><code>6deb42e</code></a>
doc: make it easier to pick the correct tempfile constructor/type</li>
<li><a
href="e284782c6c"><code>e284782</code></a>
feat: allow creating spooled temporary files in a specific directory (<a
href="https://redirect.github.com/Stebalien/tempfile/issues/353">#353</a>)</li>
<li><a
href="07edc310a5"><code>07edc31</code></a>
feat: implement <code>SpooledTempFile::into_file</code> (<a
href="https://redirect.github.com/Stebalien/tempfile/issues/352">#352</a>)</li>
<li><a
href="b1223553bb"><code>b122355</code></a>
fix: add must_use attribute to TempDir::keep (<a
href="https://redirect.github.com/Stebalien/tempfile/issues/351">#351</a>)</li>
<li><a
href="cbd1e976e1"><code>cbd1e97</code></a>
feat: rename <code>TempDir::into_path</code> to
<code>TempDir::keep</code> (<a
href="https://redirect.github.com/Stebalien/tempfile/issues/349">#349</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/Stebalien/tempfile/compare/v3.19.1...v3.20.0">compare
view</a></li>
</ul>
</details>
<br />


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-06-01 09:49:56 -04:00
Frances Wingerter
c60070bb80 Small fixes to concurrency material (#2737)
See individual commits.
2025-05-23 15:54:14 -04:00
Andrew Walbran
fc6e5c7526 Update to Rust 2024 edition. (#2658) 2025-05-23 19:03:03 +01:00