diff --git a/docker/Dockerfile b/docker/Dockerfile index 630296ad..773f1aa3 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,7 +1,7 @@ ## ----------------------------------------------------------------------------- ## Build ## ----------------------------------------------------------------------------- -FROM rust:1.68.0-slim-buster as build-stage +FROM rust:1.70.0-slim-buster as build-stage RUN apt update && apt install -y --no-install-recommends \ pkg-config \ diff --git a/docker/migration.dockerfile b/docker/migration.dockerfile index 81e56577..88166540 100644 --- a/docker/migration.dockerfile +++ b/docker/migration.dockerfile @@ -1,4 +1,4 @@ -FROM rust:1.68.0-slim-buster +FROM rust:1.70.0-slim-buster RUN apt update && apt install -y --no-install-recommends \ pkg-config \ @@ -6,7 +6,7 @@ RUN apt update && apt install -y --no-install-recommends \ libcurl4-openssl-dev \ libpq-dev -RUN cargo install sqlx-cli --version 0.5.7 --no-default-features --features postgres +RUN cargo install sqlx-cli --version 0.6.3 --no-default-features --features postgres WORKDIR /app CMD ["cargo", "sqlx", "migrate", "run"] COPY ./migrations /app/migrations diff --git a/src/app/endpoint/agent.rs b/src/app/endpoint/agent.rs index 811354cc..ab2ff04c 100644 --- a/src/app/endpoint/agent.rs +++ b/src/app/endpoint/agent.rs @@ -61,10 +61,10 @@ pub(crate) struct ListHandler; impl RequestHandler for ListHandler { type Payload = ListRequest; - async fn handle<'a, C: Context + Sync + Send>( - context: &'a mut C, + async fn handle( + context: &mut C, Self::Payload { room_id, payload }: Self::Payload, - reqp: RequestParams<'a>, + reqp: RequestParams<'_>, ) -> RequestResult { let room = helpers::find_room(context, room_id, helpers::RoomTimeRequirement::Open).await?; @@ -173,10 +173,10 @@ impl RequestHandler for UpdateHandler { type Payload = UpdateRequest; #[instrument(skip_all, fields(scope, room_id, classroom_id))] - async fn handle<'a, C: Context + Sync + Send>( - context: &'a mut C, + async fn handle( + context: &mut C, Self::Payload { room_id, payload }: Self::Payload, - reqp: RequestParams<'a>, + reqp: RequestParams<'_>, ) -> RequestResult { let room = helpers::find_room(context, room_id, helpers::RoomTimeRequirement::Open).await?; diff --git a/src/app/endpoint/ban.rs b/src/app/endpoint/ban.rs index 88dd1898..2cd93c5b 100644 --- a/src/app/endpoint/ban.rs +++ b/src/app/endpoint/ban.rs @@ -42,10 +42,10 @@ pub(crate) struct ListHandler; impl RequestHandler for ListHandler { type Payload = ListRequest; - async fn handle<'a, C: Context + Sync + Send>( - context: &'a mut C, + async fn handle( + context: &mut C, Self::Payload { room_id }: Self::Payload, - reqp: RequestParams<'a>, + reqp: RequestParams<'_>, ) -> RequestResult { let room = helpers::find_room(context, room_id, helpers::RoomTimeRequirement::Open).await?; diff --git a/src/app/endpoint/change/create.rs b/src/app/endpoint/change/create.rs index eb849353..56a51047 100644 --- a/src/app/endpoint/change/create.rs +++ b/src/app/endpoint/change/create.rs @@ -48,10 +48,10 @@ impl RequestHandler for CreateHandler { scope, room_id, classroom_id, change_id ) )] - async fn handle<'a, C: Context + Sync + Send>( - context: &'a mut C, + async fn handle( + context: &mut C, payload: Self::Payload, - reqp: RequestParams<'a>, + reqp: RequestParams<'_>, ) -> RequestResult { let (_edition, room) = { let query = db::edition::FindWithRoomQuery::new(payload.edition_id); diff --git a/src/app/endpoint/change/delete.rs b/src/app/endpoint/change/delete.rs index 352e9dde..5192645a 100644 --- a/src/app/endpoint/change/delete.rs +++ b/src/app/endpoint/change/delete.rs @@ -48,10 +48,10 @@ impl RequestHandler for DeleteHandler { scope, room_id, classroom_id, edition_id ) )] - async fn handle<'a, C: Context + Sync + Send>( - context: &'a mut C, + async fn handle( + context: &mut C, payload: Self::Payload, - reqp: RequestParams<'a>, + reqp: RequestParams<'_>, ) -> RequestResult { let (change, room) = { let query = db::change::FindWithRoomQuery::new(payload.id); diff --git a/src/app/endpoint/change/list.rs b/src/app/endpoint/change/list.rs index 3cfdc7c0..2310647c 100644 --- a/src/app/endpoint/change/list.rs +++ b/src/app/endpoint/change/list.rs @@ -50,10 +50,10 @@ impl RequestHandler for ListHandler { type Payload = ListRequest; #[instrument(skip_all, fields(edition_id, scope, room_id, classroom_id, change_id))] - async fn handle<'a, C: Context + Sync + Send>( - context: &'a mut C, + async fn handle( + context: &mut C, Self::Payload { id, payload }: Self::Payload, - reqp: RequestParams<'a>, + reqp: RequestParams<'_>, ) -> RequestResult { Span::current().record("edition_id", &display(id)); let (edition, room) = { diff --git a/src/app/endpoint/edition/commit.rs b/src/app/endpoint/edition/commit.rs index a3dd0862..9fa18b66 100644 --- a/src/app/endpoint/edition/commit.rs +++ b/src/app/endpoint/edition/commit.rs @@ -56,13 +56,13 @@ impl RequestHandler for CommitHandler { type Payload = CommitRequest; #[instrument(skip_all, fields(edition_id, offset, room_id, scope, classroom_id,))] - async fn handle<'a, C: Context + Sync + Send>( - context: &'a mut C, + async fn handle( + context: &mut C, CommitRequest { id, payload: CommitPayload { offset }, }: Self::Payload, - reqp: RequestParams<'a>, + reqp: RequestParams<'_>, ) -> RequestResult { Span::current().record("edition_id", &display(id)); Span::current().record("offset", &display(offset)); diff --git a/src/app/endpoint/edition/create.rs b/src/app/endpoint/edition/create.rs index 35593342..52d4915a 100644 --- a/src/app/endpoint/edition/create.rs +++ b/src/app/endpoint/edition/create.rs @@ -46,10 +46,10 @@ impl RequestHandler for CreateHandler { scope, classroom_id, edition_id ) )] - async fn handle<'a, C: Context + Sync + Send>( - context: &'a mut C, + async fn handle( + context: &mut C, payload: Self::Payload, - reqp: RequestParams<'a>, + reqp: RequestParams<'_>, ) -> RequestResult { let room = helpers::find_room(context, payload.room_id, helpers::RoomTimeRequirement::Any).await?; diff --git a/src/app/endpoint/edition/delete.rs b/src/app/endpoint/edition/delete.rs index df2d468c..2c74fb2f 100644 --- a/src/app/endpoint/edition/delete.rs +++ b/src/app/endpoint/edition/delete.rs @@ -46,10 +46,10 @@ impl RequestHandler for DeleteHandler { room_id, scope, classroom_id ) )] - async fn handle<'a, C: Context + Sync + Send>( - context: &'a mut C, + async fn handle( + context: &mut C, payload: Self::Payload, - reqp: RequestParams<'a>, + reqp: RequestParams<'_>, ) -> RequestResult { let (edition, room) = { let query = db::edition::FindWithRoomQuery::new(payload.id); diff --git a/src/app/endpoint/edition/list.rs b/src/app/endpoint/edition/list.rs index 3d7d134f..957ce636 100644 --- a/src/app/endpoint/edition/list.rs +++ b/src/app/endpoint/edition/list.rs @@ -50,10 +50,10 @@ impl RequestHandler for ListHandler { type Payload = ListRequest; #[instrument(skip_all, fields(room_id, scope, classroom_id))] - async fn handle<'a, C: Context + Sync + Send>( - context: &'a mut C, + async fn handle( + context: &mut C, Self::Payload { room_id, payload }: Self::Payload, - reqp: RequestParams<'a>, + reqp: RequestParams<'_>, ) -> RequestResult { let room = helpers::find_room(context, room_id, helpers::RoomTimeRequirement::Any).await?; diff --git a/src/app/endpoint/event.rs b/src/app/endpoint/event.rs index 6d5c4d83..5759eecc 100644 --- a/src/app/endpoint/event.rs +++ b/src/app/endpoint/event.rs @@ -85,10 +85,10 @@ impl RequestHandler for CreateHandler { type Payload = CreateRequest; #[instrument(skip_all, fields(room_id, scope, classroom_id))] - async fn handle<'a, C: Context + Sync + Send>( - context: &'a mut C, + async fn handle( + context: &mut C, Self::Payload { room_id, payload }: Self::Payload, - reqp: RequestParams<'a>, + reqp: RequestParams<'_>, ) -> RequestResult { let (room, author) = { let room = @@ -355,10 +355,10 @@ impl RequestHandler for ListHandler { type Payload = ListRequest; #[instrument(skip_all, fields(room_id, scope, classroom_id))] - async fn handle<'a, C: Context + Sync + Send>( - context: &'a mut C, + async fn handle( + context: &mut C, Self::Payload { room_id, payload }: Self::Payload, - reqp: RequestParams<'a>, + reqp: RequestParams<'_>, ) -> RequestResult { let room = helpers::find_room(context, room_id, helpers::RoomTimeRequirement::Any).await?; diff --git a/src/app/endpoint/mod.rs b/src/app/endpoint/mod.rs index 3c5b6dd9..81b0bf47 100644 --- a/src/app/endpoint/mod.rs +++ b/src/app/endpoint/mod.rs @@ -23,14 +23,10 @@ pub(crate) type MqttResult = StdResult; pub(crate) trait RequestHandler { type Payload: Send + DeserializeOwned; - // this lifetime is not elided (e.g. RequestParams<'_') - // to avoid ICE with some rustc versions - // tested on 1.67 and 1.69 - // maybe other versions have this ICE as well - async fn handle<'a, C: Context + Sync + Send>( - context: &'a mut C, + async fn handle( + context: &mut C, payload: Self::Payload, - reqp: RequestParams<'a>, + reqp: RequestParams<'_>, ) -> RequestResult; } diff --git a/src/app/endpoint/room.rs b/src/app/endpoint/room.rs index fac70c23..e5bde245 100644 --- a/src/app/endpoint/room.rs +++ b/src/app/endpoint/room.rs @@ -69,10 +69,10 @@ impl RequestHandler for CreateHandler { type Payload = CreateRequest; #[instrument(skip_all, fields(room_id, scope, classroom_id))] - async fn handle<'a, C: Context + Sync + Send>( - context: &'a mut C, + async fn handle( + context: &mut C, payload: Self::Payload, - reqp: RequestParams<'a>, + reqp: RequestParams<'_>, ) -> RequestResult { // Validate opening time. match RoomTime::new(payload.time) { @@ -195,10 +195,10 @@ impl RequestHandler for ReadHandler { room_id = %payload.id, scope, classroom_id ) )] - async fn handle<'a, C: Context + Sync + Send>( - context: &'a mut C, + async fn handle( + context: &mut C, payload: Self::Payload, - reqp: RequestParams<'a>, + reqp: RequestParams<'_>, ) -> RequestResult { let room = helpers::find_room(context, payload.id, helpers::RoomTimeRequirement::Any).await?; @@ -269,10 +269,10 @@ impl RequestHandler for UpdateHandler { type Payload = UpdateRequest; #[instrument(skip_all, fields(room_id, scope, classroom_id))] - async fn handle<'a, C: Context + Sync + Send>( - context: &'a mut C, + async fn handle( + context: &mut C, Self::Payload { id, payload }: Self::Payload, - reqp: RequestParams<'a>, + reqp: RequestParams<'_>, ) -> RequestResult { let time_requirement = if payload.time.is_some() { // Forbid changing time of a closed room. @@ -430,10 +430,10 @@ impl RequestHandler for EnterHandler { room_id = %payload.id, scope, classroom_id ) )] - async fn handle<'a, C: Context + Sync + Send>( - context: &'a mut C, + async fn handle( + context: &mut C, payload: Self::Payload, - reqp: RequestParams<'a>, + reqp: RequestParams<'_>, ) -> RequestResult { let room = helpers::find_room(context, payload.id, helpers::RoomTimeRequirement::Open).await?; @@ -582,10 +582,10 @@ impl RequestHandler for LockedTypesHandler { type Payload = LockedTypesRequest; #[instrument(skip_all, fields(room_id, scope, classroom_id))] - async fn handle<'a, C: Context + Sync + Send>( - context: &'a mut C, + async fn handle( + context: &mut C, Self::Payload { id, payload }: Self::Payload, - reqp: RequestParams<'a>, + reqp: RequestParams<'_>, ) -> RequestResult { // Find realtime room. let room = helpers::find_room(context, id, helpers::RoomTimeRequirement::Any).await?; @@ -696,10 +696,10 @@ impl RequestHandler for WhiteboardAccessHandler { type Payload = WhiteboardAccessRequest; #[instrument(skip_all, fields(room_id, scope, classroom_id))] - async fn handle<'a, C: Context + Sync + Send>( - context: &'a mut C, + async fn handle( + context: &mut C, Self::Payload { id, payload }: Self::Payload, - reqp: RequestParams<'a>, + reqp: RequestParams<'_>, ) -> RequestResult { // Find realtime room. let room = helpers::find_room(context, id, helpers::RoomTimeRequirement::Any).await?; @@ -819,10 +819,10 @@ impl RequestHandler for AdjustHandler { type Payload = AdjustRequest; #[instrument(skip_all, fields(room_id, scope, classroom_id))] - async fn handle<'a, C: Context + Sync + Send>( - context: &'a mut C, + async fn handle( + context: &mut C, Self::Payload { id, payload }: Self::Payload, - reqp: RequestParams<'a>, + reqp: RequestParams<'_>, ) -> RequestResult { // Find realtime room. let room = helpers::find_room(context, id, helpers::RoomTimeRequirement::Any).await?; diff --git a/src/app/endpoint/room/dump_events.rs b/src/app/endpoint/room/dump_events.rs index 9a17d7b0..f17f10c6 100644 --- a/src/app/endpoint/room/dump_events.rs +++ b/src/app/endpoint/room/dump_events.rs @@ -65,10 +65,10 @@ pub(crate) struct EventsDumpHandler; impl RequestHandler for EventsDumpHandler { type Payload = EventsDumpRequest; - async fn handle<'a, C: Context + Sync + Send>( - context: &'a mut C, + async fn handle( + context: &mut C, payload: Self::Payload, - reqp: RequestParams<'a>, + reqp: RequestParams<'_>, ) -> RequestResult { let room = helpers::find_room(context, payload.id, helpers::RoomTimeRequirement::Any).await?; diff --git a/src/app/endpoint/state.rs b/src/app/endpoint/state.rs index 27cff23d..e72ea577 100644 --- a/src/app/endpoint/state.rs +++ b/src/app/endpoint/state.rs @@ -62,10 +62,10 @@ impl RequestHandler for ReadHandler { type Payload = ReadRequest; #[instrument(skip_all, fields(room_id, scope, classroom_id))] - async fn handle<'a, C: Context + Sync + Send>( - context: &'a mut C, + async fn handle( + context: &mut C, Self::Payload { room_id, payload }: Self::Payload, - reqp: RequestParams<'a>, + reqp: RequestParams<'_>, ) -> RequestResult { Span::current().record("room_id", &display(room_id)); diff --git a/src/app/endpoint/system.rs b/src/app/endpoint/system.rs index db3fe31f..1f9e2478 100644 --- a/src/app/endpoint/system.rs +++ b/src/app/endpoint/system.rs @@ -18,10 +18,10 @@ pub(crate) struct VacuumHandler; impl RequestHandler for VacuumHandler { type Payload = VacuumRequest; - async fn handle<'a, C: Context + Sync + Send>( - context: &'a mut C, + async fn handle( + context: &mut C, _payload: Self::Payload, - reqp: RequestParams<'a>, + reqp: RequestParams<'_>, ) -> RequestResult { // Authz: only trusted subjects. let authz_time = context