1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2024-11-24 17:06:37 +02:00
Commit Graph

1936 Commits

Author SHA1 Message Date
dependabot[bot]
6f4f29e603
Bump crate-ci/typos from 1.20.9 to 1.20.10 (#2034)
Bumps [crate-ci/typos](https://github.com/crate-ci/typos) from 1.20.9 to
1.20.10.

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-29 11:30:19 +01:00
Chayim Refael Friedman
5633dd52a7
Vec::new() doesn't allocate (#2026)
So remove it from the list of things to look on that allocate, and
replace with `vec![]`, which does allocate (if given any elements).
2024-04-25 09:40:36 -04:00
Huy Vuong
402ac3a202
vi: control-flow-basics.md translations (#1983)
Doing a small translations and making sure that I am creating PRs
correctly

I leave `Macros` as-is because there isn't an actual translations for
`Macros` in Vietnamese. It looks like they just use `macros` directly in
any vietnamese docs

see:
* https://rust-tieng-viet.github.io/basic/macro/
* https://vi.linux-console.net/?p=28497#google_vignette
2024-04-24 16:01:51 +00:00
AdrienBaudemont
8bd2dd06f6
fr: translating remaining paragraphs in section 1 (#2010)
fr: translating remaining paragraphs in section 1. Adding self to French
translators.
2024-04-24 11:03:37 +02:00
Dustin J. Mitchell
face5af783
Update Concurrency course with times (#2007)
As I mentioned in #1536:

* Break into segments at approximately the places @fw-immunant put
breaks
 * Move all of the files into `src/concurrency`
 * Add timings and segment/session metadata so course outlines appear

There's room for more work here, including some additional feedback from
@fw-immunant after the session I observed, but let's do one step at a
time :)
2024-04-23 13:26:41 +00:00
dependabot[bot]
a03b7e68e5
cargo: bump cortex-m-rt from 0.7.3 to 0.7.4 in /src/exercises/bare-metal/compass in the patch group (#2019)
Bumps the patch group in /src/exercises/bare-metal/compass with 1
update: [cortex-m-rt](https://github.com/rust-embedded/cortex-m).

Updates `cortex-m-rt` from 0.7.3 to 0.7.4

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-22 10:28:39 +01:00
dependabot[bot]
1e772b7419
cargo: bump the patch group in /src/exercises/bare-metal/rtc with 2 updates (#2017)
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>
2024-04-22 10:28:10 +01:00
dependabot[bot]
94d9f66589
cargo: bump cc from 1.0.91 to 1.0.95 in /src/bare-metal/aps/examples in the patch group (#2014)
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.0.91 to 1.0.95

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-22 10:27:32 +01:00
dependabot[bot]
9ce4b4698f
cargo: bump the patch group with 4 updates (#2016)
Updates `serde` from 1.0.197 to 1.0.198

Updates `serde_json` from 1.0.115 to 1.0.116

Updates `thiserror` from 1.0.58 to 1.0.59

Updates `reqwest` from 0.12.3 to 0.12.4

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-22 09:18:08 +02:00
dependabot[bot]
17131d0b35
cargo: bump tokio-websockets from 0.7.0 to 0.8.2 in the minor group (#2015)
Updates `tokio-websockets` from 0.7.0 to 0.8.2

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-22 09:15:16 +02:00
dependabot[bot]
4259b63c44
Bump crate-ci/typos from 1.20.8 to 1.20.9 (#2018)
Bumps [crate-ci/typos](https://github.com/crate-ci/typos) from 1.20.8 to
1.20.9.

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-22 09:14:00 +02:00
Nicole L
ea8b5d2207
Simplify interior mutability example (#2006)
The existing `RefCell` example code was more complex than necessary to
demonstrate the functionality, and was complex in a way that I often
found hard to explain to students. This PR replaces it with a much
simpler demonstration, and adds a code example for `Cell`.
2024-04-19 10:21:30 -04:00
Nicole L
0c23d817e5
Add examples of the borrow checker catching errors (#2000)
I think it'd be helpful to actually demonstrate to students how the
"sharing XOR mutability" rule actually prevents errors in practice,
since right now we explain the rule but don't give much context as to
why the rule is important.
2024-04-19 10:19:06 -04:00
Nicole L
59d63a6e89
Simplify the example code for Clone (#2001)
The previous example code for the `Clone` slide was a bit too complex in
a way that obscured the fundamental point. I've replaced it with the
`say_hello` example from the previous slide, but updated to demonstrate
how cloning can address the borrow checker error. I also added a speaker
note to mention that `Clone` performs a deep copy, which might be
different from what students are used to if they come from a language
like Python that does shallow copies by default.
2024-04-19 10:18:31 -04:00
Dustin J. Mitchell
bb44b1d7a8
Use tables to summarize course content (#2005)
This is more friendly to translation (as it can share the translation of
the title).

This fixes #1982.
2024-04-19 13:38:26 +00:00
Andrew Walbran
45aa43f406
Update to embedded-hal 1.0 (#1723)
Now that the new version of `microbit-v2` and friends are finally
released, we can use `embedded-hal` 1.0 for the bare metal morning.
2024-04-19 12:52:50 +01:00
Nicole L
c9e08fae60
Slightly simplify binary tree exercise (#2002)
Give students a little more context for the binary tree exercise by
giving them the wrapper methods on `BinaryTree` at the start and
explicitly asking them to implement the methods on `Subtree`. I think
this simplifies the exercise a bit and makes it a bit more focused for
students.
2024-04-18 14:50:27 -04:00
khoaxuantu
e6021ce5d0
vi: Day 1 Morning - Welcome translation (#1972)
The translation of *Day 1 Morning: Welcome*.
2024-04-18 11:24:55 -04:00
Caleb Maclennan
487d1710c9
Add @alerque as a reviewer for the Turkish translation (#1999)
See invitation here:
https://github.com/google/comprehensive-rust/pull/1971#issuecomment-2061199545

Also note that @enes1313 is marked as a code owner, but they are *not* a
collaborator on the repository so the code owner features are
non-functional and this is considered an error by the GH parser.
Obviously there are two possible resolutions to that...
2024-04-18 12:48:18 +02:00
Nicole L
bb47529cb9
Move generics to day 2 afternoon (#1976) 2024-04-17 16:24:49 -07:00
Enes Aydın
f1692ef5d9
tr: day 1 morning translation (#1971)
Translated day-1-morning
Part of #500
2024-04-17 14:00:24 +02:00
Martin Geisler
963c6979ed
Revert "Update README.md with mdbook-pandoc install" (#1998)
Reverts google/comprehensive-rust#1975

Using `mdbook-pandoc` requires more than just installing the `mdbook`
plugin: it requires

- A whole LaTeX installation
- A Pandoc installation
- Some fonts

This is essentially why the output is configured as optional in
`book.toml`: the assumption is that people won't have `mdbook-pandoc`
installed without the necessary supporting tools.

@henrif75, I assume you added this because you didn't like the warning
`mdbook build` prints:

```
% mdbook build
2024-04-16 10:45:56 [WARN] (mdbook::book): The output.html.curly-quotes field has been renamed to output.html.smart-punctuation.
Use the new name in book.toml to remove this warning.
2024-04-16 10:45:56 [INFO] (mdbook::book): Book building has started
2024-04-16 10:45:57 [INFO] (mdbook::book): Running the exerciser backend
2024-04-16 10:45:57 [INFO] (mdbook::renderer): Invoking the "exerciser" renderer
2024-04-16 10:45:57 [INFO] (mdbook::book): Running the html backend
2024-04-16 10:45:58 [INFO] (mdbook::book): Running the pandoc backend
2024-04-16 10:45:58 [INFO] (mdbook::renderer): Invoking the "pandoc" renderer
2024-04-16 10:45:58 [WARN] (mdbook::renderer): The command `mdbook-pandoc` for backend `pandoc` was not found, but was marked as optional.
```

I don't have the necessary dependencies on my local system and this is
what I get after installing `mdbook-pandoc`:

```
2024-04-16 10:47:30 [INFO] (mdbook::renderer): Invoking the "pandoc" renderer
Unable to run `pandoc -v`: No such file or directory (os error 2)
2024-04-16 10:47:30 [ERROR] (mdbook::renderer): Renderer exited with non-zero return code.
2024-04-16 10:47:30 [ERROR] (mdbook::utils): Error: Rendering failed
2024-04-16 10:47:30 [ERROR] (mdbook::utils): 	Caused By: The "pandoc" renderer failed
```

This also means that `mdbook serve` doesn't work unless all dependencies
are installed.

As an alternative, we could remove the `output.pandoc` settings from the
`book.toml` file and use a small shell script to add them when needed.

We actually have the same problem for the `mdbook-xgettext` output
format which generates the POT files: we only want to run this
occasionally. This is currently done by overriding `output` from the
command line using the `MDBOOK_OUTPUT` environment variable:

```shell
MDBOOK_OUTPUT='{"xgettext": {"pot-file": "messages.pot", "granularity": 0}}' \
  mdbook build -d po
```

It's a bit ugly and it results in people missing/forgetting some of the
configuration options we want them to use (the `granularity` setting).
So I would like to move this configuration to the `book.toml` file — but
I'm reluctant since I don't think we need to generate POT files on every
build (it takes ~1 second and would slow down `mdbook serve`).

Cc @max-heller in case you have ideas here.
2024-04-16 13:26:47 -07:00
1dimir
b76af9c710
ru: translate days 1-2 section titles (#1973)
* Add translations for the new extracted messages related to Day 1and
Day 2 chapters;
* Fix numbering in translation of Day 4 titles;
* Use PO file translator comments for notes and reasons why one or
another choice was made, mention alternatives;
* Do not translate type and trait names;
* Rename: Поток управления -> Управляющие конструкции;
* Rename: Перечисления и сопоставление с образцом. -> Деструктуризация;
* Rename: Ссылки -> Заимствование;
* Rename: Висячие ссылки -> Изменяемые ссылки;
* Rename: Вторая половина дня -> После обеда;
* Rename: Поток управления -> `Let` в потоке управления (src: Let
Control Flow);
* Rename: Функции -> Обобщённые функции (src: Generic Functions);
* Rename: Обобщения (generics). -> Обобщённые типажи (src: Generic
Traits);
* Cannot translate `Slices: &[T]` - possible bug

#326
2024-04-16 15:24:25 +01:00
Keiichi Watanabe
f103971cf4
Add @HidenoriKobayashi to CODEOWNERS for Japanese translation (#1997)
@HidenoriKobayashi has been working on Japanese translation very well so
it'd be nice to have him as a CODEOWNER
2024-04-16 14:11:34 +09:00
Jannis Imhof
cb59f30a2e
Fix Fibonacci sequence i.e. fib(0) -> 0. (#1996)
related Issue #1985
2024-04-15 20:07:44 +00:00
dependabot[bot]
0a1ddadc83
cargo: bump nrf52833-hal from 0.16.1 to 0.17.0 in /src/bare-metal/microcontrollers/examples in the minor group (#1989)
Bumps the minor group in /src/bare-metal/microcontrollers/examples with
1 update: [nrf52833-hal](https://github.com/nrf-rs/nrf-hal).

Updates `nrf52833-hal` from 0.16.1 to 0.17.0

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-04-15 15:51:46 +00:00
Iván Budnik
06a2683cc7
Add missing import for try-conversions.md example (#1986)
Uncommenting the "write" line causes the example to fail compilation
because the compiler can't find `fs`.
2024-04-15 11:04:27 -04:00
Dustin J. Mitchell
70916261ad
Exercise has a single function to implement (#1995)
Fixes #1993.
2024-04-15 10:37:59 -04:00
Andriy Redko
83e25e30ff
uk: Chromium development (#1984)
uk: Chromium development

Signed-off-by: Andriy Redko <drreta@gmail.com>
2024-04-15 11:00:20 +01:00
dependabot[bot]
956a1361f1
Bump crate-ci/typos from 1.20.4 to 1.20.8 (#1990)
Bumps [crate-ci/typos](https://github.com/crate-ci/typos) from 1.20.4 to
1.20.8.

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-15 10:25:43 +01:00
dependabot[bot]
029c8ac5ca
cargo: bump cc from 1.0.91 to 1.0.94 in /src/exercises/bare-metal/rtc in the patch group (#1988)
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.0.91 to 1.0.94

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-15 10:25:12 +01:00
dependabot[bot]
5df10096ac
cargo: bump the patch group with 3 updates (#1987)
Bumps the patch group with 3 updates:
[anyhow](https://github.com/dtolnay/anyhow),
[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-04-15 10:24:49 +01:00
Nicole L
a4d674b02e
Remove redundant trait bounds from counter exercise (#1980)
The trait bounds aren't needed on the struct definition, only the impl
block. I think it'd be useful to show the difference here in order to
show students how trait bounds for collection types are usually on the
impl blocks rather than the type itself.
2024-04-12 17:07:08 -04:00
Andrew Walbran
b808887006
Add safety comments and use consistent format for existing ones. (#1981)
We should have safety comments on all `unsafe` blocks, to set a good
example.
2024-04-12 13:19:19 -04:00
Nicole L
8433ad9a3d
Remove to_string from HashMap example (#1979)
While it's generally better in Rust code to use `String` as the key type
for a `HashMap` than `&str`, for the purposes of our examples having the
extra `to_string` calls makes the example more verbose and confusing for
students. The simple example will work as-is without the `to_string`
calls, so I think it's better to just remove them.
2024-04-12 13:17:20 -04:00
Nicole L
04c28ed641
Simplify if-let example (#1977)
I find that `if let` makes the most sense to use when you don't have an
`else` case, otherwise it's generally clearer to express the same thing
with a `match`. This changes the `if let` example to be (arguably) a bit
more idiomatic and less verbose.
2024-04-12 12:45:01 -04:00
Nicole L
d966750535
Uncomment setter in generics example (#1978)
I don't think it helps to have the example of a setter commented out in
the example. Uncommenting it and implementing it normally is more clear.
2024-04-12 11:15:46 -04:00
Henri F
80b214117e
Update README.md with mdbook-pandoc install (#1975) 2024-04-12 11:02:03 -04:00
Martin Geisler
9cc3e9c5ed
Avoid fixed byte offsets in strings.md (#1963)
As discovered during #1961, fixed byte offsets tend to break
translations because the translated strings can end up having a
character on the boundary where we slice.
2024-04-09 19:30:58 +02:00
AdrienBaudemont
9ba6c8f8df
fr: removing semi-deleted former translations. (#1970)
fr: removing semi-deleted former translations.
2024-04-09 19:30:45 +02:00
Andriy Redko
db316a70c6
uk: Android development (#1969)
uk: Android development

Signed-off-by: Andriy Redko <drreta@gmail.com>
2024-04-09 14:27:28 +01:00
khoaxuantu
611af00f78
vi: Welcome - Using Cargo translation (#1951)
Here is the translation of *Welcome to Comprehensive Rust: (2) Using
Cargo.*
2024-04-08 18:07:36 +02:00
Martin Geisler
8ed4d48aa5
Only save CI cache on main branch (#1962)
When a PR restores the cache, it will find the most recent cache from
the `main` branch. This cache should be mostly up to date.

We are constantly at the 10 GB limit for our CI caches, so removing the
extra caches from the many PR branches should ensure that we always have
space for the `main` branch caches.
2024-04-08 18:04:42 +02:00
dependabot[bot]
13336fc428
Bump crate-ci/typos from 1.19.0 to 1.20.4 (#1968)
Bumps [crate-ci/typos](https://github.com/crate-ci/typos) from 1.19.0 to
1.20.4.

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-08 15:48:59 +01:00
dependabot[bot]
f5ca4e34fc
cargo: bump the patch group with 2 updates (#1967)
Bumps the patch group with 2 updates:
[pulldown-cmark](https://github.com/raphlinus/pulldown-cmark) 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-04-08 11:40:01 +01:00
dependabot[bot]
e8d78fde70
cargo: bump cc from 1.0.90 to 1.0.91 in /src/bare-metal/aps/examples in the patch group (#1966)
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.0.90 to 1.0.91

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-08 11:39:26 +01:00
dependabot[bot]
4d8a89e6ab
cargo: bump cc from 1.0.90 to 1.0.91 in /src/exercises/bare-metal/rtc in the patch group (#1965)
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.0.90 to 1.0.91

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-08 11:39:07 +01:00
Martin Geisler
620b8a3b72
Run mdbook test on translated code (#1961)
I made a small mistake during the refactor in #1492: I removed the
`MDBOOK_BOOK__LANGUAGE` environment variable, which means that we ended
up testing the original Rust code snippets again and again.

This commit also fixes the few typos that have sneaked into the
translations due to the lack of testing.
2024-04-07 19:38:18 +09:00
AdrienBaudemont
059c7129d1
fr: Refreshing the French translation (#1950)
fr: Refreshing the French translation (running msgmerge, not other
change).
2024-04-07 10:12:53 +02:00
1dimir
73d1c63d11
ru: Update with messages.pot as of 2024-04-06 (#1959)
* Build `messages.pot` (untracked) using `gettext` with granularity=0;
* Update `ru.po` with `msgmerge --update`;
* Make it easier to review consequent translation-centric pull requests;

#326
2024-04-07 09:48:51 +02:00