Improve error messages with #[diagnostic::do_not_recommend] (#3588)

This commit is contained in:
Jonas Platte
2025-12-27 10:22:51 +01:00
parent aba8046921
commit f72c298ee8
12 changed files with 40 additions and 37 deletions
+1
View File
@@ -47,6 +47,7 @@ impl NestedPath {
}
}
#[diagnostic::do_not_recommend] // pretty niche type
impl<S> FromRequestParts<S> for NestedPath
where
S: Send + Sync,
+4
View File
@@ -204,6 +204,7 @@ pub trait Handler<T, S>: Clone + Send + Sync + Sized + 'static {
}
}
#[diagnostic::do_not_recommend]
impl<F, Fut, Res, S> Handler<((),), S> for F
where
F: FnOnce() -> Fut + Clone + Send + Sync + 'static,
@@ -221,6 +222,7 @@ macro_rules! impl_handler {
(
[$($ty:ident),*], $last:ident
) => {
#[diagnostic::do_not_recommend]
#[allow(non_snake_case, unused_mut)]
impl<F, Fut, S, Res, M, $($ty,)* $last> Handler<(M, $($ty,)* $last,), S> for F
where
@@ -265,6 +267,7 @@ mod private {
pub enum IntoResponseHandler {}
}
#[diagnostic::do_not_recommend]
impl<T, S> Handler<private::IntoResponseHandler, S> for T
where
T: IntoResponse + Clone + Send + Sync + 'static,
@@ -310,6 +313,7 @@ where
}
}
#[diagnostic::do_not_recommend]
impl<H, S, T, L> Handler<T, S> for Layered<L, H, T, S>
where
L: Layer<HandlerService<H, T, S>> + Clone + Send + Sync + 'static,
+1
View File
@@ -1306,6 +1306,7 @@ where
}
}
#[diagnostic::do_not_recommend]
impl<S> Handler<(), S> for MethodRouter<S>
where
S: Clone + 'static,