Commit Graph
6046 Commits
Author SHA1 Message Date
Chris Krycho 72ad14e4ac Ch. 07: Clarify sentences about pub use
This is still a *bit* finicky, but it is slightly clearer than before,
and at least addresses the underlying issue here.

Fixes #3645
2025-03-21 08:41:23 -06:00
Chris Krycho 6875f02fef Merge pull request #4292 from rust-lang/ch-consist-ordering-use-statements
Ch. 02: Consistent ordering of `use` statements
2025-03-21 08:07:04 -06:00
Chris Krycho be48c05755 Ch. 02: Consistent ordering of use statements
Adopt the idiomatic pattern of separating `std` from third-party `use`
statements, with the result that we get the ordering we want for Ch. 07
for “free”.

Fixes #3121
2025-03-21 07:41:19 -06:00
Chris Krycho e5492e67e5 Merge pull request #4271 from mianlang/main
Anchors on listings
2025-03-21 07:34:14 -06:00
mianlang ba072b84bb change listing text to <a> tag in figcaption to provide link 2025-03-21 14:07:35 +08:00
gaoyuanandChris Krycho 5bcf1bf546 add id to Listing with number attribute for cross reference
update tests after new attribute id added

Co-authored-by: Chris Krycho <hello@chriskrycho.com>
2025-03-21 14:07:35 +08:00
Chris Krycho e380269080 Merge pull request #4288 from rust-lang/ch-tweak-sections-phrase-improvemnt
Ch. 17: another tweak to how we phrase things about sections
2025-03-20 16:30:28 -06:00
Chris Krycho 126e5fd411 Ch. 17: another tweak to how we phrase things about sections 2025-03-20 16:18:25 -06:00
Chris Krycho 3433498a70 Merge pull request #4287 from mianlang/fix-broken-link
Ch. 20: correct listing number
2025-03-20 15:22:47 -06:00
mianlang 1d1424ba1c Ch. 20: correct listing number 2025-03-21 01:05:58 +08:00
Chris Krycho 21fcf73daf Merge pull request #4284 from reitzig/patch-1
Ch. 10.3: clarify language detail
2025-03-20 08:58:15 -06:00
Rick Rainey, CKA,CKS,CKAD,KCNAandChris Krycho 05f17f0d43 Ch. 17: minor typos and link reference (#4286)
Co-authored-by: Chris Krycho <hello@chriskrycho.com>
2025-03-20 08:16:11 -06:00
Raphael f6bd152fa7 Ch. 10.3: clarify language detail
The former phrasing seemed to suggest that we _must not_ annotate types _unless_ there are multiple possibilities.
In fact, we are allowed to add redundant annotations.

Cases where no annotation is needed _despite_ multiple possible types -- e.g. `let n = 8` -- are, presumably, intentionally left out here, so not touching that.
2025-03-18 11:37:14 +01:00
Chris Krycho d3e8ac3ebd Merge pull request #4282 from rust-lang/ch09-module-privacy
Ch. 9: correctly demonstrate privacy with module
2025-03-17 17:19:57 -06:00
Chris Krycho a6bede67a2 Ch. 9: correctly demonstrate privacy with module
The code as actually written *did* conform to the expetaction of the
text, but only because it was in a `lib.rs` file and so in a module
distinct from the scope directly accessible from `main.rs`; as shown in
the text presentation, however, it was not obvious that it was in a
`lib.rs`, and that detail was elided.

Rename the `lib.rs` to `guessing_game.rs` and declare it as a module in
the `main.rs` file, update the `Listing` to name it, and update the text
to call out the creation of the module.
2025-03-17 17:15:42 -06:00
Chris Krycho 6156ff18b2 Merge pull request #4281 from rust-lang/state-option-etc
Ch. 18: correct discussion of delegation in `Post` methods
2025-03-17 17:02:40 -06:00
Chris Krycho 8904592b6f Ch. 18: correct discussion of delegation in Post methods
Fixes #3635
2025-03-17 16:57:53 -06:00
Chris Krycho b660608304 Merge pull request #4165 from rust-lang/tell-folks-abi-ref
Ch. 20: tell folks to see the Reference for more ABI info
2025-03-17 15:12:33 -06:00
Chris Krycho 4b2590f90c Merge branch 'main' into tell-folks-abi-ref 2025-03-17 15:09:41 -06:00
Chris Krycho 39c34443e7 Merge pull request #4256 from km274/ch-10.1-minor-clarifications
Ch 10.1 minor clarifications
2025-03-17 14:20:48 -06:00
Chris Krycho 6dd246c12a Merge pull request #4232 from anu-sin-theta/main
Clarified the misunderstanding b/w crates, module, items
2025-03-17 13:58:12 -06:00
Chris Krycho 828d75c060 Update src/ch02-00-guessing-game-tutorial.md 2025-03-17 13:55:42 -06:00
Chris Krycho ac911c4223 Merge pull request #4280 from rust-lang/fixes-counting-line-simplify
Ferris: always show, even when it’s small
2025-03-17 11:50:24 -06:00
Chris Krycho 8372e56d40 Ferris: always show Ferrises, even if small
Previously, when we incorporated Ferris into the container for the
buttons, we were bringing along the visibility of the buttons even when
it was important to know that the code wouldn’t compile. This changes
that by showing and hiding the buttons themselves rather than their
container.

Fixes #4274
2025-03-17 11:42:44 -06:00
Chris Krycho 9847e79350 Ferris: simplify line counting for size determination
This is a trivial thing, but I found the previous “replace a terminal
newline and then count the rest” rather less than obvious. Make the
logic more explicit and, as a fun bonus, skip allocating an extra string
along the way. (Not that it matters, in this case, but it’s always
nice to make that kind of improvement.)
2025-03-17 11:41:09 -06:00
Chris Krycho fb2d874349 Merge pull request #4279 from rust-lang/mention-std-pin-use
Ch. 17: mention `use std::pin::{Pin, pin};` on introduction
2025-03-17 10:30:29 -06:00
Chris Krycho b021b72eef Ch. 17: mention use std::pin::{Pin, pin}; on introduction
Bonus: drop now-unnecessary `use std::future::Future` bits given it is
now part of the prelude as of the 2024 edition!

Fixes #4275
2025-03-17 10:26:14 -06:00
Chris Krycho 5a762c3516 Merge pull request #4259 from distortedsignal/wildcard_match_file_fail
Persist printing error, NOT ErrorKind
2025-03-17 09:42:46 -06:00
Chris Krycho 90ea905177 Merge pull request #4263 from proski/two-seconds
Typo: "2" should be "2 seconds"
2025-03-13 10:16:02 -06:00
Chris Krycho a59a0229cf Merge pull request #4270 from alannza/main
Ch. 17: fix tiny example consistency issue
2025-03-13 10:07:49 -06:00
Chris Krycho b456af6342 Merge pull request #4261 from rust-lang/dependabot/cargo/listings/ch17-async-await/listing-17-02/ring-0.17.13
Bump ring from 0.17.8 to 0.17.13 in /listings/ch17-async-await/listing-17-02
2025-03-13 08:43:45 -06:00
Chris Krycho 548187272c Merge pull request #4273 from rust-lang/dependabot/cargo/packages/trpl/ring-0.17.14
Bump ring from 0.17.8 to 0.17.14 in /packages/trpl
2025-03-13 08:43:29 -06:00
dependabot[bot] c47894697c Bump ring from 0.17.8 to 0.17.14 in /packages/trpl
Bumps [ring](https://github.com/briansmith/ring) from 0.17.8 to 0.17.14.
- [Changelog](https://github.com/briansmith/ring/blob/main/RELEASES.md)
- [Commits](https://github.com/briansmith/ring/commits)

---
updated-dependencies:
- dependency-name: ring
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-13 14:15:56 +00:00
Chris Krycho 70c566fd15 Merge pull request #4272 from rust-lang/nostarch-backports
2024 Print Edition: updates to Word docs and more fixes to Markdown text
2025-03-13 08:14:37 -06:00
Chris Krycho 32494841d6 link2print: *which* reference is repeatedly defined? 2025-03-13 08:11:51 -06:00
Chris Krycho 56ec353290 More changes caught during ↔ backports for print edition 2025-03-13 08:11:51 -06:00
Chris Krycho 02e053cdbb nostarch: update Word documents with revisions from web version 2025-03-12 17:24:28 -06:00
Alan 54245bf9ef Ch. 17: fix tiny example consistency issue 2025-03-11 19:16:00 -07:00
Pavel Roskin c6f57828d7 Typo: "2" should be "2 seconds"
Remove extraneous "also" in the same paragraph.
2025-03-07 23:08:38 -08:00
dependabot[bot] 3303dafa07 Bump ring in /listings/ch17-async-await/listing-17-02
Bumps [ring](https://github.com/briansmith/ring) from 0.17.8 to 0.17.13.
- [Changelog](https://github.com/briansmith/ring/blob/main/RELEASES.md)
- [Commits](https://github.com/briansmith/ring/commits)

---
updated-dependencies:
- dependency-name: ring
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-07 17:09:22 +00:00
Tom e3c9cf9164 Persist printing error, NOT ErrorKind
Reading through the Rust Book, I found this code that appears to be
trying to take different actions based on the error type. Looking
closer, I realized that the author changed the code (I believe,
unintentionally) to log only the error type instead of the whole
error when certain conditions are met.

This is a simple fix - the wildcard match for `other_error` is
removed, and replaced with a non-binding wildcard, and the panic
is changed to consuming the base error. This is better because it
changes the minimal amount of functionality in the example code
and it refamiliarizes readers with the wildcard matching system.
2025-03-04 14:06:58 -08:00
km274 6c22ad7459 Clarify language explaining how the non-compiling listing would be fixed
"By following the help text’s suggestion, we restrict..." and "...and this example will compile..." imply to the reader that after this paragraph, they can expect to see a corrected code example. This rewording, though somewhat subtle, clarfies how the code example *would* be fixed by following the compiler's help message.
2025-03-03 17:20:48 -06:00
km274 694ec77f32 Remove "we'll fix it later in this chapter" for clarity
"we'll fix it later in this chapter" somewhat implies that a correct code example will be provided later; "later in this chapter" also implies "quite a bit later", when the fix is actually discussed very shortly after the non-compiling code is presented
2025-03-03 17:04:49 -06:00
Chris Krycho 87f3d05ddf nostarch: incorporate latest revisions from web 2025-02-27 15:10:59 -07:00
Chris Krycho 81a976a237 Merge pull request #4249 from rust-lang/social-media-discussion-generic
Ch. 10: Make social media discussion generic.
2025-02-27 15:10:41 -07:00
Chris Krycho e5c8a0c99d Ch. 10: Make social media discussion generic.
Twitter is now X, who knows what 'tweets' are called, and whether *any*
of the current crop of social media platforms will exist by the time the
2027 or 2030 editions of Rust roll around, who knows?
2025-02-27 15:06:51 -07:00
Chris Krycho 0896670829 Merge pull request #4247 from rust-lang/ch-fix-another-chapter-eighteen
Another Ch. 17 -> 18 fix
2025-02-26 13:31:54 -07:00
Chris Krycho 6b65e95005 Another Ch. 17 -> 18 fix 2025-02-26 13:20:28 -07:00
Chris Krycho 814c7e5cf0 Merge pull request #4246 from rust-lang/ch-improve-wording-about-useravailb
Ch. 05: further tweak to wording about `user1` availability
2025-02-26 13:00:49 -07:00
Chris Krycho 063b1f8aff Ch. 05: further tweak to wording about user1 availability
This is a tricky thing to get “just right”, and I am not *totally* happy
with this solution, but I think it’s actually better without the “as a
whole” given the addition of the sentence at the end indicating that its
fields can still be accessed.
2025-02-26 12:52:43 -07:00