Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chapter 19-6 in online version is missing the second half #1668

Closed
tcmarsh opened this issue Dec 7, 2018 · 1 comment
Closed

Chapter 19-6 in online version is missing the second half #1668

tcmarsh opened this issue Dec 7, 2018 · 1 comment

Comments

@tcmarsh
Copy link

tcmarsh commented Dec 7, 2018

When viewing the online version of the book at https://doc.rust-lang.org/book/, chapter 19-6 (https://doc.rust-lang.org/book/ch19-06-macros.html) ends with the text

To start defining the procedural macro, place the code in Listing 19-39 into your src/lib.rs file for the hello_macro_derive crate. Note that this code won’t compile until we add a definition for the impl_hello_macro function.

and what I assume to be the title legend for the code listing (which isn't there).

In the repository, the rest of the chapter is showing, so I believe this to be an issue with how the book generation happened.

@carols10cents
Copy link
Member

LOL when I view source:

<p>To start defining the procedural macro, place the code in Listing 19-39 into
your <em>src/lib.rs</em> file for the <code>hello_macro_derive</code> crate. Note that this code
won’t compile until we add a definition for the <code>impl_hello_macro</code> function.</p>
<p><span class="filename">Filename: hello_macro_derive/src/lib.rs</span></p>
<!--
This usage of `extern crate` is required for the moment with the 1.31 code
that's currently rustc 1.31.0-beta.4 (04da282bb 2018-11-01), see:
<ul>
<li>https://github.com/rust-lang/rust/issues/54418</li>
<li>https://github.com/rust-lang/rust/pull/54658</li>
<li>https://github.com/rust-lang/rust/issues/55599
--&gt;</li>
</ul>
<pre><code class="language-rust ignore">extern crate proc_macro;

The comment never ends and hides the rest of the chapter, oops!! 🤣🤣😭 Working on fixing it now!

carols10cents added a commit that referenced this issue Dec 7, 2018
Fixes #1668.

Apparently if there are newlines in HTML comments, pulldown-cmark
switches to markdown and escapes the --> so that the comment never ends
:(

pulldown-cmark/pulldown-cmark#124
bors added a commit to rust-lang/rust that referenced this issue Dec 8, 2018
Update the book to fix some edition-related bugs

I'd love to have this included in a point release if one happens, but the changes aren't worth doing a point release on their own IMO. I'd definitely like to see this backported to beta.

The most urgent changes included here are:

- Chapter 19.6, on macros (including the macro changes that just stabilized), [is cut off](rust-lang/book#1668) because of an ill-placed newline in a comment that [pulldown-cmark interprets incorrectly](pulldown-cmark/pulldown-cmark#124).
- [The `Cargo.toml` shown in the Guessing Game example in Chapter 2 (and one in Chapter 14) doesn't have `edition="2018"`](rust-lang/book#1671), which can be confusing depending on whether the readers have it in theirs or not, think they should remove it if they have it, and the rest of the chapter assumes it's there and the code doesn't compile if you don't have it.
- The redirects implemented as part of only shipping the 2018 edition of the book sometimes lead to [having to click through 2 redirect pages](rust-lang/book#1667) when it could be just one.

There are other small corrections included that were made since the last time the book was updated, but those aren't urgent.

cc @steveklabnik
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants