1
votes

I want to generate the epub ebook of The Rust Programming Language for my Kindle.

I downloaded this Github project to rebuild the book the second edition draft. When I do cargo run --release, I encounter the following error:

nabarun@pal:~/codesl/trpl-ebook (git:master) $ cargo run --release
   Compiling rustc-serialize v0.3.19
   Compiling memchr v0.1.11
   Compiling kernel32-sys v0.2.2
error[E0642]: patterns aren't allowed in methods without bodies
   --> /home/nabarun/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-serialize-0.3.19/src/serialize.rs:147:45
    |
147 |                                             &f_name: &str,
    |                                             ^^^^^^^

   Compiling aho-corasick v0.5.3
   Compiling thread-id v2.0.0
   Compiling thread_local v0.2.7
   Compiling regex v0.1.77
error: aborting due to previous error

error: Could not compile `rustc-serialize`.
warning: build failed, waiting for other jobs to finish...
error: build failed

I tried to search and debug the error but couldn't do so owing to my lack of knowledge of Rust at the moment. Did anyone else encounter this error?

I am using Ubuntu 16.04, Rust 1.25.0-nightly (b5392f545 2018-01-08), xargo 0.3.10, cargo 0.25.0-nightly (a88fbace4 2017-12-29)

I have also filed an issue on the GitHub repo.

1

1 Answers

8
votes

rustc-serialize 0.3.19 was released on April 4, 2016. It includes the syntax:

fn read_enum_struct_variant_field<T, F>(
    &mut self,
    &f_name: &str, // This is no longer allowed
    f_idx: usize,
    f: F,
) -> Result<T, Self::Error>;

This syntax was erroneously allowed until Oct 21, 2016 (Rust 1.14.0) when it was turned into a warning. On Nov 4, 2017 (Rust 1.23.0), this became an error.

The solution is to update the version of rustc-serialize:

cargo update -p rustc-serialize