rust - cargo 构建失败 : could not find macro `llvm_asm` in this scope

标签 rust rust-cargo

我正在尝试构建 rust-fractal-gui但构建总是因这些错误而失败:

$ cargo build --release

...

Compiling parking_lot v0.11.2
error: cannot find macro `llvm_asm` in this scope
  --> /home/riley/.cargo/registry/src/github.com-1ecc6299db9ec823/parking_lot-0.11.2/src/elision.rs:77:13
   |
77 |             llvm_asm!("xacquire; lock; cmpxchgq $2, $1"
   |             ^^^^^^^^

error: cannot find macro `llvm_asm` in this scope
   --> /home/riley/.cargo/registry/src/github.com-1ecc6299db9ec823/parking_lot-0.11.2/src/elision.rs:108:13
    |
108 |             llvm_asm!("xrelease; lock; xaddq $2, $1"
    |             ^^^^^^^^

error[E0635]: unknown feature `llvm_asm`
  --> /home/riley/.cargo/registry/src/github.com-1ecc6299db9ec823/parking_lot-0.11.2/src/lib.rs:14:42
   |
14 | #![cfg_attr(feature = "nightly", feature(llvm_asm))]
   |                                          ^^^^^^^^

For more information about this error, try `rustc --explain E0635`.
error: could not compile `parking_lot` due to 3 previous errors
warning: build failed, waiting for other jobs to finish...

rustup show 的输出:

rustup home:  /home/riley/.rustup

installed toolchains
--------------------

stable-x86_64-unknown-linux-gnu (default)
nightly-x86_64-unknown-linux-gnu
1.48.0-x86_64-unknown-linux-gnu

active toolchain
----------------

nightly-x86_64-unknown-linux-gnu (directory override for '/home/riley/projects/rust-fractal-gui')
rustc 1.64.0-nightly (c2f428d2f 2022-07-14)

我已经使用 rustup update nightlyrustup override set nightly 将我的夜间工具链更新到最新版本 see this issue但它没有解决问题。

最佳答案

rustc-nightly-2022-01-17 开始,宏 llvm_asm! 被移除,取而代之的是新的 asm! 宏。 rust-fractal-gui 使用的是 parking_lot 的过时版本,它仍然使用 llvm_asm! 宏,导致此错误。 PR已经合并,解决了这个问题。

关于rust - cargo 构建失败 : could not find macro `llvm_asm` in this scope,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72998962/

相关文章:

rust - 范围内的变量超出范围时是否复制到不同的内存位置?

rust - 为什么不能在同一结构中存储值和对该值的引用?

rust - ~/.rustup 和 ~/.cargo 中的二进制文件有什么区别?

rust - 我可以获得 Rust 链接的原生工件的完整路径吗?

rust - 运行 cargo run 时带有行号的堆栈跟踪

rust - 我的 crate 如何检查依赖项的选定功能?

rust - |x| 的类型是什么移动|y| x+y?

rust - 可扩展的类型注册

rust - 如何指定特征函数采用实现特征的参数?

rust - 如何在Abs中实现Abs函数以自定义类型?