Commit Graph
56 Commits
Author SHA1 Message Date
Carol (Nichols || Goulding) 5e58b9cc3f Start of better Fn traits explanation 2022-04-23 13:25:50 -04:00
Carol (Nichols || Goulding) ce4da5ccbf Start of a new closure example 2022-04-21 10:33:03 -04:00
Carol (Nichols || Goulding) c99c03c659 Make fixes recommended by shellcheck 2022-01-03 13:18:46 -05:00
Carol (Nichols || Goulding) cf272254b8 SIGH add all the words to the dictionary that were missed while spellcheck was broken 2022-01-01 21:47:17 -05:00
Carol (Nichols || Goulding) 910714b472 Remove test_harness from the dictionary 2022-01-01 21:47:17 -05:00
Carol (Nichols || Goulding) 09e687ec7a set -eu in all bash scripts 2022-01-01 21:47:17 -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]: https://github.com/rust-lang/mdBook/blob/d0deee90b04068ed949f524bb682a47fa26f2218/src/renderer/html_handlebars/hbs_renderer.rs#L805-L808
[undocumented]: https://github.com/rust-lang/rust/issues/42288#issuecomment-309661382
[`test_harness`]: https://github.com/rust-lang/rust/blob/220352781c2585f0efb07ab0e758b136514de5b8/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
Ryan Willis 855aabd099 Update ch12-05 PowerShell note 2020-06-02 17:04:02 -07:00
Steve Klabnik e2108334d4 We don't need build.sh anymore 2020-05-22 23:48:48 -05:00
Steve Klabnik 4a49a4b7d9 Port to GitHub Actions
Most of the Rust project has moved over to Actions, but we were still on
Travis. This sets up the needed Actions for us.
2020-05-22 23:36:19 -05:00
Montgomery Edwards⁴⁴⁸ 297534d172 Add https, proto, and tlsv to dictionary.txt 2020-04-12 23:21:18 -05:00
Eric Huss 6af7cbcd08 Use rust-lang/rust linkchecker on CI. 2020-02-21 09:23:10 -08:00
Carol (Nichols || Goulding) f44367a4ca Add words to dictionary 2020-02-03 10:49:43 -05:00
Carol (Nichols || Goulding) 5c71aac643 Extract code listings to separate files 2020-01-25 21:20:38 -05:00
Steve Klabnik 120e76a0cc Merge pull request #1906 from crlf0710/remove_fnbox
[Rust 1.35] Remove FnBox and use builtin impl FnOnce for Box<FnOnce()> instead.
2019-11-13 09:09:51 -08:00
Eric Huss cf633ee5b9 Fix tidy error.
Upstream tidy doesn't like the whitespace in `ci/build.sh` (no tabs,
too many newlines).
2019-10-01 08:48:26 -07:00
Carol (Nichols || Goulding) 627f2678d2 ci: validate that all used references are defined (#2032)
ci: validate that all used references are defined
2019-09-30 20:38:12 -04:00
Carol (Nichols || Goulding) 5b2740e64a Remove the check for unstable features
We don't use nightly Rust anymore, nor do we try to land docs for
features while they're still unstable, so this check is no longer
needed. The tests will just fail if we try to use a feature flag in code
listings.
2019-09-30 20:29:07 -04:00
Paul Emmerich 38ceba56a8 ci: validate that all used references are defined
this will catch issues like https://github.com/rust-lang/book/issues/2010
2019-07-14 22:25:04 +02:00
Carol (Nichols || Goulding) b56bc84009 Add vert to dictionary 2019-06-15 15:19:03 -04:00
Carol (Nichols || Goulding) 3c3220613d Fix spellingz 2019-04-11 15:40:56 -04:00
CrLF0710 37a17ef40c Remove FnBox and use builtin impl FnOnce for Box<FnOnce()> instead. 2019-04-10 11:05:03 +08:00
Carol (Nichols || Goulding) 0de4a7d66a haha teach the dictionary steve's name
apparently nichols is fine????
2019-03-21 12:17:56 -04:00
Carol (Nichols || Goulding) 26bc1b2e7b spellingz 2019-03-08 20:36:03 -05:00
Carol (Nichols || Goulding) d83f107a88 spellingz 2019-03-02 08:00:40 -05:00
Carol (Nichols || Goulding) 80cf2b037f spellingz 2019-02-18 20:50:12 -05:00
Carol (Nichols || Goulding) 770ffcabcb moar spellingz 2019-01-29 20:43:36 -05:00
Carol (Nichols || Goulding) c70362845c fix spellingz 2019-01-29 20:21:26 -05:00
Alexander Regueiro d1b71d1c8e Removed copyright notices & made cosmetic improvements. 2019-01-13 03:29:45 +00:00
Carol (Nichols || Goulding) e52f6c95fa Add word to dictionary 2019-01-03 21:42:43 -05:00
Carol (Nichols || Goulding) 3ef02e197c Update dictionary 2019-01-02 11:05:53 -05:00
Carol (Nichols || Goulding) 7740400fec Fix spelling mistakes that got in while CI spellchecking was broke :P 2018-12-17 08:31:35 -05:00
Carol (Nichols || Goulding) afda93783c Add words to dictionary 2018-12-17 08:31:35 -05:00
Carol (Nichols || Goulding) a99b4f4347 Remove fancy quotes from dictionary
aspell on travis seems to be fine with these, but my local aspell is
sad about them and we have non-fancy quotes elsewhere in here sooo...
2018-12-17 08:31:35 -05:00
Carol (Nichols || Goulding) a25d1125f2 Fix default dictionary file paths 2018-12-17 08:31:35 -05:00
Carol (Nichols || Goulding) e7d52b93ce Don't create a dictionary in CI; error if it's not found 2018-12-17 08:31:35 -05:00
Steve Klabnik 1fedfc4b96 move the book to the top level 2018-11-20 13:45:05 -05:00
Dale Wijnand 6f1b4c2b9c Dedup dictionary.txt
Use the second-edition version as it has some recent additions.
2018-05-04 15:43:59 +01:00
Dale Wijnand a18d6148d3 Dedup spellcheck.sh
Fortunately they were still identical.
2018-05-04 15:38:58 +01:00
steveklabnik b9d3dad120 fix build issues
I shouldn't have deleted these tools
2018-04-05 13:25:59 -04:00
steveklabnik acc5ee2513 copy second edition to 2018 edition
Also update the GitHub links of first and second edition
2018-04-05 12:51:22 -04:00
Carol (Nichols || Goulding) 64b8474948 Adding some signposts in; I'm having trouble seeing why the build's failing 2017-11-13 13:23:28 -05:00
Carol (Nichols || Goulding) 77f88336bb Add the first edition to CI so we don't break it again 😅 2017-07-22 16:31:48 -04:00
steveklabnik e0b3a4bd00 Remove deploying to gh-pages
now that the book is on doc.rust-lang.org, there's no reason to
also deploy to gh-pages
2017-05-10 12:03:32 -04:00
steveklabnik a2c56870d4 Add license to stable-check
so this passes upstream tidy
2017-03-27 17:38:57 -04:00
steveklabnik 22279701ca these are now unused 2017-03-23 15:34:23 -04:00
steveklabnik 3207d5d4a2 simplify errors 2017-03-23 14:50:20 -04:00
steveklabnik 59f76f1a29 Check that we don't use any unstable features.
We need to track Rust master, but don't want to cover unstable things.
As such, a new lint, `stable-check`, is added.

The second edition was already lint clean, but the first needed some
tweaks:

1. The closures chapter was showing off details of the closure traits,
   so just don't do that.
2. The FFI chapter was using internal libc to compile the tests, so just
   don't compile them anymore.
3. The compiler plugins chapter was vestigial and was moved to the
   unstable book.

Fixes #558
2017-03-23 14:14:57 -04:00
Carol (Nichols || Goulding) dfda7b849d Fix the build to fail if spellchecking fails
return: can only `return' from a function or sourced script
2017-03-17 10:02:35 -04:00
steveklabnik c98b075136 Work towards getting tidy clean 2017-03-13 13:51:36 -04:00