1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-01-10 00:44:21 +02:00
Commit Graph

1898 Commits

Author SHA1 Message Date
Jean Carlo Vicelli
c6ef83e512
Update exercise to add also the tests, in a TDD style (#1832)
Having the tests only in the result brings less value, so the
participants can do it following TDD practices
2024-02-20 17:04:53 -05:00
Dustin J. Mitchell
95fce416ce
Expand Traits, add associated types (#1815)
This breaks the "Traits" slide into three smaller sub-slides. It also
addresses part of #1511 by explicitly addressing associated types.

---------

Co-authored-by: Martin Geisler <martin@geisler.net>
2024-02-20 11:41:53 -05:00
Jean Carlo Vicelli
9d63f23f1d
Change hardcoded vector update to a for loop (#1833)
iterating over the vector instead of hardcoding each item

---------

Co-authored-by: Martin Geisler <mgeisler@google.com>
2024-02-20 17:29:49 +01:00
titong0
8344cbc273
Add missing editable attribute to exercise (#1827)
I was reading the docs and I stumbled upon this.

I'm unsure about when exercises should be solved directly on the site
and when they should be copied and pasted into a playground. But since
the previous chapter's exercise is solvable in the site [(fibonacci
sequence)](0cb7f496b5/src/types-and-values/exercise.md (L15)),

I figured this one might be missing the attribute. Anyway amazing work
on the docs!
2024-02-20 16:12:55 +00:00
Dustin J. Mitchell
152354e9c9
Put a header on schedule comments (#1814)
This will add a little more context. See the current result in
https://github.com/google/comprehensive-rust/pull/1813.
2024-02-20 09:19:14 -05:00
Gergely Risko
d5879d87b2
Reformulate speaker notes regarding Box (#1819)
The first change is to reformulate the English in a way, that
emphasizes, that this is not a decision of the compiler, but the
impossibility of computing an infinite value (e.g. changed the language
from "not compute" to "would not be able to compute").

The second change is to fix the error message, of course the error
message from the compiler is "recursive withOUT indirection", as
"recursive with indirection" is actually what we want.
2024-02-20 09:16:25 -05:00
Henri F
85d2987369
Update translations.md with new Korean contributor (#1823)
Co-authored-by: Martin Geisler <mgeisler@google.com>
2024-02-20 10:50:42 +00:00
AdrienBaudemont
675573f0fa
fr: Updating the first few pages (up to 1.1). (#1778) 2024-02-20 11:42:12 +01:00
Marja Hölttä
f1e4f300ec
Make the "break with label" example more illustrative (#1830)
In the old version, using "break 'outer;" and using "break;" (without
the label) produce the same output.

This version fixes that to make the example more illustrative.

---------

Co-authored-by: Martin Geisler <martin@geisler.net>
2024-02-20 10:06:29 +00:00
Max Heller
8080e2add6
Rendered PDF improvements (#1805)
Updates `mdbook-pandoc` to
[0.5.0](https://github.com/max-heller/mdbook-pandoc/releases/tag/v0.5.0)
to use some new features:
- Table wrapping (closes #1709)
  
The wrapping logic mirror's
[Pandoc's](https://pandoc.org/MANUAL.html#extension-pipe_tables) (i.e.,
compare the relative widths of the `---` columns to determine column
widths) so tables in the source may need tweaking to get the proportions
right
- Replace broken links in PDF with corresponding links to
https://google.github.io/comprehensive-rust/
2024-02-20 11:04:30 +01:00
mobyw
6b805230c7
Add heading attribute to glossary.md (#1829)
Add heading attributes[1] to avoid ID changes in translation.

[1]: https://rust-lang.github.io/mdBook/format/markdown.html#heading-attributes

Related: #1825

---------

Co-authored-by: Martin Geisler <martin@geisler.net>
2024-02-20 10:00:59 +00:00
mobyw
f600b9629b
Fix style in glossary.md (#1825)
`id` of `h1` title in the translated version will be changed to the
translated text.
Fixed `id` configured here will not take effect in the translated
version.

Correct style: https://google.github.io/comprehensive-rust/glossary.html
Wrong style (zh-CN): https://google.github.io/comprehensive-rust/zh-CN/glossary.html
2024-02-19 17:17:41 +01:00
Dustin J. Mitchell
22c9555ca8
Suggest --locked for cargo installs (#1792)
This is already used in the GitHub actions, and avoids issues like those
in #1791.

Fixes #1791.
2024-02-19 17:13:46 +01:00
Andriy Redko
18ec2018d1
uk: Day 3: morning (#1826)
Day 3: morning

Signed-off-by: Andriy Redko <drreta@gmail.com>
2024-02-19 11:29:54 +00:00
dependabot[bot]
0cf4ec1352
cargo: bump the patch group with 1 update (#1828)
Bumps the patch group with 1 update:
[clap](https://github.com/clap-rs/clap).

Updates `clap` from 4.5.0 to 4.5.1

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-19 11:25:19 +00:00
Diego Romero
0cb7f496b5
Translation correction on Update es.po (#1781)
I added a tranlation correction on the line 1287, I change "tres"
instead "cuatro", because "cuatro" is the meaningful of four in Spanish.

---------

Co-authored-by: Henri F <henrif75@users.noreply.github.com>
2024-02-16 10:41:33 -08:00
Martin Geisler
a95201f027
fa: refresh translation for January 2024 (#1751)
This is a clean refresh, requires only a syntaxtical review.

You can skim this PR with the [GitHub CLI](https://cli.github.com/):

```
gh pr diff 1751 | bat -l patch
```
2024-02-16 10:37:53 -08:00
Martin Geisler
ed79a2044e
da: refresh translation for January 2024 (#1742)
This is a clean refresh, requires only a syntactical review.

You can skim this PR with the [GitHub CLI](https://cli.github.com/):

```
gh pr diff 1742 | bat -l patch
```
2024-02-16 10:37:09 -08:00
Diego Romero
8bbcb3e4b9
Translation correction on Update es.po (#1780)
I added a tranlation correction on the line 1287, I change "tres"
instead "cuatro", because "cuatro" is the meaningful of four in Spanish.

---------

Co-authored-by: Henri F <henrif75@users.noreply.github.com>
2024-02-16 10:29:03 -08:00
Manichand Kondapaka
fccdc0d69a
Added blocks and scopes section (#1822) 2024-02-16 13:12:51 -05:00
mobyw
b5b06b5aa9
zh-CN: index & preparation translation (#1800)
The po file has been refreshed. Translation range: L1173-L2241.

https://github.com/google/comprehensive-rust/issues/324

---------

Co-authored-by: Yihao Wang <42559837+AgainstEntropy@users.noreply.github.com>
2024-02-16 09:40:05 -08:00
Gergely Risko
adaa04f961
Change String representation to actual (#1817)
Tested with rust 2015, 2018, 2021 and 2024, on amd64 musl, amd64 glibc
and aarch64 musl, all of them represent Strings with (ptr, capacity,
len).

This is an internal implementation detail, that shouldn't be exposed
anyway, so it's no big deal, but in the speaker notes, we provide a
debugging tool for demonstration purposes, so at least that should have
a correct output.
2024-02-15 17:24:19 -05:00
Manichand Kondapaka
f391e863ab
Added break-continue section. (#1793)
This is a contribution of a break-continue section for Comprehensive
Rust.


![image](https://github.com/google/comprehensive-rust/assets/65899331/e68bf439-bcbd-43c9-88bd-f66470a5956f)

![image](https://github.com/google/comprehensive-rust/assets/65899331/1644a460-8373-4878-b6b9-0ce498e8c95d)

---------

Co-authored-by: Dustin J. Mitchell <dustin@v.igoro.us>
2024-02-15 22:19:06 +00:00
Gergely Risko
aaef818b23
Make content of variable "name" an actual name (#1816)
In the example, somebody who is trying to understand this code has to
follow a lot of moving pieces: prefix, name, make_greeter, and then also
learn the new move concept at the same time.

It'd be better if the content were to actually match the name of the
variables. "Hi" is a good prefix, but "there" is not a name, so let's go
with an actual name.
2024-02-14 08:57:56 -05:00
Dustin J. Mitchell
5d9ab5f239
Fix Chromium link in README.md (#1812)
Fixes #1806.
2024-02-12 15:24:24 +00:00
Gergely Risko
eb8a5418bd
Use existing function as an example for automatic dereferncing (#1799) 2024-02-12 14:47:44 +00:00
IP1llar
2e2d47c709
Update try.md - syntax error (#1807)
Add second `:`
2024-02-12 09:39:40 -05:00
IP1llar
2f7dc8f93d
Fix typo in googletest.md (#1804)
The word `strings` is repeated unnecessarily
2024-02-12 09:37:12 -05:00
Andriy Redko
e576b7f548
uk: Day 2: afternoon (#1802)
Day 2: afternoon (+ miscellaneous updates of previous sections)

Signed-off-by: Andriy Redko <drreta@gmail.com>
2024-02-12 11:15:04 +00:00
Dustin J. Mitchell
33b19848ef
Improved support for commenting when course timings change. (#1797)
This
* Works with the GitHub permissions model (at least in local testing on
another temporary repo)
 * Only comments when the timings actually change
2024-02-12 11:03:24 +00:00
dependabot[bot]
76362763c3
cargo: bump the patch group with 4 updates (#1810)
Bumps the patch group with 4 updates:
[mdbook](https://github.com/rust-lang/mdBook),
[thiserror](https://github.com/dtolnay/thiserror),
[cxx](https://github.com/dtolnay/cxx) and
[cxx-build](https://github.com/dtolnay/cxx).

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-12 10:40:19 +00:00
dependabot[bot]
4f719ddc72
build(deps): bump crate-ci/typos from 1.18.0 to 1.18.2 (#1811)
Bumps [crate-ci/typos](https://github.com/crate-ci/typos) from 1.18.0 to
1.18.2.

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-12 10:11:15 +00:00
dependabot[bot]
8b31cd978e
cargo: bump the minor group with 2 updates (#1809)
Bumps the minor group with 2 updates:
[clap](https://github.com/clap-rs/clap) 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-02-12 10:09:59 +00:00
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
Nicole L
f5f2c6b925
Binder/AIDL content updates (#1618) 2024-02-09 15:11:10 -08:00
Michael Liendo
4d0f23e51a
feat: add and fix translation to installation caption (#1798) 2024-02-09 22:20:43 +00:00
IP1llar
d15314527b
Update lifetime-elision.md (#1795)
In the details section, it is suggested to adjust the signature of the
nearest function to "lie" about the lifetimes returned to:

fn nearest<'a, 'q'>(points: &'a [Point], query: &'q Point) -> Option<&'q
Point> {

to demonstrate the compiler checks lifetimes for validity. However, the
syntax for 'q is incorrect and it should instead be

fn nearest<'a, 'q>(points: &'a [Point], query: &'q Point) -> Option<&'q
Point> {
2024-02-08 19:48:21 +00:00
mobyw
6fcb591585
zh-CN: SUMMARY translation (#1779)
https://github.com/google/comprehensive-rust/issues/324

---------

Co-authored-by: Yihao Wang <42559837+AgainstEntropy@users.noreply.github.com>
Co-authored-by: Henri F. <henrif75@users.noreply.github.com>
2024-02-07 18:49:05 -08:00
Manichand Kondapaka
345cf646e4
Added loops section (#1789)
This is a contribution of a loops section for Comprehensive Rust.
2024-02-07 19:33:49 +00:00
Michael Liendo
e74970acbc
feat: add some spanish translations and fix translations (#1790) 2024-02-07 08:31:10 +00:00
Dustin J. Mitchell
9f67c9b0e7
Adjust morning-session timings downward (#1786)
Based on feedback from @marshallpierce that mornings took about 2.5
hours, this adjusts a bunch of the morning times downward to try to
match that. In other words, this is trying to make the times in the
course more accurate, rather than reducing the amount of time available
for these slides.

This also updates the `course-schedule` tool to be able to show
per-segment timings.
2024-02-06 15:48:56 -05: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]
73a6ab6ded
build(deps): bump crate-ci/typos from 1.17.2 to 1.18.0 (#1785)
Bumps [crate-ci/typos](https://github.com/crate-ci/typos) from 1.17.2 to
1.18.0.

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-05 10:31:16 +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
Manichand Kondapaka
faea6894e7
Added an Alternative way for printing struct and declaring a string. (#1773)
Knowing to_string method is good for learner to use at some situation. 
Knowing print complete struct object can be useful while debug.

---------

Co-authored-by: Dustin J. Mitchell <djmitche@google.com>
2024-02-02 20:48:03 +00:00
Andriy Redko
a673efbc14
uk: Day 2: morning (#1776)
Day 2: morning

Signed-off-by: Andriy Redko <drreta@gmail.com>
2024-02-02 10:39:07 +00:00
azevedoalice
55604ddbeb
Add myself to pt-BR reviewers (#1770) 2024-01-31 10:16:19 -08:00
Jean Carlo Vicelli
87df46cf07
pt-BR: add myself to CODEOWNERS (#1774) 2024-01-31 16:46:36 +01: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
Henri F
88dd268b01
Add @namhyung to Korean code reviewers. (#1771) 2024-01-30 17:22:36 -05:00