1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-06-14 21:35:00 +02:00
Commit Graph

1153 Commits

Author SHA1 Message Date
cf7359fac8 Add links to std and docs.rs (#2403)
- **Link to relevant crate APIs**
- **Add missing std links**
2024-10-15 08:12:25 +02:00
25a2fa6a09 fa: try to complete Farsi - part 4 (#2401)
fa: try to complete Farsi - part 4

---------

Co-authored-by: javad-jafari <javajafarifromsharak@gmail.com>
Co-authored-by: javad-jafari <65780584+javad-jafari@users.noreply.github.com>
2024-10-14 00:00:04 +03:30
252bb62521 Fix typo (#2399)
Fix typo
2024-10-09 03:25:54 +00:00
0474168196 Remove outdated tip about handling division by zero (#2393)
The exercise text already asks you to handle this.
2024-10-02 00:31:49 +00:00
0a9a01d991 cargo: bump the patch group with 8 updates (#2388)
Bumps the patch group with 8 updates:

| Package | From | To |
| --- | --- | --- |
| [anyhow](https://github.com/dtolnay/anyhow) | `1.0.86` | `1.0.89` |
| [clap](https://github.com/clap-rs/clap) | `4.5.16` | `4.5.18` |
| [serde](https://github.com/serde-rs/serde) | `1.0.209` | `1.0.210` |
| [serde_json](https://github.com/serde-rs/json) | `1.0.127` | `1.0.128`
|
| [pulldown-cmark](https://github.com/raphlinus/pulldown-cmark) |
`0.12.0` | `0.12.1` |
| [tokio-util](https://github.com/tokio-rs/tokio) | `0.7.11` | `0.7.12`
|
| [thiserror](https://github.com/dtolnay/thiserror) | `1.0.63` |
`1.0.64` |
| [reqwest](https://github.com/seanmonstar/reqwest) | `0.12.7` |
`0.12.8` |

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-01 14:14:54 +01:00
6a013839f3 cargo: bump cc from 1.1.15 to 1.1.23 in /src/exercises/bare-metal/rtc in the patch group (#2391)
Bumps the patch group in /src/exercises/bare-metal/rtc with 1 update:
[cc](https://github.com/rust-lang/cc-rs).

Updates `cc` from 1.1.15 to 1.1.23

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-01 14:01:30 +01:00
7422ee20e6 cargo: bump cc from 1.1.15 to 1.1.23 in /src/bare-metal/aps/examples in the patch group (#2390)
Bumps the patch group in /src/bare-metal/aps/examples with 1 update:
[cc](https://github.com/rust-lang/cc-rs).

Updates `cc` from 1.1.15 to 1.1.23

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-01 14:01:07 +01:00
be9ed92365 cargo: bump the minor group with 4 updates (#2387)
Bumps the minor group with 4 updates:
[regex](https://github.com/rust-lang/regex),
[buddy_system_allocator](https://github.com/rcore-os/buddy_system_allocator),
[tempfile](https://github.com/Stebalien/tempfile) and
[tokio-websockets](https://github.com/Gelbpunkt/tokio-websockets).

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-01 14:00:01 +01:00
c23c0c9312 cargo: bump buddy_system_allocator from 0.10.0 to 0.11.0 in /src/bare-metal/alloc-example in the minor group (#2386)
Bumps the minor group in /src/bare-metal/alloc-example with 1 update:
[buddy_system_allocator](https://github.com/rcore-os/buddy_system_allocator).

Updates `buddy_system_allocator` from 0.10.0 to 0.11.0

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-01 13:59:34 +01:00
29dcb0c06f Exercise: method and traits: change output (#2383)
In this exercise, the original StderrLogger output to stderr, which user
cannot see the original log but "No output" in frontend". Change
`eprintln!` to `println!` to make it see-able in the frontend. Also, due
to the change, rename the logger struct.

Close: #2382

Signed-off-by: Alx-Lai <alexabc722@gmail.com>
2024-09-30 15:15:50 +00:00
9d2ea42fc4 Fix thiserror slide (#2380)
Fixes #2379. This has `compile_fail` because `thiserror` isn't available
from within `mdbook test`.
2024-09-27 12:39:53 +00:00
2713ea3475 Use Clang rather than GCC for assembly. (#2377)
This avoids the hack for using aarch64-linux-gnu on Linux, and also
removes a dependency.

Also switched to using `cargo-objcopy`, as we require `cargo-binutils`
already and it makes the Makefiles simpler.
2024-09-24 10:19:29 +01:00
2f9babd098 Miscellaneous minor improvements (#2370) 2024-09-20 14:19:53 -07:00
aeb643f380 error-handling: split thiserror into its own slide (#2332)
`thiserror` is best understood as a way to eliminate boilerplate on the
patterns we've already seen, and then we can show it in conjunction with
`anyhow` subsequently.

Fixes #2027.
2024-09-20 20:56:22 +00:00
db0b161424 fix async Philosopher execise livelock error (#2372) 2024-09-20 12:13:16 +00:00
7a6abee0da Remove part about Error not being no_std (#2369)
This reverts #1005 now that Rust 1.81 has stabilized the `Error` trait.
2024-09-18 03:38:19 +02:00
d2bc223a06 Misc. Android Improvements (#2325)
- Add missing package declaration on the AIDL interface slide.
- Make the parcelable example more self-contained. The existing code was
referencing variables that weren't declared in the example code.
- Add a speaker note to the logging slide about explaining that the
logger implementation is only needed in binaries, and that just the log
facade is needed in libraries.
2024-09-17 09:09:07 -07:00
3637c44a5d Fix typo in box.md (#2362) 2024-09-12 14:53:54 +00:00
1f1a7708af Update build-rules.md (#2355)
Fixes #1837.
2024-09-11 10:37:24 -07:00
53845ffcaf Avoid [T] in slices title (#2358)
There is a problem in how we generate the segment tables: we use the
`Chapter::name` field as given to us from `mdbook`. The problem is that
this string is stripped from formatting:

    Slices: `&[T]`

becomes

    Slices: &[T]

The string now looks like a reference link, but of course there is no
definition of the `T` link:

    warning: Potential incomplete link
      ┌─ references.md:9:12
      │
    9 │ | Slices: &[T] | 10 minutes |
      │            ^^^ Did you forget to define a URL for `T`?
      │
= hint: declare the link's URL. For example: `[T]: http://example.com/`

For now, I will simply take out the reference. This also makes the
titles more uniform in this segment: we don’t add `&T` or `&mut T` to
the other slide titles.
2024-09-10 22:11:09 +02:00
b3adc3b09a Clarify Fn traits slide (#2333)
Improve naming and always capture something in our closures; explain
other details/variations in speaker notes.

Fixes #2251.
2024-09-08 15:49:54 +02:00
45f869902b Clarify and fix grammatical errors (#2347)
Fix minor grammatical errors in Day 1: Morning.

Speaker notes 6.5: "the `-> ()` return type" changed to "the return
type".

The compiler will infer the unit type for any type omitted.
2024-09-04 18:54:14 +00:00
c223257016 Clarify how MutexGuard is 'thread-safe' (avoiding the vague term) (#2336)
Fixes the last outstanding point of #1640.
2024-09-03 09:43:00 -04:00
345e782bdd testing: fix cfg(never) warning (#2334)
See <https://doc.rust-lang.org/nightly/rustc/check-cfg.html>.
2024-09-03 09:42:42 -04:00
cab287849b fix an error in hashmap.md (#2339)
There is a small syntax error.
2024-09-03 09:42:12 -04:00
30ae1f4f0d Add "associated type" to glossary (#2331)
# Why
For example, while reading [this
line](3269cb9e4c/src/std-traits/operators.md (L39)),
a user may want to quickly look up what an "associated type" is.

This also helps with translations. In Vietnamese, there isn't a good
translation for this term, so keeping the original term and providing a
description of it in the glossary would be very helpful.
2024-09-02 15:32:48 +00:00
5615b996aa cargo: bump tokio from 1.39.3 to 1.40.0 in the minor group (#2343)
Bumps the minor group with 1 update:
[tokio](https://github.com/tokio-rs/tokio).

Updates `tokio` from 1.39.3 to 1.40.0

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-02 10:07:21 +01:00
44bd72fa34 cargo: bump cc from 1.1.14 to 1.1.15 in /src/exercises/bare-metal/rtc in the patch group (#2341)
Bumps the patch group in /src/exercises/bare-metal/rtc with 1 update:
[cc](https://github.com/rust-lang/cc-rs).

Updates `cc` from 1.1.14 to 1.1.15

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-02 10:06:07 +01:00
3ff1061c5f cargo: bump cc from 1.1.14 to 1.1.15 in /src/bare-metal/aps/examples in the patch group (#2340)
Bumps the patch group in /src/bare-metal/aps/examples with 1 update:
[cc](https://github.com/rust-lang/cc-rs).

Updates `cc` from 1.1.14 to 1.1.15
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/rust-lang/cc-rs/releases">cc's
releases</a>.</em></p>
<blockquote>
<h2>cc-v1.1.15</h2>
<h3>Other</h3>
<ul>
<li>Add -mfloat-abi=hard as a default argument when using any
arm/thumb-none-eabihf target (<a
href="https://redirect.github.com/rust-lang/cc-rs/pull/1194">#1194</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/rust-lang/cc-rs/blob/main/CHANGELOG.md">cc's
changelog</a>.</em></p>
<blockquote>
<h2><a
href="https://github.com/rust-lang/cc-rs/compare/cc-v1.1.14...cc-v1.1.15">1.1.15</a>
- 2024-08-26</h2>
<h3>Other</h3>
<ul>
<li>Add -mfloat-abi=hard as a default argument when using any
arm/thumb-none-eabihf target (<a
href="https://redirect.github.com/rust-lang/cc-rs/pull/1194">#1194</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="41535f6dc9"><code>41535f6</code></a>
chore: release (<a
href="https://redirect.github.com/rust-lang/cc-rs/issues/1195">#1195</a>)</li>
<li><a
href="ad5d37b7ea"><code>ad5d37b</code></a>
Add -mfloat-abi=hard as a default argument when using any
arm/thumb-none-eabi...</li>
<li>See full diff in <a
href="https://github.com/rust-lang/cc-rs/compare/cc-v1.1.14...cc-v1.1.15">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=cc&package-manager=cargo&previous-version=1.1.14&new-version=1.1.15)](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>
2024-09-02 10:05:28 +01:00
6c0204fd50 Added tests and implementation for I32(float) for Exercise: Protobuf Parsing (#2302)
Update for Exercise: Protobuf Parsing

* Include tests in the solution
* Remove implementatinon of wire type I32, but leave it as a "more-to-explore" extension
2024-08-28 13:22:59 -04:00
92c890f287 Update lifetimes/exercise.rs (#2326)
Rename `as_string()` to `as_str()`. We are returning a `&str` not
`String`. The latter name is also more idomatic and widely used.
2024-08-28 06:52:45 +00:00
d45ec368ef Update approaches.md (#2317)
I might be missing something, but RAII is generally associated with
programming languages with manual memory management (prominently with
C++, where it originated), so I think it is not very appropriate to have
it mentioned here.
2024-08-27 15:57:52 +00:00
dc7ba17421 cargo: bump the patch group with 4 updates (#2316)
Bumps the patch group with 4 updates:
[serde](https://github.com/serde-rs/serde),
[serde_json](https://github.com/serde-rs/json),
[fantoccini](https://github.com/jonhoo/fantoccini) and
[reqwest](https://github.com/seanmonstar/reqwest).
2024-08-26 09:43:35 -04:00
ba5090dc82 cargo: bump cc from 1.1.13 to 1.1.14 in /src/bare-metal/aps/examples in the patch group (#2314)
Bumps the patch group in /src/bare-metal/aps/examples with 1 update:
[cc](https://github.com/rust-lang/cc-rs).
2024-08-26 09:41:05 -04:00
815f718a0b cargo: bump cc from 1.1.13 to 1.1.14 in /src/exercises/bare-metal/rtc in the patch group (#2318)
Bumps the patch group in /src/exercises/bare-metal/rtc with 1 update:
[cc](https://github.com/rust-lang/cc-rs).
2024-08-26 09:34:26 -04:00
26979c9542 Move const before static (#2305)
Motivation:
* const usecases are likely more familiar than static usecases
* currently the static slide refers `const`, before it's introduced

Background: static and const were previously on the same slide, with
const being introduced first (
https://github.com/google/comprehensive-rust/pull/1881 ) but when they
were split, static was moved first.
2024-08-23 18:48:57 +00:00
3edec36fab add Farsi to Incomplete Translations (#2269) 2024-08-21 07:58:09 +00:00
958bfe58c5 Update shared.md (#2292) 2024-08-21 06:34:08 +00:00
590a88fc3d update break-continue.md (#2287)
Move the speak note about "loop" into the page which we actually talk
about "loop". Also update the wording to make it more accurate.

---------

Co-authored-by: Jason Lin <lxj@google.com>
2024-08-21 06:33:50 +00:00
3ecf12123b cargo: bump the minor group with 2 updates (#2290)
Bumps the minor group with 2 updates:
[pulldown-cmark](https://github.com/raphlinus/pulldown-cmark) and
[googletest](https://github.com/google/googletest-rust).
2024-08-20 16:46:56 +01:00
aa0201ccfd interior-mutability.md: swap Cell/RefCell order and improve explanation (#2278)
Fixes #2249.
2024-08-20 11:26:23 -04:00
4012e2a883 Update if.md (#2286)
The original phrasing may imply that you have to always terminated a
`if` expression with `;`. But the real reason that we have to do that is
because we are using it in a `let` statement here, and `let` statement
has to be terminated by `;`

---------

Co-authored-by: Martin Geisler <martin@geisler.net>
2024-08-20 08:15:39 +00:00
127202d591 Update trait-bounds.md (#2295)
We are going to talk about `impl Trait` in the very next slide. Let's
don't duplicate it here and complicate the flow?
2024-08-20 08:08:32 +00:00
56ae649097 cargo: bump the patch group with 6 updates (#2291)
Bumps the patch group with 6 updates:

| Package | From | To |
| --- | --- | --- |
| [clap](https://github.com/clap-rs/clap) | `4.5.15` | `4.5.16` |
| [serde](https://github.com/serde-rs/serde) | `1.0.206` | `1.0.208` |
| [serde_json](https://github.com/serde-rs/json) | `1.0.124` | `1.0.125`
|
| [tokio](https://github.com/tokio-rs/tokio) | `1.39.2` | `1.39.3` |
| [cxx](https://github.com/dtolnay/cxx) | `1.0.124` | `1.0.126` |
| [cxx-build](https://github.com/dtolnay/cxx) | `1.0.124` | `1.0.126` |

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-19 12:14:42 +01:00
64bf5534f7 cargo: bump cc from 1.1.10 to 1.1.13 in /src/bare-metal/aps/examples in the patch group (#2289)
Bumps the patch group in /src/bare-metal/aps/examples with 1 update:
[cc](https://github.com/rust-lang/cc-rs).

Updates `cc` from 1.1.10 to 1.1.13

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-19 12:12:43 +01:00
82c97a091a cargo: bump cc from 1.1.10 to 1.1.13 in /src/exercises/bare-metal/rtc in the patch group (#2288)
Bumps the patch group in /src/exercises/bare-metal/rtc with 1 update:
[cc](https://github.com/rust-lang/cc-rs).

Updates `cc` from 1.1.10 to 1.1.13

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-19 12:12:25 +01:00
dfd08ebf93 concurrency: avoid 1.. loops (#2280)
Fixes #2060. Note that this does not change the "blocking executor"
example because on that slide it is worthwhile to sleep for 1 * 10ms on
the first iteration and so on. But we shouldn't use one-indexed
inclusive loops when the only significant feature of the loop is its
iteration count.
2024-08-13 14:38:22 +00:00
e9fce0417e box.md: clarify that box provides needed indirection (#2283)
The last to-do for #64.
2024-08-13 14:29:11 +00:00
3b349d830c from-and-into.md: mention losslessness and infallibility (#2281)
Fixes #2069.
2024-08-13 14:28:22 +00:00
991bd8ceb7 threads: do not refer to "daemon" threads (#2282)
This is the last remaining fix left from #63.
2024-08-13 14:28:08 +00:00