Skip to content

Commit 477e73b

Browse files
committed
Bump Rust edition to 2024 and MSRV to 1.85
Important, we need to release these changes with a new minor release.
1 parent d680ff1 commit 477e73b

26 files changed

+78
-61
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
[package]
22
name = "restate-sdk"
33
version = "0.7.0"
4-
edition = "2021"
4+
edition = "2024"
55
description = "Restate SDK for Rust"
66
license = "MIT"
77
repository = "https://github.com/restatedev/sdk-rust"
8-
rust-version = "1.76.0"
8+
rust-version = "1.85.0"
99

1010
[[example]]
1111
name = "tracing"

examples/tracing.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use restate_sdk::prelude::*;
22
use std::time::Duration;
33
use tracing::info;
4-
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt, Layer};
4+
use tracing_subscriber::{Layer, layer::SubscriberExt, util::SubscriberInitExt};
55

66
#[restate_sdk::service]
77
trait Greeter {

macros/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
[package]
22
name = "restate-sdk-macros"
33
version = "0.7.0"
4-
edition = "2021"
4+
edition = "2024"
55
description = "Restate SDK for Rust macros"
66
license = "MIT"
77
repository = "https://github.com/restatedev/sdk-rust"
8+
rust-version = "1.85.0"
89

910
[lib]
1011
proc-macro = true

macros/src/ast.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ use syn::parse::{Parse, ParseStream};
1616
use syn::spanned::Spanned;
1717
use syn::token::Comma;
1818
use syn::{
19-
braced, parenthesized, parse_quote, Attribute, Error, Expr, ExprLit, FnArg, GenericArgument,
20-
Ident, Lit, Pat, PatType, Path, PathArguments, Result, ReturnType, Token, Type, Visibility,
19+
Attribute, Error, Expr, ExprLit, FnArg, GenericArgument, Ident, Lit, Pat, PatType, Path,
20+
PathArguments, Result, ReturnType, Token, Type, Visibility, braced, parenthesized, parse_quote,
2121
};
2222

2323
/// Accumulates multiple errors into a result.
@@ -194,10 +194,12 @@ impl Parse for Handler {
194194
input.parse::<Token![;]>()?;
195195

196196
let (ok_ty, err_ty) = match &return_type {
197-
ReturnType::Default => return Err(Error::new(
198-
return_type.span(),
199-
"The return type cannot be empty, only Result or restate_sdk::prelude::HandlerResult is supported as return type",
200-
)),
197+
ReturnType::Default => {
198+
return Err(Error::new(
199+
return_type.span(),
200+
"The return type cannot be empty, only Result or restate_sdk::prelude::HandlerResult is supported as return type",
201+
));
202+
}
201203
ReturnType::Type(_, ty) => {
202204
if let Some((ok_ty, err_ty)) = extract_handler_result_parameter(ty) {
203205
(ok_ty, err_ty)
@@ -251,7 +253,7 @@ fn read_literal_attribute_name(attr: &Attribute) -> Result<Option<String>> {
251253
.filter(|val| val.path.require_ident().is_ok_and(|i| i == "name"))
252254
.map(|val| {
253255
if let Expr::Lit(ExprLit {
254-
lit: Lit::Str(ref literal),
256+
lit: Lit::Str(literal),
255257
..
256258
}) = &val.value
257259
{
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::ast::{Handler, Object, Service, ServiceInner, ServiceType, Workflow};
22
use proc_macro2::TokenStream as TokenStream2;
33
use proc_macro2::{Ident, Literal};
4-
use quote::{format_ident, quote, ToTokens};
4+
use quote::{ToTokens, format_ident, quote};
55
use syn::{Attribute, PatType, Visibility};
66

77
pub(crate) struct ServiceGenerator<'a> {
@@ -386,7 +386,7 @@ impl<'a> ServiceGenerator<'a> {
386386
}
387387
}
388388

389-
impl<'a> ToTokens for ServiceGenerator<'a> {
389+
impl ToTokens for ServiceGenerator<'_> {
390390
fn to_tokens(&self, output: &mut TokenStream2) {
391391
output.extend(vec![
392392
self.trait_service(),

macros/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
extern crate proc_macro;
1515

1616
mod ast;
17-
mod gen;
17+
mod generator;
1818

1919
use crate::ast::{Object, Service, Workflow};
20-
use crate::gen::ServiceGenerator;
20+
use crate::generator::ServiceGenerator;
2121
use proc_macro::TokenStream;
2222
use quote::ToTokens;
2323
use syn::parse_macro_input;

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[toolchain]
2-
channel = "1.82.0"
2+
channel = "1.85.0"
33
profile = "minimal"
44
components = ["rustfmt", "clippy"]

src/context/mod.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub struct Context<'ctx> {
2626
inner: &'ctx ContextInternal,
2727
}
2828

29-
impl<'ctx> Context<'ctx> {
29+
impl Context<'_> {
3030
/// Get request headers.
3131
pub fn headers(&self) -> &HeaderMap {
3232
&self.headers
@@ -60,7 +60,7 @@ pub struct SharedObjectContext<'ctx> {
6060
pub(crate) inner: &'ctx ContextInternal,
6161
}
6262

63-
impl<'ctx> SharedObjectContext<'ctx> {
63+
impl SharedObjectContext<'_> {
6464
/// Get object key.
6565
pub fn key(&self) -> &str {
6666
&self.key
@@ -100,7 +100,7 @@ pub struct ObjectContext<'ctx> {
100100
pub(crate) inner: &'ctx ContextInternal,
101101
}
102102

103-
impl<'ctx> ObjectContext<'ctx> {
103+
impl ObjectContext<'_> {
104104
/// Get object key.
105105
pub fn key(&self) -> &str {
106106
&self.key
@@ -153,7 +153,7 @@ impl<'ctx> From<(&'ctx ContextInternal, InputMetadata)> for SharedWorkflowContex
153153
}
154154
}
155155

156-
impl<'ctx> SharedWorkflowContext<'ctx> {
156+
impl SharedWorkflowContext<'_> {
157157
/// Get workflow key.
158158
pub fn key(&self) -> &str {
159159
&self.key
@@ -193,7 +193,7 @@ impl<'ctx> From<(&'ctx ContextInternal, InputMetadata)> for WorkflowContext<'ctx
193193
}
194194
}
195195

196-
impl<'ctx> WorkflowContext<'ctx> {
196+
impl WorkflowContext<'_> {
197197
/// Get workflow key.
198198
pub fn key(&self) -> &str {
199199
&self.key
@@ -832,13 +832,13 @@ pub trait ContextReadState<'ctx>: private::SealedContext<'ctx> {
832832
/// Get state
833833
fn get<T: Deserialize + 'static>(
834834
&self,
835-
key: &str,
835+
key: &'ctx str,
836836
) -> impl Future<Output = Result<Option<T>, TerminalError>> + 'ctx {
837837
self.inner_context().get(key)
838838
}
839839

840840
/// Get state keys
841-
fn get_keys(&self) -> impl Future<Output = Result<Vec<String>, TerminalError>> + 'ctx {
841+
fn get_keys(&'ctx self) -> impl Future<Output = Result<Vec<String>, TerminalError>> + 'ctx {
842842
self.inner_context().get_keys()
843843
}
844844
}
@@ -923,15 +923,15 @@ pub trait ContextPromises<'ctx>: private::SealedContext<'ctx> {
923923
/// Create a promise
924924
fn promise<T: Deserialize + 'static>(
925925
&'ctx self,
926-
key: &str,
926+
key: &'ctx str,
927927
) -> impl DurableFuture<Output = Result<T, TerminalError>> + 'ctx {
928928
self.inner_context().promise(key)
929929
}
930930

931931
/// Peek a promise
932932
fn peek_promise<T: Deserialize + 'static>(
933933
&self,
934-
key: &str,
934+
key: &'ctx str,
935935
) -> impl Future<Output = Result<Option<T>, TerminalError>> + 'ctx {
936936
self.inner_context().peek_promise(key)
937937
}

src/context/select.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ macro_rules! select {
7676
let handles = vec![$(
7777
$crate::count_field!(futures_init.$($skip)*).handle()
7878
,)+];
79-
let select_fut = futures_init.0.inner_context().select(handles);
79+
let inner_context = futures_init.0.inner_context();
80+
let select_fut = inner_context.select(handles);
8081

8182
match select_fut.await {
8283
$(

src/endpoint/context.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ use futures::{FutureExt, TryFutureExt};
1616
use pin_project_lite::pin_project;
1717
use restate_sdk_shared_core::{
1818
CoreVM, DoProgressResponse, Error as CoreError, Header, NonEmptyValue, NotificationHandle,
19-
RetryPolicy, RunExitResult, TakeOutputResult, Target, TerminalFailure, Value, VM,
19+
RetryPolicy, RunExitResult, TakeOutputResult, Target, TerminalFailure, VM, Value,
2020
};
2121
use std::borrow::Cow;
2222
use std::collections::HashMap;
23-
use std::future::{ready, Future};
23+
use std::future::{Future, ready};
2424
use std::marker::PhantomData;
2525
use std::mem;
2626
use std::pin::Pin;
2727
use std::sync::{Arc, Mutex};
28-
use std::task::{ready, Context, Poll};
28+
use std::task::{Context, Poll, ready};
2929
use std::time::{Duration, Instant, SystemTime};
3030

3131
pub struct ContextInternalInner {

0 commit comments

Comments
 (0)