Bytes_Utils has no dependents yet causes compilation errors

I project suddenly "stopped" compiling. Over the weekend. The error seems to come from bytes-utils and is copied below. My Cargo.toml is below- I am not sure which of these crates has bytes_utils as a version.

The error

   --> (...somepath)/.cargo/registry/src/github.com-1ecc6299db9ec823/bytes-utils-0.1.3/src/string/mod.rs:326:6
    |
326 | impl<S: Storage> StrInner<S> {
    |      ^
...
359 |     pub const unsafe fn from_inner_unchecked(s: S) -> Self {
    |     ------------------------------------------------------ function declared as const here
    |
    = note: see issue #93706 <https://github.com/rust-lang/rust/issues/93706> for more information

For more information about this error, try `rustc --explain E0658`.
error: could not compile `bytes-utils` due to previous error
warning: build failed, waiting for other jobs to finish...
error: build failed

Cargo.toml:

[dependencies]
async-recursion = "1.0.0"
chrono = { version = "0.4.19", features = ["serde"] }
hyper = { version = "0.14.18", features = ["full"] }
aws-config = "0.2.0"
aws-sdk-sqs = "0.2.0"
structopt = { version = "0.3", default-features = false }
mobc = "0.7.3"
mobc-postgres = "0.7.0"
mobc-redis = "0.7.0"
postgres = {version = "0.19.1", features = ["with-chrono-0_4"] }
redis = { version = "0.21.5", features = ["tokio-comp"] }
reqwest = { version = "0.11.11", features = ["json"] }
seahash = "4.1.0"
serde = { version = "1.0.137", features = ["derive"] }
serde_json = "1.0.82"
tokio = { version = "1.19.2", features = ["full"] }
tokio-postgres = "0.7.6"
[dev-dependencies]
rand = "0.8.5"

Crates.io shows that bytes-utils has been yanked and only goes up to v0.1.1- how v0.1.3 can cause issues now perplexes me.
https://crates.io/crates/byte_utils/versions

Do you have Cargo.lock in your project? If yes, could you rename it and try to build again, so that Cargo resolves dependencies from scratch?

You're looking for bytes-utils (https://crates.io/crates/bytes-utils), not byte_utils. Easy mistake to make, I didn't notice it at first either. There's a line missing from the error message, error[E0658]: trait bounds other than `Sized` on const fn parameters are unstable, which usually means that your compiler version is too old (or the crate really is using unstable features, in which case it would require nightly). From the issue linked (Tracking Issue for `const_fn_trait_bound` · Issue #93706 · rust-lang/rust · GitHub), we can find the stabilization PR (Stabilize const_fn_fn_ptr_basics, const_fn_trait_bound, and const_impl_trait by eholk · Pull Request #93827 · rust-lang/rust · GitHub) and see that it was part of the 1.61.0 milestone.

In short, you need to update your compiler to at least 1.61.0. The easiest way to do this is to update to the latest version by running rustup update.

2 Likes

That did it- thanks. Thanks also for teaching me to fish a bit with the nudge toward the stabilization PR.

1 Like