Bumps the minor group with 1 update:
[tokio](https://github.com/tokio-rs/tokio).
Updates `tokio` from 1.39.3 to 1.40.0
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Fixes#2060. Note that this does not change the "blocking executor"
example because on that slide it is worthwhile to sleep for 1 * 10ms on
the first iteration and so on. But we shouldn't use one-indexed
inclusive loops when the only significant feature of the loop is its
iteration count.
@mgeisler PTAL, as I believe you were the one to suggest this change in
#1536.
This leaves some detail about `select!` out, but that might be just as
well. Some of that detail is addressed in the `pin!` pitfall, later.
In #2153 I aimed to fix a link but broke it.
In this PR, I fix it and add
[`mdbook-linkcheck`](https://github.com/Michael-F-Bryan/mdbook-linkcheck)
to avoid future cases.
Some past fixes that could have been prevented, in addition to mine in
this PR:
* #811
* #2064
* #2146
Note:
`mdbook-linkcheck` may also check external links with a configuration
change.
It can be beneficial to check also external links from time to time. I
ran it here and found 3 broken links.
Maintainers - sorry for the lack of a preceding issue. We can discuss it
here.
Some remaining work is to fix the outdated internal links in the
translations, not done here.
Let me know what you think about the proposed contribution.
This PR completes #1502.
Bumps the patch group with 2 updates:
[clap](https://github.com/clap-rs/clap) and
[thiserror](https://github.com/dtolnay/thiserror).
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps the patch group with 2 updates in the / directory:
[serde_json](https://github.com/serde-rs/json) 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>
The type returned by `String::from_utf8(raw)`, is `Result<_>` and needs
to be mapped to match the type of the return type of `next`. You get
this error otherwise:
```
Compiling playground v0.0.1 (/playground)
warning: unused import: `ErrorKind`
--> src/main.rs:1:21
|
1 | use std::io::{self, ErrorKind};
| ^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
error[E0308]: mismatched types
--> src/main.rs:29:17
|
29 | Ok(Some(s))
| ---- ^ expected `String`, found `Result<String, FromUtf8Error>`
| |
| arguments to this enum variant are incorrect
|
= note: expected struct `String`
found enum `Result<String, FromUtf8Error>`
help: the type constructed contains `Result<String, FromUtf8Error>` due to the type of the argument passed
--> src/main.rs:29:12
|
29 | Ok(Some(s))
| ^^^^^-^
| |
| this argument influences the type of `Some`
note: tuple variant defined here
--> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs:579:5
|
579 | Some(#[stable(feature = "rust1", since = "1.0.0")] T),
| ^^^^
help: use the `?` operator to extract the `Result<String, FromUtf8Error>` value, propagating a `Result::Err` value to the caller
|
29 | Ok(Some(s?))
| +
For more information about this error, try `rustc --explain E0308`.
warning: `playground` (bin "playground") generated 1 warning
error: could not compile `playground` (bin "playground") due to 1 previous error; 1 warning emitted
```
The speaker notes suggest an evolution of the code to support a periodic
timer, but the last step was under-specified.
(As mentioned by @fw-immunant and referenced in #1536)
Bumps the minor group with 1 update:
[tokio](https://github.com/tokio-rs/tokio).
Updates `tokio` from 1.37.0 to 1.38.0
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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 :)
These follow the flow of what I actually teach, which spends a
significant amount of time on the latter slide. I think it's worthwhile
to have a real flow documented in the teaching notes, both to make sure
nothing gets forgotten and to structure the experience of teaching.
This is the result of running `dprint fmt` after removing `src/` from
the list of excluded directories.
This also reformats the Rust code: we might want to tweak this a bit in
the future since some of the changes removes the hand-formatting. Of
course, this formatting can be seen as a mis-feature, so maybe this is
good overall.
Thanks to mdbook-i18n-helpers 0.2, the POT file is nearly unchanged
after this, meaning that all existing translations remain valid! A few
messages were changed because of stray whitespace characters:
msgid ""
"Slices always borrow from another object. In this example, `a` has to remain "
-"'alive' (in scope) for at least as long as our slice. "
+"'alive' (in scope) for at least as long as our slice."
msgstr ""
The formatting is enforced in CI and we will have to see how annoying
this is in practice for the many contributors. If it becomes annoying,
we should look into fixing dprint/check#11 so that `dprint` can annotate
the lines that need fixing directly, then I think we can consider more
strict formatting checks.
I added more customization to `rustfmt.toml`. This is to better emulate
the dense style used in the course:
- `max_width = 85` allows lines to take up the full width available in
our code blocks (when taking margins and the line numbers into account).
- `wrap_comments = true` ensures that we don't show very long comments
in the code examples. I edited some comments to shorten them and avoid
unnecessary line breaks — please trim other unnecessarily long comments
when you see them! Remember we're writing code for slides 😄
- `use_small_heuristics = "Max"` allows for things like struct literals
and if-statements to take up the full line width configured above.
The formatting settings apply to all our Rust code right now — I think
we could improve this with https://github.com/dprint/dprint/issues/711
which lets us add per-directory `dprint` configuration files. However,
the `inherit: true` setting is not yet implemented (as far as I can
tell), so a nested configuration file will have to copy most or all of
the top-level file.
The new Chromium class likes — like me! — to use dashes in the writing!
However, I believe it should use an em-dash instead of the hyphen.
Luckily this is easy: we have enabled “typographic quotes” in `mdbook`,
which also handles the conversion of `---` to `—` in the generated HTML.
So I normalized the single existing em-dash to a triple-dash to make it
more consistent (and hopefully make it easier for translators to
consistently enter these characters).
Update unbounded.md to address inconsistent code
Fix inconsistency between concurrency `unbounded.md` and `bounded.md` by using implicitly named arguments for both.
The Arc/Mutex chapters mention Send/Sync in the speaker notes, and in
fact serve as good illustrations of the traits, so let's define the
traits before referencing them.
Example contained unnecessary explicit type info for the vector in Mutex v. Rust will magically do the needful conversions for us. Code looks cleaner/simpler without the explicit typing.
* Update mutex.md
Adding speaker notes why Rust `Mutex` has its design and mentioning briefly `RwLock`.
Someone from the audience can notice `unwrap()` in the code, it might be worth to have the answer in speaker notes.
* Apply suggestions from code review
Co-authored-by: Martin Geisler <martin@geisler.net>