【问题标题】:Cannot build plugin example无法构建插件示例
【发布时间】:2019-07-02 07:18:06
【问题描述】:

我正在尝试从书中构建the plugin example,但它不起作用:

rustc failed to resolve: could not find `quote` in `ext`

我该怎么办?该示例甚至没有任何构建说明。这是故意的吗?

【问题讨论】:

  • 您使用的是哪个版本的 rust ?它使用 rust roman_numerals.rs 编译 rustc 1.32.0-nightly
  • 也许我明白了,您指向github-repocode in the book 的链接不同。尝试github中的代码。
  • 而且 github 中的代码说 This code also appears in src/doc/unstable-book/src/language-features/plugin.md. Please keep the two copies in sync! FIXME: have rustdoc read this file,但直到现在还没有同步。
  • @ymonad 是的,我使用了书中的代码。使用 github repo 中的代码而不是书中的代码使其编译。非常感谢。我被困了好几天。
  • 很高兴您解决了这个问题。也许我应该将其发布为将来可能陷入困境的人的答案。

标签: compiler-errors rust rust-cargo


【解决方案1】:

code in the unstable bookcode in current source of rust 是不同的。

在代码中,它说:

此代码也出现在 src/doc/unstable-book/src/language-features/plugin.md 中。

请保持两个副本同步! FIXME:让 rustdoc 读取此文件

但直到现在似乎还没有修复。

你的错误发生在不稳定书的use syntax::ext::quote::rt::Span;,目前应该是use syntax_pos::Span;

由于本书是针对 rust 中的不稳定特性,根据top page of the book

由于本文档涉及不稳定的功能,我们不保证此处包含的内容是准确的或最新的。它是在尽力而为的基础上开发的。每个页面都有一个指向其跟踪问题的链接,其中包含最新动态;你可能也想检查一下。

因此,本书其他代码可能存在类似问题。

【讨论】:

猜你喜欢
  • 2021-09-01
  • 1970-01-01
  • 2022-09-29
  • 2011-04-22
  • 2011-05-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-08-17
相关资源
最近更新 更多