Skip to content

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

@matteo-prosperi

Description

@matteo-prosperi

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\gitlite.zycloud.tk-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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions