构建 trpl-ebook 时遇到错误:没有主体的方法中不允许使用模式

Error encountered while building trpl-ebook: patterns aren't allowed in methods without bodies

我想为我的 Kindle 生成 The Rust Programming Language 的 epub 电子书。

我下载了this Github project重建本书第二版草稿。当我执行 cargo run --release 时,遇到以下错误:

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

我试图搜索和调试错误,但由于我目前对 Rust 缺乏了解而无法这样做。还有其他人遇到过这个错误吗?

我正在使用 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)

我也有filed an issue on the GitHub repo.

rustc-serialize 0.3.19 于 2016 年 4 月 4 日发布。它包括语法:

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>;

此语法在 Oct 21, 2016 (Rust 1.14.0) when it was turned into a warning. On Nov 4, 2017 (Rust 1.23.0) 之前被错误地允许,这变成了一个错误。

解决方法是更新rustc-serialize的版本:

cargo update -p rustc-serialize