微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

找不到“rustc_driver”的箱子

如何解决找不到“rustc_driver”的箱子

我尝试构建以下 Rust 文件,但出现错误

src/main.rs

#![feature(rustc_private)]

extern crate rustc_driver;

fn main() {
    let value = Some(42);
    //...
}

cargo.toml

[package]
name = "cargo_test"
version = "0.1.0"
authors = ["XXX"]
edition = "2018"

[dependencies]

错误

(base) ➜  cargo_test git:(master) ✗ cargo build                           
   Compiling cargo_test v0.1.0 (XXX/cargo_test)
error[E0463]: can't find crate for `rustc_driver`
 --> src/main.rs:3:1
  |
3 | extern crate rustc_driver;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate

error: aborting due to prevIoUs error

For more information about this error,try `rustc --explain E0463`.
error: Could not compile `cargo_test`

To learn more,run the command again with --verbose.

rustc 版本:

(base) ➜  cargo_test git:(master) ✗ rustc --version
rustc 1.53.0-nightly (673d0db5e 2021-03-23)

我该怎么做才能解决问题?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。