1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-03-20 06:21:09 +02:00

217 Commits

Author SHA1 Message Date
dependabot[bot]
bd7f15dbaa
cargo: bump the patch group in /src/exercises/bare-metal/rtc with 1 update (#1808)
Bumps the patch group in /src/exercises/bare-metal/rtc with 1 update:
[chrono](https://github.com/chronotope/chrono).

Updates `chrono` from 0.4.33 to 0.4.34

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-12 10:09:20 +00:00
dependabot[bot]
e921d4bb1e
cargo: bump the minor group with 2 updates (#1783)
Bumps the minor group with 2 updates:
[pulldown-cmark](https://github.com/raphlinus/pulldown-cmark) and
[tokio](https://github.com/tokio-rs/tokio).

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>
2024-02-05 11:25:39 +00:00
dependabot[bot]
0e505be897
cargo: bump the patch group with 3 updates (#1784)
Bumps the patch group with 3 updates:
[serde_json](https://github.com/serde-rs/json),
[serde_yaml](https://github.com/dtolnay/serde-yaml) 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>
2024-02-05 10:30:46 +00:00
Pavel Roskin
fbc6be4e1c
Actually protect against deadlock in Dining Philosophers async exercise (#1772)
Swapping forks for one philosopher feels like cheating. It's like one of
the philosophers is facing away from the table. Or perhaps it's the only
right-handed philosopher at the table.

More importantly, there is no effective mechanism to prevent deadlocks.
Add that mechanism, it's useful for learning Rust.

The new code demonstrates let-else, drop and returning values from a
loop. `std::mem::swap` remains in the thread version of the Dining
Philosophers exercise for now.

This also fixes compilation. `left_fork` and `right_fork` had to be
`mut` in `main()` for the workaround to compile.
2024-01-30 20:00:19 -05:00
dependabot[bot]
4b7a874263
cargo: bump the patch group in /src/exercises/bare-metal/rtc with 1 update (#1768)
Bumps the patch group in /src/exercises/bare-metal/rtc with 1 update:
[chrono](https://github.com/chronotope/chrono).

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-29 10:29:40 +00:00
dependabot[bot]
bc12c3820c
cargo: bump embedded-hal from 0.2.7 to 1.0.0 in /src/exercises/bare-metal/compass (#1720)
Bumps [embedded-hal](https://github.com/rust-embedded/embedded-hal) from
0.2.7 to 1.0.0.

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-22 11:01:45 -08:00
dependabot[bot]
b4164e44a3
cargo: bump the minor group in /src/exercises/bare-metal/compass with 1 update (#1718)
Bumps the minor group in /src/exercises/bare-metal/compass with 1
update: [lsm303agr](https://github.com/eldruin/lsm303agr-rs).

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-18 12:08:15 +00:00
dependabot[bot]
d7d3c9c6c1
cargo: bump the patch group in /src/exercises/bare-metal/rtc with 1 update (#1717)
Bumps the patch group in /src/exercises/bare-metal/rtc with 1 update:
[bitflags](https://github.com/bitflags/bitflags).

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-18 11:09:51 +00:00
dependabot[bot]
3b17afd042
cargo: bump the patch group with 1 update (#1703)
Bumps the patch group with 1 update:
[tokio-websockets](https://github.com/Gelbpunkt/tokio-websockets).

Updates `tokio-websockets` from 0.5.0 to 0.5.1

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dustin J. Mitchell <djmitche@google.com>
2024-01-17 09:04:52 -05:00
dependabot[bot]
d89bd02408
build(deps): bump thiserror from 1.0.53 to 1.0.56 (#1655)
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.53 to
1.0.56.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/dtolnay/thiserror/releases">thiserror's
releases</a>.</em></p>
<blockquote>
<h2>1.0.56</h2>
<ul>
<li>Update proc-macro2 to fix caching issue when using a rustc-wrapper
such as sccache</li>
</ul>
<h2>1.0.55</h2>
<ul>
<li>Work around improperly cached build script result by sccache –
second attempt (<a
href="https://redirect.github.com/dtolnay/thiserror/issues/280">#280</a>)</li>
</ul>
<h2>1.0.54</h2>
<ul>
<li>Work around improperly cached build script result by sccache – first
attempt (<a
href="https://redirect.github.com/dtolnay/thiserror/issues/279">#279</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="77d0af46dd"><code>77d0af4</code></a>
Release 1.0.56</li>
<li><a
href="d4caabdb38"><code>d4caabd</code></a>
Pull in proc-macro2 sccache fix</li>
<li><a
href="6089273df5"><code>6089273</code></a>
Release 1.0.55</li>
<li><a
href="322a2ae5c9"><code>322a2ae</code></a>
Merge pull request <a
href="https://redirect.github.com/dtolnay/thiserror/issues/280">#280</a>
from dtolnay/depinfo</li>
<li><a
href="fd7d7a568c"><code>fd7d7a5</code></a>
Emit dep-info for probe.rs in case sccache needs it</li>
<li><a
href="447c328719"><code>447c328</code></a>
Release 1.0.54</li>
<li><a
href="4619db8644"><code>4619db8</code></a>
Merge pull request <a
href="https://redirect.github.com/dtolnay/thiserror/issues/279">#279</a>
from dtolnay/depinfo</li>
<li><a
href="7b53bff3e6"><code>7b53bff</code></a>
Make env-dep:RUSTC_BOOTSTRAP get listed in probe's dep-info</li>
<li><a
href="e0500add5e"><code>e0500ad</code></a>
Merge pull request <a
href="https://redirect.github.com/dtolnay/thiserror/issues/277">#277</a>
from dtolnay/nightlyci</li>
<li><a
href="48cea47164"><code>48cea47</code></a>
Make CI verify that error_generic_member_access works in latest
nightly</li>
<li>Additional commits viewable in <a
href="https://github.com/dtolnay/thiserror/compare/1.0.53...1.0.56">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=thiserror&package-manager=cargo&previous-version=1.0.53&new-version=1.0.56)](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 this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-05 13:25:21 +00:00
dependabot[bot]
7c74f0f476
build(deps): bump thiserror from 1.0.51 to 1.0.53 (#1626)
[//]: # (dependabot-start)
⚠️  **Dependabot is rebasing this PR** ⚠️ 

Rebasing might not happen immediately, so don't worry if this takes some
time.

Note: if you make any changes to this PR yourself, they will take
precedence over the rebase.

---

[//]: # (dependabot-end)

Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.51 to
1.0.53.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/dtolnay/thiserror/releases">thiserror's
releases</a>.</em></p>
<blockquote>
<h2>1.0.53</h2>
<ul>
<li>Reduce spurious rebuilds under RustRover IDE when using a nightly
toolchain (<a
href="https://redirect.github.com/dtolnay/thiserror/issues/270">#270</a>)</li>
</ul>
<h2>1.0.52</h2>
<ul>
<li>Fix interaction with RUSTC_BOOTSTRAP (<a
href="https://redirect.github.com/dtolnay/thiserror/issues/269">#269</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="af28d9c078"><code>af28d9c</code></a>
Release 1.0.53</li>
<li><a
href="c22822cd8c"><code>c22822c</code></a>
Merge pull request <a
href="https://redirect.github.com/dtolnay/thiserror/issues/275">#275</a>
from dtolnay/probers</li>
<li><a
href="87223991b7"><code>8722399</code></a>
Rerun build script on changes to probe.rs</li>
<li><a
href="0e280fe61d"><code>0e280fe</code></a>
Merge pull request <a
href="https://redirect.github.com/dtolnay/thiserror/issues/274">#274</a>
from dtolnay/bootstrap</li>
<li><a
href="f334cfcdc1"><code>f334cfc</code></a>
Do not rebuild on RUSTC_BOOTSTRAP changes on nightly compiler</li>
<li><a
href="5fd95375e3"><code>5fd9537</code></a>
Update crate name used for build script probe</li>
<li><a
href="a9b1585343"><code>a9b1585</code></a>
Move ExitStatus::success check into compile_probe()</li>
<li><a
href="0f349a4bb1"><code>0f349a4</code></a>
Remove needless_raw_string_hashes clippy pedantic suppression from build
script</li>
<li><a
href="c1c003f2a3"><code>c1c003f</code></a>
Merge pull request <a
href="https://redirect.github.com/dtolnay/thiserror/issues/273">#273</a>
from dtolnay/cargoenvvar</li>
<li><a
href="9b7356fd43"><code>9b7356f</code></a>
Require cargo promised environment variables to be present</li>
<li>Additional commits viewable in <a
href="https://github.com/dtolnay/thiserror/compare/1.0.51...1.0.53">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=thiserror&package-manager=cargo&previous-version=1.0.51&new-version=1.0.53)](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 this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-01 16:31:17 +00:00
dependabot[bot]
f4ad9d9caf
build(deps): bump futures-util from 0.3.29 to 0.3.30 (#1627)
Bumps [futures-util](https://github.com/rust-lang/futures-rs) from
0.3.29 to 0.3.30.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/rust-lang/futures-rs/releases">futures-util's
releases</a>.</em></p>
<blockquote>
<h2>0.3.30</h2>
<ul>
<li>Add
<code>{BiLock,SplitStream,SplitSink,ReadHalf,WriteHalf}::is_pair_of</code>
(<a
href="https://redirect.github.com/rust-lang/futures-rs/issues/2797">#2797</a>)</li>
<li>Fix panic in <code>FuturesUnordered::clear</code> (<a
href="https://redirect.github.com/rust-lang/futures-rs/issues/2809">#2809</a>)</li>
<li>Fix panic in <code>AsyncBufReadExt::fill_buf</code> (<a
href="https://redirect.github.com/rust-lang/futures-rs/issues/2801">#2801</a>,
<a
href="https://redirect.github.com/rust-lang/futures-rs/issues/2812">#2812</a>)</li>
<li>Improve support for targets without atomic CAS (<a
href="https://redirect.github.com/rust-lang/futures-rs/issues/2811">#2811</a>)</li>
<li>Remove build scripts (<a
href="https://redirect.github.com/rust-lang/futures-rs/issues/2811">#2811</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md">futures-util's
changelog</a>.</em></p>
<blockquote>
<h1>0.3.30 - 2023-12-24</h1>
<ul>
<li>Add
<code>{BiLock,SplitStream,SplitSink,ReadHalf,WriteHalf}::is_pair_of</code>
(<a
href="https://redirect.github.com/rust-lang/futures-rs/issues/2797">#2797</a>)</li>
<li>Fix panic in <code>FuturesUnordered::clear</code> (<a
href="https://redirect.github.com/rust-lang/futures-rs/issues/2809">#2809</a>)</li>
<li>Fix panic in <code>AsyncBufReadExt::fill_buf</code> (<a
href="https://redirect.github.com/rust-lang/futures-rs/issues/2801">#2801</a>,
<a
href="https://redirect.github.com/rust-lang/futures-rs/issues/2812">#2812</a>)</li>
<li>Improve support for targets without atomic CAS (<a
href="https://redirect.github.com/rust-lang/futures-rs/issues/2811">#2811</a>)</li>
<li>Remove build scripts (<a
href="https://redirect.github.com/rust-lang/futures-rs/issues/2811">#2811</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="de1a0fd64a"><code>de1a0fd</code></a>
Release 0.3.30</li>
<li><a
href="68d284545f"><code>68d2845</code></a>
Remove a redundant space in example (<a
href="https://redirect.github.com/rust-lang/futures-rs/issues/2816">#2816</a>)</li>
<li><a
href="fdd2ce716c"><code>fdd2ce7</code></a>
Fix broken link in <code>CopyBufAbortable</code> docs (<a
href="https://redirect.github.com/rust-lang/futures-rs/issues/2815">#2815</a>)</li>
<li><a
href="272a3c709f"><code>272a3c7</code></a>
Use cfg(target_has_atomic) on no-std targets</li>
<li><a
href="c179201bd1"><code>c179201</code></a>
FillBuf: Do not call poll_fill_buf twice</li>
<li><a
href="e6735f3d01"><code>e6735f3</code></a>
FuturesUnordered: Fix clear implementation</li>
<li><a
href="04d01a00a2"><code>04d01a0</code></a>
FuturesOrdered: Use 64-bit index</li>
<li><a
href="e4aa659649"><code>e4aa659</code></a>
remove redundant impl Unpin</li>
<li><a
href="17851c1f05"><code>17851c1</code></a>
provide a mechanism to determine if io read/write halves are from the
same st...</li>
<li><a
href="49107994e5"><code>4910799</code></a>
provide a non-destructive mechanism to determine if a sink/stream are
paired</li>
<li>Additional commits viewable in <a
href="https://github.com/rust-lang/futures-rs/compare/0.3.29...0.3.30">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=futures-util&package-manager=cargo&previous-version=0.3.29&new-version=0.3.30)](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 this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-31 10:09:17 -05:00
dependabot[bot]
6757dd72c8
build(deps): bump tempfile from 3.8.1 to 3.9.0 (#1623)
Bumps [tempfile](https://github.com/Stebalien/tempfile) from 3.8.1 to
3.9.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.9.0</h2>
<ul>
<li>Updates windows-sys to 0.52</li>
<li>Updates minimum rustix version to 0.38.25</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="fb313e01bc"><code>fb313e0</code></a>
chore: release 3.9.0</li>
<li><a
href="709a62a299"><code>709a62a</code></a>
Update <code>windows-sys</code> 0.52 (<a
href="https://redirect.github.com/Stebalien/tempfile/issues/265">#265</a>)</li>
<li>See full diff in <a
href="https://github.com/Stebalien/tempfile/compare/v3.8.1...v3.9.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=tempfile&package-manager=cargo&previous-version=3.8.1&new-version=3.9.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 this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-31 15:07:54 +00:00
Martin Geisler
c9f66fd425
Format all Markdown files with dprint (#1157)
This is the result of running `dprint fmt` after removing `src/` from
the list of excluded directories.

This also reformats the Rust code: we might want to tweak this a bit in
the future since some of the changes removes the hand-formatting. Of
course, this formatting can be seen as a mis-feature, so maybe this is
good overall.

Thanks to mdbook-i18n-helpers 0.2, the POT file is nearly unchanged
after this, meaning that all existing translations remain valid! A few
messages were changed because of stray whitespace characters:

     msgid ""
     "Slices always borrow from another object. In this example, `a` has to remain "
    -"'alive' (in scope) for at least as long as our slice. "
    +"'alive' (in scope) for at least as long as our slice."
     msgstr ""

The formatting is enforced in CI and we will have to see how annoying
this is in practice for the many contributors. If it becomes annoying,
we should look into fixing dprint/check#11 so that `dprint` can annotate
the lines that need fixing directly, then I think we can consider more
strict formatting checks.

I added more customization to `rustfmt.toml`. This is to better emulate
the dense style used in the course:

- `max_width = 85` allows lines to take up the full width available in
our code blocks (when taking margins and the line numbers into account).
- `wrap_comments = true` ensures that we don't show very long comments
in the code examples. I edited some comments to shorten them and avoid
unnecessary line breaks — please trim other unnecessarily long comments
when you see them! Remember we're writing code for slides 😄
- `use_small_heuristics = "Max"` allows for things like struct literals
and if-statements to take up the full line width configured above.

The formatting settings apply to all our Rust code right now — I think
we could improve this with https://github.com/dprint/dprint/issues/711
which lets us add per-directory `dprint` configuration files. However,
the `inherit: true` setting is not yet implemented (as far as I can
tell), so a nested configuration file will have to copy most or all of
the top-level file.
2023-12-31 00:15:07 +01:00
Lukasz Anforowicz
dea36b76cf
Chromium: Add a section about the chromium::import! macro. (#1611) 2023-12-22 07:50:11 -08:00
Martin Geisler
a99a86dc50
Update all dependencies (#1610)
This resolves a few Dependabot alerts on `zerocopy` and refreshes the
other direct dependencies.
2023-12-21 13:55:45 +00:00
Lukasz Anforowicz
f04e277744
Chromium: Add redox_syscall to speaker notes for the third-party exercise. (#1571)
Speaker notes for Chromium's third-party crate exercise list the
transitive dependencies that will be downloaded during the exercise.
Before this commit the list was missing the `redox_syscall` crate.

Additionally, the commit sorts the crates to make it easier to compare
with the output of `git status` or `ls`.

---------

Co-authored-by: Martin Geisler <martin@geisler.net>
2023-12-11 07:21:53 -08:00
Lukasz Anforowicz
89b41555eb
Title-casing in section titles (#1557)
Fixes https://github.com/google/comprehensive-rust/issues/1552
2023-12-07 18:06:18 -08:00
Adrian Taylor
cc8405d04f
Chromium exercise solutions (#1564)
The main thing in this CL is a link to exercise solutions but there are
a couple of other very minor tweaks.
2023-12-06 19:26:41 +00:00
Lukasz Anforowicz
8f9902cc3e
Chromium: new subsection about gtest tests (#1551) 2023-12-05 10:39:02 +00:00
Lukasz Anforowicz
584c957d69
Fix spelling of CXX and Cargo (mostly in the Chromium part). (#1549) 2023-12-01 10:21:47 -08:00
Lukasz Anforowicz
02d0b5d01a
Chromium: fix path of String::from_utf16 (#1541) 2023-12-01 09:21:20 +01:00
Dustin J. Mitchell
6d19292f16
Comprehensive Rust v2 (#1073)
I've taken some work by @fw-immunant and others on the new organization
of the course and condensed it into a form amenable to a text editor and
some computational analysis. You can see the inputs in `course.py` but
the interesting bits are the output: `outline.md` and `slides.md`.

The idea is to break the course into more, smaller segments with
exercises at the ends and breaks in between. So `outline.md` lists the
segments, their duration, and sums those durations up per-day. It shows
we're about an hour too long right now! There are more details of the
segments in `slides.md`, or you can see mostly the same stuff in
`course.py`.

This now contains all of the content from the v1 course, ensuring both
that we've covered everything and that we'll have somewhere to redirect
every page.

Fixes #1082.
Fixes #1465.

---------

Co-authored-by: Nicole LeGare <dlegare.1001@gmail.com>
Co-authored-by: Martin Geisler <mgeisler@google.com>
2023-11-29 16:39:24 +01:00
Adrian Taylor
5cec89045b
Thank creator of uwu crate. (#1505) 2023-11-29 15:38:19 +01:00
Martin Geisler
aebb0bc856
Replace hyphens (-) with em-dashes () (#1500)
The new Chromium class likes — like me! — to use dashes in the writing!
However, I believe it should use an em-dash instead of the hyphen.

Luckily this is easy: we have enabled “typographic quotes” in `mdbook`,
which also handles the conversion of `---` to `—` in the generated HTML.
So I normalized the single existing em-dash to a triple-dash to make it
more consistent (and hopefully make it easier for translators to
consistently enter these characters).
2023-11-28 19:41:09 +01:00
Bram Bonné
d39740f91d
Fix link to uwuify crate (#1499) 2023-11-28 13:37:06 +00:00
Adrian Taylor
7f469fb2c7
Add Chromium section (#1479)
This is a contribution of a Chromium section for Comprehensive Rust.

---------

Co-authored-by: Nicole L <dlegare.1001@gmail.com>
Co-authored-by: Martin Geisler <martin@geisler.net>
2023-11-27 18:21:19 +00:00
Martin Geisler
8b863c0446
Update Rust dependencies (#1487)
This fixes a low-criticality vulnerability in `atty` (on Windows):

  https://github.com/advisories/GHSA-g98v-hv3f-hcfr

I only updated the dependencies here which didn’t require code changes.
2023-11-20 09:26:19 -05:00
justanotheranonymoususer
b8b274165c
Update luhn.rs (#1376)
Fix semicolon

I'm only learning Rust but I think it makes more sense
2023-10-18 03:53:14 +00:00
M1DOR1
c01b5ca6ed
Simplify solution to Luhn exercise (#1296)
Maybe we can use bool double and make the code easier to read and
comprehend
2023-10-17 13:35:34 +00:00
Seth Paydar
de0e8e6b6d
fix: typo in mark_visited fn docstring (#1355)
Fixes a typo in the `mark_visited` function docstring.

See [`HashSet.insert`
documentation](https://doc.rust-lang.org/stable/std/collections/struct.HashSet.html#method.insert)
2023-10-12 09:42:56 +00:00
Nick Radcliffe
b398b46a10
Update dining-philosophers-async.rs (#1346)
Also replace Thales with Hypatia in the async version of Dining
Philosophers.
2023-10-11 13:35:08 +02:00
Nick Radcliffe
18f0ebf9dc
Update dining-philosophers.rs (#1345)
Replace Thales with Hypatia for slightly more inclusivity.
2023-10-11 13:34:12 +02:00
Noam Zaks
4eebe43f3b
Fix typo: missing n in unknown (#1344) 2023-10-11 11:30:19 +01:00
Oscar
b037548923
Add mdbook-xgettext skip for untranslatable codeblocks in Bare Metal (#1339)
See #1327

Removes 280 lines from `messages.pot`.

Signed-off-by: 0scvr <71343264+0scvr@users.noreply.github.com>
2023-10-11 09:32:12 +00:00
Nick Radcliffe
a883a569d0
Remove unused callback from GUI exercise (#1293)
Here's a possible update to the GUI/TUI exercise, taking out the
callback and explaining (slightly).

See what you think.

---------

Co-authored-by: Martin Geisler <martin@geisler.net>
2023-10-03 14:07:33 +00:00
Nick Radcliffe
0f768df367
Minor rewording of safe-ffi-wrapper exercise. (#1286)
For readability.
2023-10-03 14:03:30 +00:00
Martin Geisler
9f079f173b
Update all Cargo.lock files (#1295)
This is the result of running `cargo update` in every directory.

It fixes a alert: https://github.com/advisories/GHSA-9mcr-873m-xcxp. We
don’t run any HTTP server directly, so this is not super important for
us. However, it will remove the alert from my dashboard.
2023-10-03 14:18:44 +02:00
Matthew
1c43db108b
Fix inconsistent filename styling (#1274)
Addresses https://github.com/google/comprehensive-rust/issues/625

Pages with inconsistent styling:
[Bare Metal Rust Afternoon
Solutions](https://google.github.io/comprehensive-rust/exercises/bare-metal/solutions-afternoon.html)
[Concurrency Afternoon
Solutions](https://google.github.io/comprehensive-rust/exercises/concurrency/solutions-afternoon.html)
[Microcontroller > Debugging
Page](https://google.github.io/comprehensive-rust/bare-metal/microcontrollers/debugging.html)
2023-09-29 08:38:42 +02:00
Martin Geisler
d0e0e5c1af
Skip some untranslatable code blocks (#1258)
This builds on the work of @dyoo in
https://github.com/google/mdbook-i18n-helpers/pull/69: by adding a
special `<!-- mdbook-xgettext: skip -->` comment, we can skip the
following code block.

I also modified a few code blocks to remove translatable text: variable
names are not expected to be translated, so it’s fine to have a line
with `println!("foo: {foo}")` in the code block.

This PR removes 36 messages from the POT file. The number of lines drop
by 633 (3%).

Part of #1257.
2023-09-26 17:04:46 +02:00
Matthew
a492b2f1b2
Italic filenames formatted accordingly (#1259)
**Task** Addresses:
https://github.com/google/comprehensive-rust/issues/625
Certain pages in the mdbook that display filenames have inconsistent
styling.

The style we want to follow: [the interop
section](https://google.github.io/comprehensive-rust/android/interoperability/java.html)

The current problem: [the RTC
driver](https://google.github.io/comprehensive-rust/exercises/bare-metal/rtc.html)
excercise page.

--
@mgeisler I checked this feature by looking through every page


![work](https://github.com/google/comprehensive-rust/assets/38759997/8affd0c2-71f2-4708-88f6-f63cf3c24efa)
2023-09-26 15:15:41 +02:00
Frances Wingerter
758639174a
Add solution for Health Statistics exercise (#1172) 2023-09-26 09:29:00 +02:00
Martin Geisler
ca424b90e0
Revert "Update boot-library.md" (#1235)
Reverts google/comprehensive-rust#225. We normally include links at the
start of each exercise blocks — but we don't include links in the
individual exercises.

If we want to add such links, we should do it consistently across the
entire course.
2023-09-25 09:39:37 -04:00
Daniel Fernández Núñez
9d21fe159a
Fix bad link in speaker notes Day 2 exercises (#1244) 2023-09-25 07:01:40 +00:00
Martin Geisler
187fc20007
Fix solution for Storing Books exercise (#1237)
As pointed out by @njr0 in #1233, we were making the exercise confusing
by showing people code that cannot work — and then expecting the course
participants to somehow fix this, without setting clear boundaries for
what can and cannot be modified.

This PR should align the exercise with the other exercises in the course
and avoid the “brain teaser” here.

This also has the advantage of having a full working solution, with no
commented code which will bit-rot over time.
2023-09-22 11:22:51 -04:00
Dustin J. Mitchell
c4a821d43d
Add a pattern-matching exercise (#1231)
This adds a second day-1 afternoon exercise, drawn from the v2 work. It
illustrates general use of an enum and also previews `Result`.

Fixes #1228.
2023-09-22 13:36:57 +02:00
Martin Geisler
991c437986
Trim off licenses when showing solutions (#1212)
The licenses end up in the PO files, causing extra unnecessary for work
our translators. We save about 300 lines from each PO file with this.

This also solves another small problem: when a file is included with an
anchor, other anchors are automatically stripped away. This removes some
confusing `// ANCHOR: foo` and `// ANCHOR_END: foo` lines in the
solutions.
2023-09-18 11:56:55 +02:00
Frances Wingerter
d2e0c62303
exercises/day-2/book-library: Fix typo (#1171) 2023-09-12 09:04:08 +02:00
Muhammad Mahmood
354f3afa7c
Corrected Luhn's Algorithm Step 3 (#1194)
In the exercise guideline for the Luhn's algorithm (Day 1, Afternoon
exercise), I made a correction to step 3 to provide a more accurate
explanation. Instead of stating that doubling 7 becomes 14, I clarified
that doubling 7 results in 14, and we should sum the individual digits
of 14 to get the correct value of 5.
2023-09-11 14:24:05 +00:00
Jens Reidel
fb95f779d2
Update dependencies in chat-app exercise (#1195)
Hello there 👋 I'm the author of the `tokio-websockets` crate and
today we published version `0.4.0` of the crate, which finally makes the
public API consistent and aligns it with expectations.

`WebsocketStream` now implements the `Stream` trait, so calling `next()`
has to be done via `StreamExt` now. `connect()` returns a tuple of
`(WebsocketStream, Response)`, so that has to be deconstructed now. And
finally, `as_text()` now returns an `Option<&str>` instead of
`Result<&str, Error>`.

And, *very* importantly: The old `WebsocketStream::next` was **not**
cancellation safe, the new `Stream` implementation is. The exercise uses
`select!`, which very well might have caused misbehavior.

Since we also emptied the default features, I've added the very minimal
ones required to compile the exercise.

This is my first contribution here, so feel free to point me to some
things if I'm missing anything. I wasn't really sure what to do about
the translations, I guess I should leave them as is and they'll be
updated by translators in other PRs?

Signed-off-by: Jens Reidel <adrian@travitia.xyz>
2023-09-11 10:19:13 -04:00