Reputation: 56620
I have a Rust application that I don't know much about, and I'm calling it from a Python program that I'm working on. I haven't changed anything in the Rust source code, but the build process for these two projects just stopped working with an error like this:
[... 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`.
I looked at the list of ndarray releases, and release 0.13.0 came out a few days ago, so I suspect that it's incompatible with my build environment.
How can I get my build working again?
Here are the full steps to reproduce the problem:
$ 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
#
Interestingly, if I run the latest docker image for rust, 1.38, I don't see the error. However, my build process is installing Rust from Ubuntu Xenial's package manager, so I probably can't upgrade it easily.
Upvotes: 2
Views: 1965
Reputation: 56620
It turned out that upgrading rust wasn't as hard as I thought, and then I don't have to change the Rust source code.
In my .travis.yml
file, I replaced this:
- sudo apt-get install -y cargo
with this:
- sudo curl https://sh.rustup.rs -sSf | sh -s -- -y
- source ~/.cargo/env
I tried adding an explicit ndarray
dependency and pinning it at 0.12, but that didn't work. Then I noticed that bio
also had a new release in the last few days. Pinning that dependency worked.
$ 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
#
Upvotes: 2