pacman82 / atoi-rs

Parse integers directly from `[u8]` slices in safe code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

atoi not compiling

surajprak opened this issue · comments

Running rustc --crate-name miniz_sys /root/.cargo/registry/src/github.com-1ecc6299db9ec823/miniz-sys-0.1.11/lib.rs --color always --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=e65befefb23c7769 -C extra-filename=-e65befefb23c7769 --out-dir /build/payu_dsl_core/target/debug/deps -L dependency=/build/payu_dsl_core/target/debug/deps --extern libc=/build/payu_dsl_core/target/debug/deps/liblibc-ce458dbe79fb3a18.rlib --cap-lints allow -L native=/build/payu_dsl_core/target/debug/build/miniz-sys-a3f99b13e51535d4/out -l static=miniz
error: Edition 2018 is unstable and only available for nightly builds of rustc.

error: Could not compile atoi.

My environment details
rustc 1.30.0
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-alpine-linux-musl
release: 1.30.0
LLVM version: 5.0

cargo 1.30.0
release: 1.30.0

/build/payu_dsl_core # rustc --crate-name atoi /root/.cargo/registry/src/github.com-1ecc6299db9ec823/atoi-0.2.4/src/lib.rs --color always --crate-type lib --emit=dep-info
,link -C debuginfo=2 -C metadata=53cd42854cd082df -C extra-filename=-53cd42854cd082df --out-dir /build/payu_dsl_core/target/debug/deps -L dependency=/build/payu_dsl_core/
target/debug/deps --extern num_traits=/build/payu_dsl_core/target/debug/deps/libnum_traits-ce520d57f16c43c1.rlib --cap-lints allow
error[E0432]: unresolved import num_traits
--> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/atoi-0.2.4/src/lib.rs:23:5
|
23 | use num_traits::{One, Signed, Zero};
| ^^^^^^^^^^ Maybe a missing extern crate num_traits;?

error: aborting due to previous error

For more information about this error, try rustc --explain E0432.

Can you please add extern crate num_traits; I think it was removed accidently in lib.rs?

Hello @surajpayu,
no, it has not been removed by accident. I've just been switching over to the new rust 2018 edition. You do not have to switch your crate to 2018, too, but you need to update your Rust version in order to use the newest version of this crate.

I'm still thankful for your issue, though. It servers as a reminder that I should have probably waited a bit longer before using the new hot stuff.

On the other hand, the fix might be as simple as typing rustup update.

If that is not possible, you can pin the version exactly in your Cargo.toml:

atoi = "= 0.2.3"

Actually i am working on Alpine and current rustc version is 1.3.0 and i am having tough time installing rustup
I cant change atoi version to 0.2.3 as i am not using it directly, it is being used by other library on which i am dependent

Have you tried: cargo update -p atoi --precise 0.2.3? This should work even if atoi is an indirect dependency.

why use 2018 edition? It's not stable, and now it break our build.

hello @killme2008, I am sorry you are having problem with your build. Rust 2018 is stable. If you upgrade your compiler to 1.31.0 it will compile just fine, even if your crate is edition 2015. If upgrading your compiler is not an option, you can always pin atoi to an earlier version. cargo update -p atoi --precise 0.2.3.

Looking back, I should not have changed the edition in a release which only increments the patch version. I could offer to yank version 0.2.4 from crates.io, so cargo update won't switch from 0.2.3 to 0.2.4 automatically. @killme2008, @surajpayu would this fix your build problems?

I am closing this and promise not to break compiler compatibility in patch versions in the future.