1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-04-22 23:58:39 +02:00

2290 Commits

Author SHA1 Message Date
Nicole L
526dddce72
Add speaker note about for and array refs (#2665) 2025-02-28 10:31:15 -08:00
Nicole L
a4469e7a91
Add division example to expression exercise (#2673) 2025-02-28 10:30:54 -08:00
michael-kerscher
f22395d278
Fix bug where speaker notes are not connected to regular window (#2675)
Fixes bug #2004.
Refactored the communication between the speaker notes window and the
regular window by using a Broadcast channel - this is now
self-recovering(!) even if speaker notes are closed and manually
re-opened!

For better readability and maintainability refactored some string-based
states into enum style code and refactored detection of the type of
windows (print, speaker note, regular window)

Manually tested the new code and the speaker notes window does not
disconnect from the regular window anymore.
This now works way more reliable, even if there are (still) some UI
glitches that have been there before already.
2025-02-28 12:06:06 -05:00
Martin Geisler
0134568034
Bump dprint plugins to their latest versions (#2402) 2025-02-28 14:27:17 +00:00
kweber
f94a0398f0
de: Refresh the German translation (#2575)
Inhaltsverzeichnis, Kurszeiten un Übersetzungen aktualisiert
2025-02-28 14:15:46 +00:00
Aliet Expósito García
ca1700d283
es: Fix typo (#2619)
Fix typo in `es.po`.
Arreglo de error ortográfico en `es.po`.
2025-02-28 14:09:47 +00:00
Nicole L
fd6d4807a0
Add speaker note about reference equality (#2670) 2025-02-27 16:35:48 -08:00
Nicole L
5ab6fae9e9
Suppress warnings for elevator exercise (#2668) 2025-02-27 12:33:06 -08:00
Nicole L
8b04a6dcb0
Split complex enum initialization (#2667) 2025-02-27 12:32:28 -08:00
Nicole L
fdb0a398b1
Add note about struct field defaults (#2666) 2025-02-27 12:31:56 -08:00
Nicole L
df57606996
Use explicit range when slicing into string (#2664) 2025-02-27 12:29:44 -08:00
Nicole L
b4301e06c4
Add note that slices can't grow (#2663) 2025-02-27 12:29:03 -08:00
Nicole L
bf4e4e34ee
Change array initialization syntax (#2662) 2025-02-27 12:27:43 -08:00
Nicole L
0134c25df9
Add a note mentioning that semicolons exist (#2660) 2025-02-27 12:26:36 -08:00
Eric Githinji
ea53e3c935
Use dbg! instead of println! in day 3 & 4. (#2669)
Part of #2478 to clean up code blocks when all that is needed is a
trivial debug print statement.

Co-authored-by: Eric Githinji <egithinji@google.com>
2025-02-27 18:46:55 +00:00
Nicole L
241c28ed7e
Move unreachable! to speaker notes (#2628) 2025-02-26 12:22:13 -08:00
Nicole L
d7a88211ff
Update AIDL intermediates path (#2639)
---------

Co-authored-by: Martin Geisler <mgeisler@google.com>
2025-02-26 17:28:11 +00:00
Nicole L
e52f5ea9e3
Fix vendored crates path (#2638) 2025-02-26 09:17:49 -08:00
Nicole L
32a16c95dc
Add note about AIDL methods taking &self (#2641) 2025-02-26 09:17:22 -08:00
Nicole L
5f6b9333fa
Add Android.bp entries for googletest and mockall example tests (#2643) 2025-02-26 09:11:48 -08:00
Nicole L
4ee2337c63
Add missing static_libs dep for libbirthday example (#2640) 2025-02-26 09:07:36 -08:00
Nicole L
7f8596e9bc
Use jni_libs for JNI dependency (#2637) 2025-02-26 09:06:09 -08:00
Nicole L
a10b4e6e21
Reorder CXX build steps to show genrules first (#2642) 2025-02-26 09:05:36 -08:00
Dustin J. Mitchell
08c613326a
Remove confusing speaker note from Shared-References slide (#2659)
Dangling references are discussed later in the "Borrowing" segment.

Fixes #2656
2025-02-26 11:48:54 -05:00
Eric Githinji
1a64c9ba9a
Use dbg! instead of println! in Day 2. (#2657)
Part of #2478 to clean up code blocks when all that is needed is a
trivial debug print statement.

As mentioned in previous related PRs, in some places I've opted to
retain the use of println! because dbg! makes it less readable.

Co-authored-by: Eric Githinji <egithinji@google.com>
2025-02-25 21:12:06 +00:00
scubed2
32a8b4bf13
Use chopsticks and limit philosophers. (#2655)
Use chopstick to explain why 2 are needed to eat.
Limit async to 2 philosophers so they can deadlock in tokio.
(Tested with [3, 4, 5] philosophers and they all were able to run
without deadlock
with lock ordering disabled.)

---------

Co-authored-by: Sterling Stein <scubed2+git@gmail.com>
2025-02-24 16:13:16 +00:00
Eric Githinji
f531d4dfd7
Use dbg! instead of println! in Day 1 aft session (#2654)
Part of #2478 to clean up code blocks when all that is needed is a
trivial debug print statement.

In certain slides (8.1, 9.2, 9.3, 10.5) I've opted to retain the use of
println! because dbg! makes it less readable. The
dbg! macro uses pretty-printing by default and this results in a simple
array such as the one in 8.1 being printed vertically instead of a
cleaner one-liner.

Co-authored-by: Eric Githinji <egithinji@google.com>
2025-02-24 14:13:43 +00:00
Eric Githinji
0daab179e9
Use dbg! instead of println! in Day 1 mng session (#2652)
As mentioned in #2478, this cleans up the code blocks when all that is
needed is a trivial debug print statement.
Only making changes to Day 1 morning session so that I can get feedback
before proceeding with the rest of the course.

---------

Co-authored-by: Eric Githinji <egithinji@google.com>
2025-02-24 14:12:56 +00:00
Eric Githinji
49e4efcd9e
Split C interop slides into smaller slides. (#2645) 2025-02-22 19:48:10 +00:00
Dustin J. Mitchell
63d716de90
Preserve line numbers by not injecting a newline (#2653)
The `dbg!` macro, being deployed more widely in #2478, shows the line
number. But if we inject `#![allow(..)]\n` then the printed numbers do
not match those in the textarea. It turns out that `\n` is not required!

cc @egithinji
2025-02-21 15:32:31 -05:00
Frances Wingerter
63cc474ba0
closures/exercise.rs: drop trait bounds from struct definition (#2649)
This is more idiomatic than what we had before.

We keep the trait bounds for the inherent impl, because the new method
can use them to guide inference of unannotated closure arguments.
2025-02-20 21:51:39 +00:00
Frances Wingerter
e16dc70903
Clarify and correct closure syntax slide (#2647)
Simplify the example, adding demonstration of return type annotation and
removing confusing "lambda" reference from speaker notes.
2025-02-20 21:50:38 +00:00
Frances Wingerter
4f8b09009a
drop: avoid confusing names (#2648)
The Droppables are already named with letters, so hopefully referencing
the nesting order of blocks instead of giving them names is clearer.
2025-02-20 20:21:32 +00:00
Dustin J. Mitchell
44a79741ff
Be more consistent about tests vs. main (#2644)
The content slides all use `fn main`, with the exception of the testing
segment. But with this change, where it makes sense exercises use tests
instead, and not both tests and `fn main`.

A small change in `book.js` supports running tests when a code sample
does not have `fn main` but does have `#[test]`, so these work
naturally.

Fixes #1581.
2025-02-18 20:13:16 +00:00
Nicole L
699c5137c7
Remove nesting from let else example (#2600) 2025-02-11 10:45:04 -08:00
Nicole L
d732821edb
Fix note about undefined behavior (#2632) 2025-02-11 10:41:33 -08:00
Nicole L
d998022f75
Move use statements to beginning of widgets.rs (#2631) 2025-02-11 10:41:11 -08:00
michael-kerscher
cdfe3e7359
Fix bug in speaker notes that broke navigating to next slide (#2634)
Change this selector to use the ~= selector to test if a white space
separated word "prev" or "next" is contained

Fixes a speaker notes bug that did not allow going to the next slide in
the speaker notes.
The reason for that is that the "rel" attribute contained "prev"
respective "next prefetch".

See:
https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors#attrvalue_2

This fixes part of #2004 when going to the right (containing
"prefetch").
2025-02-08 11:47:02 +01:00
Nicole L
f9aca3738a
Reorganize borrowck notes and add note about re-borrowing (#2635)
The speaker notes on the borrowck slide are a bit hard to read since
it's a big block of bulleted points. I've reorganized the notes to be a
bit easier to read by making some of the bullet points nested and by
moving some of the points to the "More to Explore" section. I've also
added a note on re-borrowing since students sometimes ask about it, and
I've added some playground links to demonstrate some of the points.
2025-02-07 17:05:27 -05:00
Nicole L
386757e697
Add note that borrock error can be triggered by direct mutation (#2629) 2025-02-07 11:15:00 -08:00
Nicole L
d603faca56
Add link to GridRefIter example (#2633) 2025-02-07 11:04:32 -08:00
Nicole L
c05f0b6f02
Add main method to code snippet (#2630)
The code snippet wouldn't compile/run directly because of a missing
`main` method.

Also remove unnecessary `&`.
2025-02-07 10:08:10 +01:00
michael-kerscher
af6dff53c2
update to mdbook-0.4.44 and sync book.js and index.hbs (#2610)
mdbook in CI pipeline is updated to mdbook-0.4.44
  - reran mdbook init --theme
  - keep playground improvements
- keep language selector and suggest edit / edit to translation button
text
  - improvement: toc is in separate js file, makes html file way smaller
  - additionally updated to mdbook-i18n-helpers-0.3.5

relevant upstream changes that are used:
- https://github.com/rust-lang/mdBook/pull/2414
- https://github.com/rust-lang/mdBook/pull/2421
- https://github.com/rust-lang/mdBook/pull/2454
- https://github.com/rust-lang/mdBook/pull/2463
2025-02-07 10:07:41 +01:00
Nicole L
f1459c54e1
Remove slide on shadowing (#2596) 2025-02-06 12:39:27 -08:00
Nicole L
72c7618cb4
Replace unimplemented with todo (#2594) 2025-02-06 12:35:28 -08:00
Nicole L
3229fc7c05
Fix tyop in speaker notes (#2627) 2025-02-06 11:01:19 -08:00
Nicole L
06bdb40442
Make code in expression evaluation exercise editable (#2601) 2025-02-06 11:00:46 -08:00
Nicole L
6a25d7be04
Minor whitespace changes (#2595) 2025-02-06 09:52:29 -08:00
Nicole L
e1ed6eaf47
Move struct update syntax to speaker notes (#2597) 2025-02-06 09:51:43 -08:00
Nicole L
ca137b4807
Move slide on blocks to beginning of control flow section (#2598) 2025-02-06 09:29:44 -08:00