Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cargo install cargo-deny fails during the compilation of smol_str #265

Closed
matteo-prosperi opened this issue Sep 25, 2020 · 3 comments · Fixed by #266
Closed

cargo install cargo-deny fails during the compilation of smol_str #265

matteo-prosperi opened this issue Sep 25, 2020 · 3 comments · Fixed by #266
Labels
bug Something isn't working

Comments

@matteo-prosperi
Copy link

matteo-prosperi commented Sep 25, 2020

Describe the bug
cargo install cargo-deny fails with the following error:

PS C:\Users\myuser\Desktop\test> cargo install cargo-deny
    Updating crates.io index
  Installing cargo-deny v0.7.3
   Compiling autocfg v1.0.1

...

   Compiling proc-macro2 v1.0.22
   Compiling zstd-safe v2.0.5+zstd.1.4.5
   Compiling zstd v0.5.3+zstd.1.4.5
   Compiling smol_str v0.1.17
   Compiling hex v0.4.2
   Compiling semver v0.10.0
error[E0658]: `while` is not allowed in a `const fn`
  --> C:\Users\myuser\.cargo\registry\src\github.com-1ecc6299db9ec823\smol_str-0.1.17\src\lib.rs:58:9
   |
58 | /         while i < text.len() {
59 | |             buf[i] = text.as_bytes()[i];
60 | |             i += 1
61 | |         }
   | |_________^
   |
   = note: see issue #52000 <https://github.com/rust-lang/rust/issues/52000> for more information

error: aborting due to previous error

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

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: failed to compile `cargo-deny v0.7.3`, intermediate artifacts can be found at `C:\Users\myuser\AppData\Local\Temp\cargo-installS1XFRH`

Caused by:
  build failed

To Reproduce
Simply run cargo install cargo-deny.
I reproduced this on Windows, but I don't think this is platform-specific.

Expected behavior
cargo install cargo-deny should not fail

Device:

  • OS: Windows 10
  • Version: cargo-deny 0.7.3 (the issue is caused by smol_str 0.1.17)

Additional context
This other project has encountered the same issue recently and addressed it by pinning the version of smol_str: rustsec/rustsec#258.

@matteo-prosperi matteo-prosperi added the bug Something isn't working label Sep 25, 2020
@repi
Copy link
Contributor

repi commented Sep 25, 2020

Thanks for the report, found this original issue on smol_str repo rust-analyzer/smol_str#25 and it defines minimum Rust version as "latest stable" Rust, which makes cargo-deny also require latest stable Rust.

That may be a bit too aggressive for a tool, though we generally also just use latest stable. But could consider pinning it to the previous version for now, or replacing it (depending on which of our dependencies are using it).

If you are able to, then updating to latest stable with rustup update, and then building/installing it should just work then.

@matteo-prosperi
Copy link
Author

I confirm that the problem is solved when updating to cargo 1.46.0. I previously was on cargo 1.45.2.
I also agree that, for a tool, requiring the very latest version of the language is very aggressive: some users may be unable to update their build infrastructure right away.
Thanks for quickly replying.
Feel free to close this if you decide not to address it.

@Jake-Shadle
Copy link
Member

Thanks for reporting this, I'll update rustsec so that we don't need absolute latest stable and add a MSRV notice on the Readme, as well as a ci check for the lowest version we can support so at least when it changes we are aware about it and can update the Readme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants