fix: only use diagnostic attribute on versions after 1.78

This commit is contained in:
Ifiok Jr.
2025-03-22 08:03:18 +00:00
parent 72e84f4e38
commit a74713a371
4 changed files with 6 additions and 3 deletions

View File

@@ -16,6 +16,7 @@ server_fn_macro_default = { workspace = true }
const_format = "0.2.33"
const-str = "0.5.7"
xxhash-rust = { version = "0.8.12", features = ["const_xxh64"] }
rustversion = { workspace = true}
# used across multiple features
serde = { version = "1.0", features = ["derive"] }
send_wrapper = { version = "0.6.0", features = ["futures"], optional = true }

View File

@@ -560,13 +560,13 @@ where
}
#[doc(hidden)]
#[diagnostic::on_unimplemented(
#[rustversion::attr(since(1.78), diagnostic::on_unimplemented(
message = "{Self} is not a `Result` or aliased `Result`. Server functions \
must return a `Result` or aliased `Result`.",
label = "Must return a `Result` or aliased `Result`.",
note = "If you are trying to return an alias of `Result`, you must also \
implement `FromServerFnError` for the error type."
)]
))]
/// A trait for extracting the error and ok types from a [`Result`]. This is used to allow alias types to be returned from server functions.
pub trait ServerFnMustReturnResult {
/// The error type of the [`Result`].