From cd658d038a82ad80e350fdbd84a536865ca9e2b9 Mon Sep 17 00:00:00 2001 From: Lambda Date: Thu, 5 Sep 2024 21:52:25 +0000 Subject: [PATCH] Add type annotation to fix weird inference error error[E0275]: overflow evaluating the requirement `Box<[_]>: Deserialize<'_>` --> src/api/server_server.rs:1801:32 | 1801 | let invited_user: Box<_> = serde_json::from_value( | ________________________________^ 1802 | | signed_event 1803 | | .get("state_key") 1804 | | .ok_or(Error::BadRequest( ... | 1809 | | .into(), 1810 | | ) | |_____^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`grapevine`) = note: required for `Box>` to implement `Deserialize<'_>` = note: 126 redundant requirements hidden = note: required for `Box, ...>, ...>, ...>>` to implement `for<'de> Deserialize<'de>` = note: required for `Box, ...>, ...>, ...>>` to implement `DeserializeOwned` note: required by a bound in `serde_json::from_value` --> /home/xiretza/.cargo/registry/src/index.crates.io-6f17d22bba15001f/serde_json-1.0.117/src/value/mod.rs:1006:8 | 1004 | pub fn from_value(value: Value) -> Result | ---------- required by a bound in this function 1005 | where 1006 | T: DeserializeOwned, | ^^^^^^^^^^^^^^^^ required by this bound in `from_value` = note: the full name for the type has been written to '/home/xiretza/dev/rust/grapevine-fork/target/debug/deps/grapevine-212231bd4a0b94d3.long-type-685143825526684512.txt' = note: consider using `--verbose` to print the full type name to the console = note: the full name for the type has been written to '/home/xiretza/dev/rust/grapevine-fork/target/debug/deps/grapevine-212231bd4a0b94d3.long-type-685143825526684512.txt' = note: consider using `--verbose` to print the full type name to the console --- src/api/server_server.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/server_server.rs b/src/api/server_server.rs index c5cbf5fa..26e84d08 100644 --- a/src/api/server_server.rs +++ b/src/api/server_server.rs @@ -63,7 +63,7 @@ use ruma::{ uint, user_id, CanonicalJsonObject, CanonicalJsonValue, EventId, MilliSecondsSinceUnixEpoch, OwnedEventId, OwnedRoomId, OwnedServerName, OwnedServerSigningKeyId, OwnedSigningKeyId, OwnedUserId, RoomId, - ServerName, + ServerName, UserId, }; use serde_json::value::{to_raw_value, RawValue as RawJsonValue}; use tokio::sync::RwLock; @@ -1797,7 +1797,7 @@ pub(crate) async fn create_invite_route( Error::BadRequest(ErrorKind::InvalidParam, "sender is not a user id.") })?; - let invited_user: Box<_> = serde_json::from_value( + let invited_user: Box = serde_json::from_value( signed_event .get("state_key") .ok_or(Error::BadRequest(