2

当我尝试在 macOS Sierra 10.12.6 中使用 bitflags v1.0.1 在 Rust 中构建项目时,代码失败并出现以下错误:

Compiling bitflags v1.0.1
error: expected ident, found #
   --> /Users/kenneth.marete/.cargo/registry/src/github.com-1ecc6299db9ec823/bitflags-1.0.1/src/lib.rs:423:29
    |
423 |                               #[allow(deprecated)]
    |                               ^
    | 
   ::: /Users/kenneth.marete/.cargo/registry/src/github.com-1ecc6299db9ec823/bitflags-1.0.1/src/example_generated.rs
    |
4   | / bitflags! {
5   | |     /// This is the same `Flags` struct defined in the [crate level example](../index.html#example).
6   | |     /// Note that this struct is just for documentation purposes only, it must not be used outside
7   | |     /// this crate.
...   |
13  | |     }
14  | | }
    | |_- in this macro invocation

我希望它能够成功构建。

4

1 回答 1

7

一些 crate 可能由于使用比最低要求更早的 Rust 版本进行编译而无法编译。它与操作系统版本或应用程序本身无关。

由于使用了关联的常量,我有rustc 1.19.0 (0ade33941 2017-07-17)while bitflags 版本 1.0.1 具有最低支持的 Rust 版本 1.20。

不时通过运行更新 Rust 编译器rustup update

于 2017-12-06T20:40:17.230 回答