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

2327 Commits

Author SHA1 Message Date
76e2cfe53e Revert "Upgrade mdbook-pandoc to fix missing images in PDFs" (#2540)
Reverts google/comprehensive-rust#2531

This accidentally broke the build because the Persian translation
doesn't build with this version.
2025-01-05 11:15:20 -05:00
8173e5fd74 cargo: bump the minor group with 3 updates (#2534)
Bumps the minor group with 3 updates:
[tokio](https://github.com/tokio-rs/tokio),
[scraper](https://github.com/causal-agent/scraper) and
[http](https://github.com/hyperium/http).

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-02 08:52:58 +00:00
d4cc29ff0e Upgrade mdbook-pandoc to fix missing images in PDFs (#2531)
[`mdbook-pandoc`
0.8](https://github.com/max-heller/mdbook-pandoc/releases/tag/v0.8.0)
now supports `<img>` elements in raw HTML, fixing a few missing images
in the PDF versions of the course.
2025-01-02 08:52:42 +00:00
549391119b cargo: bump the patch group in /src/exercises/bare-metal/rtc with 2 updates (#2533)
Bumps the patch group in /src/exercises/bare-metal/rtc with 2 updates:
[chrono](https://github.com/chronotope/chrono) and
[cc](https://github.com/rust-lang/cc-rs).

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-02 09:52:09 +01:00
2c8786b392 cargo: bump cc from 1.2.2 to 1.2.6 in /src/bare-metal/aps/examples in the patch group (#2532)
Bumps the patch group in /src/bare-metal/aps/examples with 1 update:
[cc](https://github.com/rust-lang/cc-rs).

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-02 09:51:42 +01:00
ac7c0506fd Fix typo: build-essential, not build-essentials (#2527) 2025-01-02 09:41:16 +01:00
a0ef82ef7c cargo: bump the patch group with 12 updates (#2535)
Bumps the patch group with 12 updates:

| Package | From | To |
| --- | --- | --- |
| [anyhow](https://github.com/dtolnay/anyhow) | `1.0.93` | `1.0.95` |
| [clap](https://github.com/clap-rs/clap) | `4.5.21` | `4.5.23` |
| [serde](https://github.com/serde-rs/serde) | `1.0.215` | `1.0.217` |
| [serde_json](https://github.com/serde-rs/json) | `1.0.133` | `1.0.134`
|
| [fantoccini](https://github.com/jonhoo/fantoccini) | `0.21.2` |
`0.21.3` |
| [glob](https://github.com/rust-lang/glob) | `0.3.1` | `0.3.2` |
| [tokio-util](https://github.com/tokio-rs/tokio) | `0.7.12` | `0.7.13`
|
| [zerocopy](https://github.com/google/zerocopy) | `0.8.11` | `0.8.14` |
| [thiserror](https://github.com/dtolnay/thiserror) | `2.0.3` | `2.0.9`
|
| [reqwest](https://github.com/seanmonstar/reqwest) | `0.12.9` |
`0.12.12` |
| [cxx](https://github.com/dtolnay/cxx) | `1.0.133` | `1.0.136` |
| [cxx-build](https://github.com/dtolnay/cxx) | `1.0.133` | `1.0.136` |

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-02 09:35:25 +01:00
3ffd55ca52 Bump crate-ci/typos from 1.28.1 to 1.29.0 (#2536)
Bumps [crate-ci/typos](https://github.com/crate-ci/typos) from 1.28.1 to
1.29.0.

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-02 09:34:59 +01:00
665300e373 Update Chromium Rust policy (#2530)
Co-authored-by: Dustin J. Mitchell <djmitche@google.com>
2024-12-28 21:08:34 +00:00
7f0c591b0b Rework iterator section (#2523) 2024-12-17 15:59:39 -08:00
e902b1ef60 Add a slide on match to control flow section (#2515) 2024-12-17 12:08:42 -08:00
2ff30edd93 Improve dangling reference example and move to its own slide (#2518)
The current example demonstrating how rustc prevents dangling references
is really gross and hard to read (my own fault lol, I wrote that
example). I finally realized that there's a much simpler, easier to read
way of expressing the same thing. I also moved this to its own slide
after the reference slides so that we can call it out as an early
example of the borrow checker. I then call back to this example in the
borrow checker slide to remind students that the aliasing rule isn't the
only thing the borrow checker is enforcing.
2024-12-17 14:44:33 -05:00
5bf04964f6 Fix the unit testing docs referring to integration tests (#2524)
The side bar is out of date, and also the the unit testing docs are
talking about integration tests. These tests are discussed on the next
slide in "Other Types of Tests".
2024-12-17 17:37:11 +00:00
fe554251cb Reframe FromIterator slide to focus on collect (#2516) 2024-12-16 14:37:02 -08:00
4663ec838e Rework the error handling exercise to be based on the expression evaluator exercise (#2521) 2024-12-16 14:36:35 -08:00
644f849bf8 Add speaker notes to bindgen slides (#2491)
Part of #1083.
2024-12-16 16:54:13 -05:00
dad8cadc6b Add speaker notes to Android build rules (#2492)
Part of #1083.
2024-12-16 16:54:04 -05:00
64bd331314 Add speaker notes to interop with C slides (#2496)
Part of #1083.
2024-12-16 16:53:54 -05:00
2bae363d16 Remove error handling from expression evaluation exercise (#2517)
I think it would be good to simplify the expression evaluation exercise
by removing the error handling around the divide-by-zero case. I think
it overcomplicates the exercise and and adds confusion since at this
point we haven't introduced `Result` (or at least not in any detail).
This allows the students to just focus on writing the pattern matches on
`Expression` and `Op`, and allows the exercise to be shorter (and I
think we need to free up some time where we can, my classes often run
long and cut into how much time students have for exercises).
2024-12-16 16:36:27 -05:00
f60513ebe2 Add a slide about struct visibility and encapsulation (#2522)
The current slide on visibility introduces the idea that modules are the
encapsulation boundary, but it doesn't explicitly doesn't talk about
struct fields/methods. I think it's worth talking explicitly about
structs and encapsulation because most students are going to be coming
from a background where types (instead of modules) are the encapsulation
boundary. It's worth talking explicitly about how encapsulation works,
even if we're kind of repeating information from the previous slide.
2024-12-16 16:34:40 -05:00
2e8d5d3d9c Use .iter() instead of (&values).into_iter() (#2519)
The `(&values).into_iter()` construct used in the solution to the
iterators exercise is kind of awkward and always gets questions from
students. I think the better thing would be to use the `iter` method to
get the initial iterator, as that's the more idiomatic way to. It's also
an opportunity to point out that there are helper methods for getting an
iterator for a collection.
2024-12-16 15:22:44 -05:00
c33a9b2ca4 Better demonstrate imports in modules exercise (#2514)
The solution to the modules exercise changes how `Button`, `Window`, and
`Label` are referenced, adding a `widgets::` prefix to them. This seems
weird to me because the more idiomatic thing to do would be to import
those types at the top of the file. Unless I'm missing a reason why the
solutions is written the way it is, I think this is a good
simplification.
2024-12-16 11:42:22 -05:00
999490fae4 book.js: early return if response error (#2520)
It used to have a ugly error message shows that "Playground
Communication: Cannot read properties of undefined (reading 'trim')",
which is due to the fact that the response lacks stdout attr.

Issue: #2477

Signed-off-by: Alx-Lai <alexabc722@gmail.com>
2024-12-16 09:42:52 -05:00
de8ae4fe08 Remove the phrase "third-party" (#2512)
"Third-party" is a Googleism that doesn't make much sense otherwise.
Most references to crates just say "crate", implying that they are
open-source packages available on https://crates.io, so this updates a
few additional locations to do the same.
2024-12-13 09:33:58 +00:00
fbeef48c50 Fix example from zerocopy. (#2511)
This was changed incorrectly in #2434.

Fixes #2472.
2024-12-13 10:17:37 +01:00
699cceadef Set the correct element type in vector (#2500) 2024-12-12 15:02:54 +00:00
d7ed1944c2 Changes to do bare-metal from chromebook (#2510)
On my chromebook:
 * I needed build-essentials to install cc
* I needed to enable sharing the USB device with linux. This instruction
was from a support.google.com article so well-known but not obvious.

---------

Co-authored-by: Martin Geisler <martin@geisler.net>
2024-12-11 21:49:46 +00:00
d686ab83cf uk: Fix failing test case (#2506)
Fix one failing test case introduced by
https://github.com/google/comprehensive-rust/pull/2490

Signed-off-by: Andriy Redko <drreta@gmail.com>
2024-12-09 04:47:04 -05:00
b2576cec2e ja: update summary translations (#2474)
Update translations from SUMMARY.md.

Unfortunately, poedit changes the wrapping length of the po files and I
could not get it back by changing the poedit setting for line length. I
believe we won't get any more of these noisy diffs for my further
changes this week.

`Cancellation` is the last item I modified in this PR.

---------

Co-authored-by: Hidenori Kobayashi <hidenorik@google.com>
2024-12-09 09:09:06 +09:00
5d6e26ac10 Add missing docstring to birthday server implementation (#2464)
Without this, compilation fails. The comment *is* in the included Rust
file — but we only include a fraction of the file to keep the example
short. This makes it cumbersome to both show something that works in the
slides while also making it possible for the instructor to show more
complex examples.

@randomPoison, we need to make our examples simpler here: the complexity
here makes it hard to modify the files and I feel it's hard to show
during class. I would suggest splitting this up into a very basic
example (what the birthday service was) and then add 1-2 slides with
more complex samples (if necessary). Last I taught the class, I had a
hard time a) making every example compile and b) finding time to cover
everything.

I would err on the side of makings things simple and clear.
2024-12-06 12:10:42 -08:00
8f1c8679a4 uk: Refresh translations (#2490)
uk: Refresh translations:

```
$ mdbook build
$ msgmerge --update po/uk.po book/xgettext/messages.pot
```

---------

Signed-off-by: Andriy Redko <drreta@gmail.com>
2024-12-06 16:53:29 +00:00
380dc3c29c Add speaker notes to some concurrency pages (#2501)
Part of #1083.
2024-12-06 09:03:03 -05:00
e0fa410f93 Link README files together (#2504) 2024-12-06 09:00:25 -05:00
5f2248bb92 Add "Execution: Add stderr block" again (#2503)
Reverts google/comprehensive-rust#2479, which is a revert of #2397.

I think the problem was not related to @Alx-Lai's change, the
[Playground was
slow](https://rust-lang.zulipchat.com/#narrow/channel/242791-t-infra/topic/playground.20incident.202024-12-03)
for everyone.
2024-12-06 14:21:44 +01:00
be476391f2 Add speaker notes to flow control basics (#2498)
Part of #1083.
2024-12-06 12:46:35 +01:00
e4e6b0ce1d Add speaker notes to AIDL slide (#2494)
Part of #1083.
2024-12-05 15:59:21 -08:00
54e0eab236 Add speaker notes to JNI slide (#2495)
Part of #1083.
2024-12-05 12:30:03 -05:00
69d4fc13a4 Delete empty and unused slide (#2493)
The page is not mentioned in the `SUMMARY.md` file and has apparently
been forgotten.

We could consider adding a check for this situation, but since I don't
think it occurs very often, I don't consider it high priority.
2024-12-05 10:25:21 -05:00
d97a8fade5 Add speaker notes to the thanks page (#2497)
Part of #1083.
2024-12-05 15:24:18 +00:00
99c0948f4e Add more description of proto to the proto exercise (#2475)
This also moves the test cases into `main` so they are visible.

Fixes #2466.
2024-12-05 16:17:14 +01:00
c61204ae18 Add speaker notes to tuples and arrays (#2499)
Part of #1083.
2024-12-05 16:15:03 +01:00
48b2b5c312 Add a test framework to test the JS part of the course (#2471)
This is a first draft for a test framework for testing the JS part of
the book that is discussed in #2462

It is using [webdriverIO](https://webdriver.io/) and the webdriverIO
[Expect API](https://webdriver.io/docs/api/expect-webdriverio/) in
combination with [Mocha](https://mochajs.org/). WebdriverIO is taking
care of accessing the webpage with a real browser and can access the
state of the page so behavior can be asserted.

Currently only a small test for the speaker-notes implementation demos
the functionality.

The [Static Server
Service](https://webdriver.io/docs/static-server-service/) is used to
serve the book in a way that the test runner can access it.

A CI integration can look like https://webdriver.io/docs/githubactions/
and is implemented with a headless setup. In CI it uses the language
variable to set environment variable that configures where the built
book should be mounted from

---------

Co-authored-by: Martin Geisler <martin@geisler.net>
2024-12-04 09:06:58 +00:00
d868584623 Show path to auto-generate AIDL code on slide (#2417)
This updates the surrounding text to bring it in line with the other
slides.
2024-12-03 17:01:55 +01:00
45bb2de220 Recommend newtypes over type aliases (#2476)
I don't know how controversial this is, but I would recommend against
using type aliases where a newtype can be used instead.

Personally, I don't like type aliases much since I feel they cause extra
indirection: I will inevitably have to go look up the alias the first
many times I encounter it. Nothing will tell me to apply the type alias
consistently, and I dislike having multiple names for the same thing.

But I'm sure some people love them, so now I'm just gently reminding
people that newtypes can be a better alternative.
2024-12-03 16:57:41 +01:00
c85816a01f cargo: bump the patch group across 1 directory with 12 updates (#2489)
Bumps the patch group with 12 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [anyhow](https://github.com/dtolnay/anyhow) | `1.0.91` | `1.0.93` |
| [clap](https://github.com/clap-rs/clap) | `4.5.20` | `4.5.21` |
| [mdbook](https://github.com/rust-lang/mdBook) | `0.4.40` | `0.4.43` |
| [serde](https://github.com/serde-rs/serde) | `1.0.214` | `1.0.215` |
| [serde_json](https://github.com/serde-rs/json) | `1.0.132` | `1.0.133`
|
| [csv](https://github.com/BurntSushi/rust-csv) | `1.3.0` | `1.3.1` |
| [tokio](https://github.com/tokio-rs/tokio) | `1.41.0` | `1.41.1` |
| [url](https://github.com/servo/rust-url) | `2.5.2` | `2.5.4` |
| [mockall](https://github.com/asomers/mockall) | `0.13.0` | `0.13.1` |
| [zerocopy](https://github.com/google/zerocopy) | `0.8.8` | `0.8.11` |
| [cxx](https://github.com/dtolnay/cxx) | `1.0.129` | `1.0.133` |
| [cxx-build](https://github.com/dtolnay/cxx) | `1.0.129` | `1.0.133` |

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-01 21:05:18 +00:00
5586f6c9af cargo: bump thiserror from 1.0.66 to 2.0.3 (#2488)
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.66 to
2.0.3.

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-01 20:51:03 +00:00
3eb2eb8b36 cargo: bump the minor group with 2 updates (#2486)
Bumps the minor group with 2 updates:
[googletest](https://github.com/google/googletest-rust) 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>
2024-12-01 20:41:54 +00:00
bf8e642bcf build(deps): bump crate-ci/typos from 1.26.8 to 1.28.1 (#2485)
Bumps [crate-ci/typos](https://github.com/crate-ci/typos) from 1.26.8 to
1.28.1.

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-01 20:41:39 +00:00
6c09359640 cargo: bump arm-gic from 0.1.1 to 0.1.2 in /src/exercises/bare-metal/rtc in the patch group (#2484)
Bumps the patch group in /src/exercises/bare-metal/rtc with 1 update:
[arm-gic](https://github.com/google/arm-gic).

Updates `arm-gic` from 0.1.1 to 0.1.2

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-01 20:41:24 +00:00
6ef4d79984 cargo: bump cc from 1.1.31 to 1.2.2 in /src/exercises/bare-metal/rtc in the minor group (#2483)
Bumps the minor group in /src/exercises/bare-metal/rtc with 1 update:
[cc](https://github.com/rust-lang/cc-rs).

Updates `cc` from 1.1.31 to 1.2.2

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-01 20:40:50 +00:00