Commit Graph

217 Commits

Author SHA1 Message Date
Carol (Nichols || Goulding) 24774070de
Update lock files and output 2021-02-17 21:13:47 -05:00
Carol (Nichols || Goulding) fa10e20da6
Update error output for changes to chapter 10 listings 2021-02-17 20:38:44 -05:00
Carol (Nichols || Goulding) e9ec18af92
Merge remote-tracking branch 'origin/pr/2542' 2021-02-17 20:27:50 -05:00
Carol (Nichols || Goulding) 6c87a3204f
Merge remote-tracking branch 'origin/pr/2460' 2021-02-17 20:22:37 -05:00
Carol (Nichols || Goulding) db5e8a5105
Update to Rust 1.50 2021-02-12 16:58:20 -05:00
Carol (Nichols || Goulding) 8fb8bb0479
Merge remote-tracking branch 'origin/pr/2604' 2021-02-10 14:48:46 -05:00
Brian Rogers aab9cfa21f Fix ch05 listings to align project names with book
The book says, "Let's make a new binary project with Cargo called
rectangles," but the listing output files use `structs` as the name.
Change this to `rectangles` to align with the book's text.
2021-02-09 13:59:02 -08:00
appleJax 519eddb702 update 0.8.1 to 0.8.3 2021-01-31 11:17:26 -08:00
apogeeoak 98c15e36ec Updated listings in Ch 20-02 and 20-03 with Content-Length header. 2021-01-26 17:45:36 -05:00
apogeeoak 395c1b8c2e Added Content-Length header to Ch 20-01 listings. 2021-01-26 16:30:20 -05:00
Steve Klabnik e724bd8265
Merge pull request #2566 from rust-lang/outsmarting-the-smartypants-compiler
Fixes #2417. Get the index from user input instead of a const.
2021-01-20 08:19:49 -06:00
Carol (Nichols || Goulding) 2485f9023b
Update to 1.49 2021-01-12 22:05:36 -05:00
Carol (Nichols || Goulding) 79bafdc6be
Fixes #2417. Get the index from user input instead of a const.
The compiler has gotten sufficiently smart regarding const evaluation to
catch many trivial instances of array-index-out-of-bounds at compile
time. However, the compiler can't read peoples' minds... yet.
2021-01-12 21:26:29 -05:00
appleJax 80721829d0 update 0.8.0 to 0.8.1 2021-01-09 17:54:49 -08:00
appleJax aa0213ebb5 update Cargo.tomls and Cargo.locks 2020-12-28 16:16:58 -08:00
appleJax 080160a5e9 update rand version 2020-12-24 17:13:50 -08:00
Carol (Nichols || Goulding) e54f70398e
Merge pull request #2485 from adrientremblay/master
Clarify code example ch6.3
2020-12-22 21:10:03 -05:00
Carol (Nichols || Goulding) b7ad637af6
Update output to match the updated poem punctuation 2020-12-22 21:02:56 -05:00
Carol (Nichols || Goulding) 777f1e7476
Fix #2539 - Remove fancy apostrophes from poem for Windows
Really fix this for real this time. Real real real.
2020-12-22 20:24:31 -05:00
Carol (Nichols || Goulding) 5d57100a14
Remove the rest of the unneeded 'statics 2020-12-10 22:12:14 -05:00
Steve Klabnik 360960eb3f
Remove an uneeded 'static lifetime
Fixes #1744
2020-12-10 22:11:40 -05:00
Carol (Nichols || Goulding) 943c6b8e0f
Merge remote-tracking branch 'origin/pr/2475' 2020-12-09 22:04:04 -05:00
Carol (Nichols || Goulding) 322899b375
Re-fix #2516 - Make a new listing for final code of ch 20
I was trying to reuse too much; we don't want the `take(2)` to be part
of the final code, but we do want it to be in the listing for the
example where we shut down gracefully after 2 requests.
2020-12-08 21:30:00 -05:00
Carol (Nichols || Goulding) eb60fedc9c
A solution for empty main in lib.rs, I think!
The reasons we needed empty `fn main() {}`s were twofold:

- Avoid confusing people when they click the "expand" button on the code
listing and see the auto-main wrapping
- Avoid failing doctests when running `mdbook test` that don't work when
rustdoc wraps a code listing in main

I think I have a solution that mostly solves these cases.

I don't know why this didn't occur to me before. Here's my current
thinking in case these assumptions turn out to be wrong:

There are a [few things that tell mdbook to disable the
main-wrapping][mdbook], and I hadn't noticed one of them until now: if
you annotate a code block with `noplayground`, it won't add a `main`
around it (and it also won't have the "play" button in the upper right
that runs the block and inserts the result into the page).

So instead of putting an empty `fn main() {}` at the bottom of
src/lib.rs files that doesn't make sense, annotate those listings with
`noplayground`. I don't think anyone will miss the play button anyway
because:

- The play button doesn't run tests, so there wasn't any output for
these examples anyway
- If an example doesn't compile, we have it marked `ignore` so that it
doesn't make the tests fail, and `ignore` also disables the play button,
so there isn't a way to see compiler errors either

In most of these cases, `mdbook test` that runs these as doctests will
still wrap these in main, but the tests still pass.

There are some cases, mostly around modules and using `crate::` that
won't pass as doctests when wrapped in main. For those, I've annotated
them with the [undocumented][] [`test_harness`][] attribute that apparently
I was using at some point and then [stopped using][] and now I've
decided to use again, but maybe send in a PR to rust-lang/rust to
change the name to `no_main` and document it or something. In any case,
that shouldn't affect readers at all.

[mdbook]: d0deee90b0/src/renderer/html_handlebars/hbs_renderer.rs (L805-L808)
[undocumented]: https://github.com/rust-lang/rust/issues/42288#issuecomment-309661382
[`test_harness`]: 220352781c/src/librustdoc/doctest.rs (L252)
[stopped using]: https://github.com/rust-lang/book/pull/1233#discussion_r175515585
2020-12-08 21:30:00 -05:00
Carol (Nichols || Goulding) 4cd410bab6
Update to 1.48 2020-12-05 14:18:30 -05:00
Carol (Nichols || Goulding) 2567c35e84
Update to Rust 1.47 2020-12-05 14:18:30 -05:00
Carol (Nichols || Goulding) 4895996a3f
Update to 1.46 2020-12-05 14:18:30 -05:00
Carol (Nichols || Goulding) 2dca6c3e78
Update to 1.45 2020-12-05 14:18:29 -05:00
Carol (Nichols || Goulding) e894f58929
Update to 1.44 2020-12-05 14:18:29 -05:00
Carol (Nichols || Goulding) 63bc4103cc
Update to 1.43 2020-12-05 14:18:29 -05:00
Carol (Nichols || Goulding) 17618d8b8f
Try saving the test binary hash to not have to wade through those in the diffs
There are a few output files that have more than one test binaries; make
their hashes be the same because I'm too tired to figure out how to
capture and replace multiple different hashes.
2020-12-05 14:18:29 -05:00
Carol (Nichols || Goulding) 6e98805629
Update to 1.42 2020-12-05 14:18:28 -05:00
Steve Klabnik 1b0f8766f9
Merge pull request #2511 from ibraheemdev/patch-1
Update 16-11 to use method call expression for `clone`
2020-12-01 09:38:23 -06:00
OliverBalfour df427814a0
Correct chapter 20 final listing
In chapter 20 on writing a web server, one of the listings includes `.take(2)` on the TCP stream iterator to only handle 2 requests and then quit. This is as an example to demonstrate that the web server shuts down gracefully. However, this has slipped into the final code listing, which I don't think should include this arbitrary restriction. This pull request amends this error.
2020-11-29 19:51:30 +11:00
Ibraheem Ahmed 6bb2981d3e
Update 16-11 to use method call expression for `clone` 2020-11-26 11:08:37 -05:00
Adrien Tremblay a61cdbd187 clarify code example ch6.3 2020-10-26 13:15:56 -04:00
Geert Stappers f6c5e4ea24 Balance curly brackets
Moved an ANCHOR_END to prevent a spurious } showing up in the listing.
2020-10-11 10:21:37 +02:00
dalrrard 76917f677d Reverted changes made in 43565d3 and added a small explanation to ch10-00-generics.md 2020-09-20 00:23:08 -05:00
Amjad Alsharafi 09ea67e613 Fixed the error message of invalid array element access in ch03.2 2020-09-02 11:50:53 +08:00
Herbert Reiter a4780b9925 Fix reference type 2020-08-26 16:13:59 +02:00
Jahwi 53eaa8cb53 Correct no-listing-10-result-in-tests: Take tests module out of the main function 2020-08-15 12:59:35 +01:00
Jahwi c981c7174a Correct listing 11-10: Take test module out of main function. 2020-08-13 22:38:06 +01:00
Steve Klabnik 30cd9dfe71
Merge pull request #2362 from ayushmishra2005/remove_unnecessary_long_type_name_#1869
Unnecessarily long type name in Ch 13
2020-06-07 23:07:19 -05:00
Steve Klabnik 43565d343b Tweak example in chapter 10
We were cheating due to Copy, and that made this example awkward.
Returning a reference is probably better here anyway, and it makes
everything flow a bit nicer.

Fixes #1761
2020-06-07 08:01:34 -05:00
Ayush Kumar Mishra 25389fe4aa Unnecessarily long type name in Ch 13 #1869 2020-06-07 18:20:41 +05:30
Homa Wong 1de0dc4b30
fix: matching with 15-18 2020-04-28 19:25:06 -07:00
Homa Wong ed626f9e8d
fix: matching with 15-18 2020-04-28 19:23:31 -07:00
Steve Klabnik f688ff20a4
Merge pull request #2246 from Adeleet/master
Increase HTTP buffer size and add 'Content-Length' header
2020-04-15 08:26:06 -05:00
Steve Klabnik 2ae087182f
Merge pull request #2239 from apatniv/use_references
traits as parameters: Use references instead of moving the values
2020-04-06 10:54:21 -05:00
NejcZdovc 61fa2fa976
Fixes hardcoded output
Resolves https://github.com/rust-lang/book/issues/2275
2020-02-24 14:14:14 +01:00
Adeleet a641809576 Increase HTTP buffer size and add 'Content-Length' header 2020-02-06 23:51:24 +01:00
Carol (Nichols || Goulding) 5258c2f3d1
Update to Rust 1.41.0 (#2244)
Update to Rust 1.41.0
2020-02-03 13:59:24 -05:00
Carol (Nichols || Goulding) a2bd349f86
Update to Rust 1.41.0 2020-02-03 10:36:54 -05:00
apatniv 33838c7ec7 Use references instead of moving the values 2020-02-01 07:17:23 +05:30
Steve Klabnik f4c7cfcd7a
Merge pull request #2201 from SuperSamus/patch-1
Listing 19-6: use ptr.add instead of ptr.offset
2020-01-30 17:09:00 -06:00
Carol (Nichols || Goulding) 1d0b5e6148
Remove unneeded mutable reference
Fixes #1953.
2020-01-30 16:56:57 -05:00
Carol (Nichols || Goulding) ce4328b7f5
Make HashMap types match previous example; add fwd ref to ch 13
Fixes #2087.
2020-01-30 14:39:32 -05:00
SuperSamus f58d939014
Use ptr.add instad of offset 2020-01-30 18:34:13 +01:00
Carol (Nichols || Goulding) cb26a329e4
Merge remote-tracking branch 'origin/pr/2191' 2020-01-29 09:48:09 -05:00
Carol (Nichols || Goulding) eab82e1fd6
Merge remote-tracking branch 'origin/pr/2175' 2020-01-28 21:09:37 -05:00
Carol (Nichols || Goulding) 29800dca2f
Merge remote-tracking branch 'origin/pr/2147' 2020-01-27 13:56:04 -05:00
Carol (Nichols || Goulding) c642b72fc9
Update to Rust 1.40 2020-01-25 21:21:11 -05:00
Carol (Nichols || Goulding) 3c3484974a
Update to Rust 1.39 2020-01-25 21:21:04 -05:00
Carol (Nichols || Goulding) 5f4f738b5c
Update to Rust 1.38 2020-01-25 21:20:42 -05:00
Carol (Nichols || Goulding) fd3e92042d
Commit the changes that rustfmt made to all the listings 2020-01-25 21:20:41 -05:00
Carol (Nichols || Goulding) dec27eead0
Add rustfmt to the update-rustc script
With a mechanism to ignore particular listings for various reasons
2020-01-25 21:20:41 -05:00
Carol (Nichols || Goulding) 5c71aac643
Extract code listings to separate files 2020-01-25 21:20:38 -05:00