1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-03-22 06:51:58 +02:00

1011 Commits

Author SHA1 Message Date
Luca Palmieri
f2de222d66
Add links to the Rust advanced testing workshop (#2029)
Following up on https://github.com/google/googletest-rust/issues/376

---------

Co-authored-by: Martin Geisler <martin@geisler.net>
2024-05-03 08:20:02 +00:00
Manichand Kondapaka
48325a08fe
Updated struct and enums in pattern-matching. (#2021)
#1464 issue.

---------

Co-authored-by: Martin Geisler <martin@geisler.net>
2024-04-30 10:07:10 -04: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
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
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
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
Nicole L
bb47529cb9
Move generics to day 2 afternoon (#1976) 2024-04-17 16:24:49 -07: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
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
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
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
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
dependabot[bot]
18c5fe8065
cargo: bump the patch group in /src/exercises/bare-metal/rtc with 1 update (#1954)
Bumps the patch group in /src/exercises/bare-metal/rtc with 1 update:
[chrono](https://github.com/chronotope/chrono).
2024-04-01 11:25:04 -04:00
dependabot[bot]
546ec48029
cargo: bump the minor group with 1 update (#1955)
Bumps the minor group with 1 update:
[tokio](https://github.com/tokio-rs/tokio).
2024-04-01 11:23:52 -04:00
dependabot[bot]
cc0bd2190e
cargo: bump the patch group with 3 updates (#1956)
Bumps the patch group with 3 updates:
[clap](https://github.com/clap-rs/clap),
[serde_json](https://github.com/serde-rs/json) and
[reqwest](https://github.com/seanmonstar/reqwest).
2024-04-01 11:22:57 -04:00
Iván Budnik
e2a4da2594
Add missing closing quotes in generic-traits.md (#1952) 2024-04-01 09:52:33 -04:00
DmitryMilk
b38d429e49
Fix example of niche optimization in Smart Pointers / Box<T> (#1946)
Example with linked list replaced by example with Option
2024-03-28 14:25:57 +00:00
Attila-Mihaly Balazs
ec5d4afa19
Update move.md (#1944)
Fix the String length (and capacity) to make it less confusing.
2024-03-26 13:31:39 +00:00
Raffaello
f2601d15ae
Improve readability of Multi-threaded Link Checker. (#1941) 2024-03-25 21:23:32 +00:00
dependabot[bot]
107ffeab41
cargo: bump the minor group in /src/exercises/bare-metal/rtc with 1 update (#1939)
Bumps the minor group in /src/exercises/bare-metal/rtc with 1 update:
[bitflags](https://github.com/bitflags/bitflags).

Updates `bitflags` from 2.4.2 to 2.5.0

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-25 10:02:30 +00:00
dependabot[bot]
4d1f40917f
cargo: bump the minor group with 1 update (#1938)
Bumps the minor group with 1 update:
[reqwest](https://github.com/seanmonstar/reqwest).

Updates `reqwest` from 0.11.26 to 0.12.1

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-25 10:02:01 +00:00
dependabot[bot]
b4774ceb75
cargo: bump the minor group in /src/bare-metal/aps/examples with 1 update (#1937)
Bumps the minor group in /src/bare-metal/aps/examples with 1 update:
[bitflags](https://github.com/bitflags/bitflags).

Updates `bitflags` from 2.4.2 to 2.5.0

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-25 10:01:26 +00:00
Osman Bowser
44ba3ec461
Fix misspelling of implementing (#1934) 2024-03-24 22:00:10 +00:00
rbehjati
6b3eb83bff
Move mpsc::Sender to the list of Send + Sync types (#1930)
As of 1.72.0, `mpsc::Sender` [is
`Sync`](https://doc.rust-lang.org/std/sync/mpsc/struct.Sender.html#impl-Sync-for-Sender%3CT%3E).
2024-03-22 10:27:11 -04:00
Ali Soufali
a2924391e2
A simple fix in the day (#1927) 2024-03-20 12:12:49 -04:00
Manichand Kondapaka
e5e33a1159
Removed destructuring about struct (#1924)
#1464 issue . Let's limit this section to arrays and tuples.
Destructuring in structs explained in [Day-2
Morning]((https://google.github.io/comprehensive-rust/pattern-matching/destructuring.html)).
2024-03-19 16:49:26 -04:00
dependabot[bot]
3facea27d4
cargo: bump the patch group with 5 updates (#1926)
Bumps the patch group with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [anyhow](https://github.com/dtolnay/anyhow) | `1.0.80` | `1.0.81` |
| [clap](https://github.com/clap-rs/clap) | `4.5.2` | `4.5.3` |
| [serde_yaml](https://github.com/dtolnay/serde-yaml) | `0.9.32` |
`0.9.33` |
| [thiserror](https://github.com/dtolnay/thiserror) | `1.0.57` |
`1.0.58` |
| [reqwest](https://github.com/seanmonstar/reqwest) | `0.11.25` |
`0.11.26` |

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-18 09:41:01 +00:00
Manichand Kondapaka
c633f85f57
Updated static and const (#1881)
Updated the content for space issue .
#1464 issue.
2024-03-15 09:01:41 -04:00
Nicole L
7cd25c0262
Move slices and strings to references section (#1898)
This PR moves the slides for slices and strings into the day 1 section
on references. This seems like the more natural place to introduce
slices since slices are a type of reference. It then also made sense to
me to follow that with the introduction of `&str` and `String`, since
students now have the context to understand what a "string slice" is. I
also removed the strings slide from the types and values section since
it didn't make sense to cover the same topic twice in the same day. I
tested this new organization in my class on Wednesday and it didn't
cause day 1 to take too long.
2024-03-14 16:21:15 -04:00
kochinc
4b27e28e7f
Update bounded.md (#1919)
Shouldn't it be `recv` instead of `read`? I don't see a `read` function
in Receiver.
2024-03-12 20:48:54 +00:00
Dustin J. Mitchell
ac2cb44d54
Cover Supertraits, Generic Traits (#1854) 2024-03-12 13:49:39 +00:00
Nicole L
d0656ca90b
Simplify generic min exercise (#1900)
I was a bit dissatisfied with the test code for the generic min
exercise. We were supposed to be testing that the student wrote the
generic function correctly, but we only test their `min` function with
one type. I rewrote the exercise to test against multiple types, which
required that we use the regular `Ord` trait rather than a custom one. I
tend to prefer using the real items from `std` when we can because it's
a good way to get students familiar with the standard library. I also
removed the custom `Citation` type since it wasn't really important to
the exercise.
2024-03-11 18:33:03 -04:00