gpt4 book ai didi

rust - 构建 trpl-ebook 时遇到错误 : patterns aren't allowed in methods without bodies

转载 作者:行者123 更新时间:2023-11-29 08:22:06 26 4
gpt4 key购买 nike

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

我下载了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) 之前被错误地允许当它变成警告时。在 Nov 4, 2017 (Rust 1.23.0) , 这变成了一个错误。

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

cargo update -p rustc-serialize

关于rust - 构建 trpl-ebook 时遇到错误 : patterns aren't allowed in methods without bodies,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48357712/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com