Basic "cargo build" compilation failing for meilisearch-sdk v0.27.1 and rustc 1.83.0
Description Basic "cargo build" compilation failing for meilisearch-sdk v0.27.1 and rustc 1.83.0.
See the errors below.
Expected behavior Clean compilation of the the meilisearch-sdk.
Current behavior See these errors produced during the cargo build compilation:
Compiling meilisearch-sdk v0.27.1
error: expected identifier, found `1hits`
--> /Users/scottyancey/.cargo/registry/src/index.crates.io-6f17d22bba15001f/meilisearch-sdk-0.27.1/src/search.rs:72:9
|
72 | pub 1hits: Vec<SearchResult<T>>,
| ^^^^^ expected identifier
|
help: identifiers cannot start with a number
--> /Users/scottyancey/.cargo/registry/src/index.crates.io-6f17d22bba15001f/meilisearch-sdk-0.27.1/src/search.rs:72:9
|
72 | pub 1hits: Vec<SearchResult<T>>,
| ^
error: expected identifier
--> /Users/scottyancey/.cargo/registry/src/index.crates.io-6f17d22bba15001f/meilisearch-sdk-0.27.1/src/search.rs:72:9
|
72 | pub 1hits: Vec<SearchResult<T>>,
| ^^^^^
Compiling colored v2.1.0
error[E0277]: the trait bound `search::SearchResults<T>: DeserializeOwned` is not satisfied
--> /Users/scottyancey/.cargo/registry/src/index.crates.io-6f17d22bba15001f/meilisearch-sdk-0.27.1/src/indexes.rs:233:14
|
233 | .request::<(), &SearchQuery<Http>, SearchResults<T>>(
| ^^^^^^^ the trait `for<'de> Deserialize<'de>` is not implemented for `search::SearchResults<T>`, which is required by `search::SearchResults<T>: DeserializeOwned`
|
= help: the following other types implement trait `Deserialize<'de>`:
`&'a Path` implements `Deserialize<'de>`
`&'a [u8]` implements `Deserialize<'de>`
`&'a serde_json::value::RawValue` implements `Deserialize<'de>`
`&'a str` implements `Deserialize<'de>`
`()` implements `Deserialize<'de>`
`(T,)` implements `Deserialize<'de>`
`(T0, T1)` implements `Deserialize<'de>`
`(T0, T1, T2)` implements `Deserialize<'de>`
and 250 others
= note: required for `search::SearchResults<T>` to implement `DeserializeOwned`
note: required by a bound in `request::HttpClient::request`
--> /Users/scottyancey/.cargo/registry/src/index.crates.io-6f17d22bba15001f/meilisearch-sdk-0.27.1/src/request.rs:80:17
|
71 | async fn request<Query, Body, Output>(
| ------- required by a bound in this associated function
...
80 | Output: DeserializeOwned + 'static + Send,
| ^^^^^^^^^^^^^^^^ required by this bound in `HttpClient::request`
error[E0277]: the trait bound `search::SearchResults<T>: Deserialize<'_>` is not satisfied
--> /Users/scottyancey/.cargo/registry/src/index.crates.io-6f17d22bba15001f/meilisearch-sdk-0.27.1/src/search.rs:642:18
|
642 | pub results: Vec<SearchResults<T>>,
| ^^^^^^^^^^^^^^^^^^^^^ the trait `Deserialize<'_>` is not implemented for `search::SearchResults<T>`, which is required by `Vec<search::SearchResults<T>>: Deserialize<'_>`
|
= note: for local types consider adding `#[derive(serde::Deserialize)]` to your `search::SearchResults<T>` type
= note: for types from other crates check whether the crate offers a `serde` feature flag
= help: the following other types implement trait `Deserialize<'de>`:
`&'a Path` implements `Deserialize<'de>`
`&'a [u8]` implements `Deserialize<'de>`
`&'a serde_json::value::RawValue` implements `Deserialize<'de>`
`&'a str` implements `Deserialize<'de>`
`()` implements `Deserialize<'de>`
`(T,)` implements `Deserialize<'de>`
`(T0, T1)` implements `Deserialize<'de>`
`(T0, T1, T2)` implements `Deserialize<'de>`
and 247 others
= note: required for `Vec<search::SearchResults<T>>` to implement `Deserialize<'_>`
note: required by a bound in `next_element`
--> /Users/scottyancey/.cargo/registry/src/index.crates.io-6f17d22bba15001f/serde-1.0.210/src/de/mod.rs:1732:12
|
1730 | fn next_element<T>(&mut self) -> Result<Option<T>, Self::Error>
| ------------ required by a bound in this associated function
1731 | where
1732 | T: Deserialize<'de>,
| ^^^^^^^^^^^^^^^^ required by this bound in `SeqAccess::next_element`
error[E0277]: the trait bound `search::SearchResults<T>: Deserialize<'_>` is not satisfied
--> /Users/scottyancey/.cargo/registry/src/index.crates.io-6f17d22bba15001f/meilisearch-sdk-0.27.1/src/search.rs:642:18
|
642 | pub results: Vec<SearchResults<T>>,
| ^^^^^^^^^^^^^^^^^^^^^ the trait `Deserialize<'_>` is not implemented for `search::SearchResults<T>`, which is required by `Vec<search::SearchResults<T>>: Deserialize<'_>`
|
= note: for local types consider adding `#[derive(serde::Deserialize)]` to your `search::SearchResults<T>` type
= note: for types from other crates check whether the crate offers a `serde` feature flag
= help: the following other types implement trait `Deserialize<'de>`:
`&'a Path` implements `Deserialize<'de>`
`&'a [u8]` implements `Deserialize<'de>`
`&'a serde_json::value::RawValue` implements `Deserialize<'de>`
`&'a str` implements `Deserialize<'de>`
`()` implements `Deserialize<'de>`
`(T,)` implements `Deserialize<'de>`
`(T0, T1)` implements `Deserialize<'de>`
`(T0, T1, T2)` implements `Deserialize<'de>`
and 247 others
= note: required for `Vec<search::SearchResults<T>>` to implement `Deserialize<'_>`
note: required by a bound in `next_value`
--> /Users/scottyancey/.cargo/registry/src/index.crates.io-6f17d22bba15001f/serde-1.0.210/src/de/mod.rs:1871:12
|
1869 | fn next_value<V>(&mut self) -> Result<V, Self::Error>
| ---------- required by a bound in this associated function
1870 | where
1871 | V: Deserialize<'de>,
| ^^^^^^^^^^^^^^^^ required by this bound in `MapAccess::next_value`
error[E0277]: the trait bound `search::SearchResults<T>: Deserialize<'_>` is not satisfied
--> /Users/scottyancey/.cargo/registry/src/index.crates.io-6f17d22bba15001f/meilisearch-sdk-0.27.1/src/search.rs:640:24
|
640 | #[derive(Debug, Clone, Deserialize)]
| ^^^^^^^^^^^ the trait `Deserialize<'_>` is not implemented for `search::SearchResults<T>`, which is required by `Vec<search::SearchResults<T>>: Deserialize<'_>`
|
= note: for local types consider adding `#[derive(serde::Deserialize)]` to your `search::SearchResults<T>` type
= note: for types from other crates check whether the crate offers a `serde` feature flag
= help: the following other types implement trait `Deserialize<'de>`:
`&'a Path` implements `Deserialize<'de>`
`&'a [u8]` implements `Deserialize<'de>`
`&'a serde_json::value::RawValue` implements `Deserialize<'de>`
`&'a str` implements `Deserialize<'de>`
`()` implements `Deserialize<'de>`
`(T,)` implements `Deserialize<'de>`
`(T0, T1)` implements `Deserialize<'de>`
`(T0, T1, T2)` implements `Deserialize<'de>`
and 247 others
= note: required for `Vec<search::SearchResults<T>>` to implement `Deserialize<'_>`
note: required by a bound in `client::_::_serde::__private::de::missing_field`
--> /Users/scottyancey/.cargo/registry/src/index.crates.io-6f17d22bba15001f/serde-1.0.210/src/private/de.rs:25:8
|
23 | pub fn missing_field<'de, V, E>(field: &'static str) -> Result<V, E>
| ------------- required by a bound in this function
24 | where
25 | V: Deserialize<'de>,
| ^^^^^^^^^^^^^^^^ required by this bound in `missing_field`
= note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
For more information about this error, try `rustc --explain E0277`.
error: could not compile `meilisearch-sdk` (lib) due to 6 previous errors
warning: build failed, waiting for other jobs to finish...
Here's my project dependencies:
[dependencies]
axum = { version = "0.7.0" , features = ["tokio", "http1", "tracing"] }
serde = { version = "1.0.204", features = ["derive"] }
sqlx = { version = "0.8.0", features = ["postgres", "runtime-tokio-native-tls", "uuid"] }
sqlx-cli = { version = "0.8.0", default-features = false, features = ["native-tls", "postgres"] }
tokio = { version = "1", features = ["full"] }
tower-http = { version = "0.5.2", features = ["compression-full", "decompression-full", "fs", "timeout", "trace", "cors"] }
uuid = { version = "1.10.0", features = ["v4", "serde"] }
tracing = "0.1.40"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
serde_json = "1.0.127"
meilisearch-sdk = "0.27.1"
colored = "2.1.0"
lazy_static = "1.5.0"
config = "0.13.4"
csv = "1.3.1"
[dev-dependencies]
pretty_assertions = "1"
axum-test = "15.6.0"
Environment (please complete the following information):
- OS: Mac Sequoia 15.1.1
- meilisearch-rust version: v0.27.1
- rustc --version: 1.83.0 (90b35a623 2024-11-26)
- rustup --version: 1.27.1 (54dd3d00f 2024-04-24)
And yes, this happens after executing a cargo clean or a fresh pull of my repo from GitHub.
This repo used to build just fine, so not sure what changed. Other than maybe upgrading my rustc version, but I can reproduce this on version 1.8 and 1.74.0 too.
Hello, it seems that you were the only one experiencing this issue. Maybe it had to do with the Cargo.lock of your project, locking some dependency to an outdated version. Tell me if you can still reproduce this today, even after a cargo update