使用不稳定库功能“iter_nth_back”的 Rust 包

2023-12-03

我有一个我不太了解的 Rust 应用程序,我正在从我正在开发的 Python 程序中调用它。我没有更改 Rust 源代码中的任何内容,但这两个项目的构建过程只是停止工作并出现如下错误:

[... several similar errors]
error[E0658]: use of unstable library feature 'iter_nth_back'
   --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/ndarray-0.13.0/src/iterators/mod.rs:585:46
    |
585 |         either_mut!(self.inner, iter => iter.nth_back(n))
    |                                              ^^^^^^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/56995

error: aborting due to 5 previous errors

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

我查看了名单ndarray 版本,几天前发布了 0.13.0 版本,所以我怀疑它与我的构建环境不兼容。

我怎样才能让我的构建再次运行?

以下是重现该问题的完整步骤:

$ sudo docker run -it --rm rust:1.36.0
# USER=foo cargo new hello_world --bin
     Created binary (application) `hello_world` package
# cd hello_world/
# echo 'bio = "^0"' >> Cargo.toml
# cargo build
    Updating crates.io index
  Downloaded bio v0.29.0
  Downloaded [... many more ...]
  Downloaded ndarray v0.13.0
  Downloaded [... many more ...]
   Compiling proc-macro2 v1.0.4
   Compiling [... many more ...]
   Compiling ndarray v0.13.0
   Compiling [... many more ...]
   Compiling statrs v0.11.0
error[E0658]: use of unstable library feature 'iter_nth_back'
   --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/ndarray-0.13.0/src/iterators/mod.rs:134:5
    |
134 | /     fn nth_back(&mut self, n: usize) -> Option<*mut A> {
135 | |         let index = self.index?;
136 | |         let len = self.dim[0] - index[0];
137 | |         if n < len {
...   |
147 | |         }
148 | |     }
    | |_____^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/56995
[... other, similar errors ...]
   Compiling serde_derive v1.0.101
   Compiling strum_macros v0.16.0
   Compiling snafu-derive v0.5.0
error: aborting due to 5 previous errors

For more information about this error, try `rustc --explain E0658`.
error: Could not compile `ndarray`.
warning: build failed, waiting for other jobs to finish...
error: build failed
#

有趣的是,如果我运行最新的 rust docker 镜像 1.38,我不会看到错误。然而,我的构建过程是从 Ubuntu Xenial 的包管理器安装 Rust,所以我可能无法轻松升级它。


新答案:升级 Rust

事实证明,升级 rust 并没有我想象的那么难,然后我就不用改 Rust 源代码了。

In my .travis.yml文件,我替换了这个:

- sudo apt-get install -y cargo

有了这个:

- sudo curl https://sh.rustup.rs -sSf | sh -s -- -y
- source ~/.cargo/env

原始答案:引脚依赖性

我尝试添加一个明确的ndarray依赖性并将其固定在 0.12,但这不起作用。然后我注意到bio最近几天也发布了新版本。固定这种依赖是有效的。

$ sudo docker run -it --rm rust:1.36.0
# USER=foo cargo new hello_world --bin
     Created binary (application) `hello_world` package
# cd hello_world/
# echo 'bio = "~0.28.2"' >> Cargo.toml
# cargo build
    Updating crates.io index
  Downloaded bio v0.28.2
  Downloaded [... many more ...]
  Downloaded ndarray v0.12.1
  Downloaded [... many more ...]
   Compiling proc-macro2 v1.0.4
   Compiling [... many more ...]
   Compiling ndarray v0.12.1
   Compiling [... many more ...]
   Compiling csv v1.1.1
   Compiling hello_world v0.1.0 (/hello_world)
    Finished dev [unoptimized + debuginfo] target(s) in 14m 15s
#
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用不稳定库功能“iter_nth_back”的 Rust 包 的相关文章

随机推荐

  • IE 条件注释与 Sass 和 Bourbon

    我想为不同的浏览器提供不同的字体 请参阅这个问题 有没有一种巧妙的方法可以用 Sass Bourbon 来做到这一点 这是我到目前为止所拥有的 include font face myicons myicons weight normal
  • 区分 NTAG213 和 MF0ICU2

    有没有什么方法可以区分NTAG213 from a MF0ICU2基于 UID ATQA 或 SAK 值的标签 由于我必须对标签进行不同的编程 NTAG213 的 PWD PACK 或 MF0ICU2 的 3DES 因此必须有一种方法来调用
  • Redux 中连接的组件未接收存储属性

    我正在进行一些重构 并尝试使用以下命令将更高级别的组件连接到 reduxconnect 但我正在连接的组件一直给我空的道具 我已经包含了相关的代码 我已经将我的 redux 减速器构造成ducks格式 因此操作 创建者和缩减者位于一个模块文
  • Android Microsoft Office 库(.doc、.docx、.xls、.ppt 等)[关闭]

    Closed 此问题正在寻求书籍 工具 软件库等的推荐 不满足堆栈溢出指南 目前不接受答案 有谁知道有一个好的 Java Microsoft Office API 能够在 Android 上运行吗 我知道有一个 OpenOffice Jav
  • C# 从 byte[] 转换为 struct。字节顺序错误

    我试图在实现基于 UDP 的协议时使用结构来解析套接字数据 我搜索了一下 可以使用这两个函数在 byte 和 struct 之间进行转换 byte StructToBytes object structObj int size Marsha
  • Google Play 不显示我的平板电脑应用程序?

    我也想显示我的平板电脑应用程序 需要遵循哪些必要步骤才能使我的应用程序也列出平板电脑 我的应用程序已经列出手机 我在这里遗漏了什么吗 请提供您的帮助 谢谢 将以下代码写入您的 Androidmanifest xml 文件
  • 当表单验证为 false 时,留在当前页面

    如果 名称 输入字段为空 我想留在当前页面 现在 它显示错误消息 当您单击 确定 时 它仍然会转到下一页 联系 captcha php function notEmpty elem helperMsg if elem value lengt
  • 使用 nth-child 的样式来保持表的外观(交替行颜色)更新

    我有一个像这样的 CSS 表 这是我的系统的可靠简化 div class table div class row div class data abc div div div class row div class data def div
  • 如何继承std::ostream?

    我一直在谷歌上搜索 但找不到一个简单的答案 而且它应该很简单 就像 STL 一样 我想定义从 std ostream 公开继承的 MyOStream 假设每次有东西写入我的流时我想调用 foo class MyOStream public
  • 您使用哪种 HTML5 重置 CSS?为什么? [关闭]

    Closed 这个问题是基于意见的 目前不接受答案 您使用哪种 HTML5 重置 CSS 为什么 您是否发现可以涵盖更多案例的案例 我已经开始使用 HTML5 Doctor s http html5doctor com html 5 res
  • Android Firebase 无法将 java.util.HashMap 类型的值转换为 String

    我正在尝试在我的片段上使用数组适配器来使用列表视图 但是当尝试使用教程执行此操作时 每次我打开该特定片段时它都会崩溃 我试图将我的 firebase 上的数据显示到列表视图中 但每次我打开它时它都会崩溃 Here s my database
  • 带有子图的多个标题(副标题)

    我在 3x3 网格中有一系列 9 个子图 每个子图都有一个标题 我想为每一行添加一个标题 为此 我考虑使用字幕 问题是 如果我使用 3 个字幕 它们似乎会被覆盖 并且似乎只显示最后一个 这是我的基本代码 fig axes plt subpl
  • Java 泛型 T 与对象

    我想知道以下两个方法声明有什么区别 public Object doSomething Object obj public
  • Google App Engine 部署错误[12] 无法分配内存

    我的应用程序正在运行 Google App Engine 标准环境 Python 37 我使用 gcloud 部署我的应用程序 如下命令 gcloud app deploy project 项目名称 version uno 我的构建失败 出
  • Phonegap:源 URL 不在白名单中

    我正在尝试让 PhoneGap 2 4 0 FileTransfer 在 Android 4 2 上运行 我收到一条 Logcat 警告消息 The Source URL is not in white list http api etc
  • 使用动态文件在 EC2 上挂载 S3 (s3fs) - 持久公共权限

    使用 S3FS 和 FUSE 将 S3 存储桶挂载到 AWS EC2 实例时 我遇到了一个问题 我的 S3 文件正在更新 但新文件没有采用适当的权限 新文件拥有的 ACL 权限是 而不是 rw r r 我已通过以下方式确保铲斗已正确安装 s
  • 强制 Play 框架仅在本地主机上侦听

    如何强制 Play Framework 仅在本地主机上侦听我希望该剧能够在 localhost 9000 上监听 而不是在 0 0 0 0 9000 上监听所以外部IP无法访问我尝试使用http 地址 127 0 0 1 在 applica
  • JSSE 是否使用 PrivateKeyEntry 中的证书作为信任锚?

    如果密钥库包含一个或多个PrivateKeyEntry被指定为信任存储 JSSE 是否会根据每个条目中的最终实体证书创建信任锚 换句话说 拥有一个证书就足够了吗 PrivateKeyEntry如果我们有一个包含可信条目和私有条目的密钥库 或
  • 将 R S3 普通函数转换为泛型函数

    仅供参考 看起来这个问题已经有一个LISP 等效项 最近我想为 R 基本函数创建一个数据框扩展setdiff并认为通用会很好 以下方法可以工作 但很笨拙 export setdiff default setdiff default lt s
  • 使用不稳定库功能“iter_nth_back”的 Rust 包

    我有一个我不太了解的 Rust 应用程序 我正在从我正在开发的 Python 程序中调用它 我没有更改 Rust 源代码中的任何内容 但这两个项目的构建过程只是停止工作并出现如下错误 several similar errors error