如何修复 "use of extern prelude names introduced with `extern crate` items is unstable"

How to fix "use of extern prelude names introduced with `extern crate` items is unstable"

当我 运行 cargo build(甚至在 cargo clean 之后)时,无法编译 crate v_escape_derive 版本 0.2.1。我收到以下消息:

error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #55599)
 --> /Users/***/.cargo/registry/src/github.com-***/v_escape_derive-0.2.1/src/lib.rs:7:5
  |
7 | use proc_macro::TokenStream;
  |     ^^^^^^^^^^
  |
  = help: add #![feature(extern_crate_item_prelude)] to the crate attributes to enable

我在 cargo build 之前尝试了 运行ning cargo clean 但没有成功。

当我之前看到这些 extern crate 错误时,问题是关于 edition =2015,但我的项目的版本是 2018 并且我的项目中没有 extern crate ... 行项目文件。据我所知,问题出在外部 lib.rs 文件中(即 v_escape_derive 包的内部文件,所以我认为更改它不是一个好主意)。

即使在 Rust 2018 中,some crates are special and must be imported via extern crate。这包括 proc_macro 板条箱。

要解决此问题,请在代码中添加 extern crate proc_macro; 行。

as far as I can see, the problem is within [another crate]

然后你必须针对那个板条箱提出问题;它在稳定的 Rust 中不起作用。

具体关于v_escape_derive 0.2.1; that's an old version. The current version is 0.4没有这个问题。升级您的依赖项以合并更新。

另请参阅: