From 4b272f19baf6ef1048ca0c85f52a56ad587ae95c Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Sun, 8 Aug 2021 14:08:06 -0700 Subject: [PATCH] Update 'devise', fix 'Responder' derive generics. --- core/codegen/Cargo.toml | 2 +- core/codegen/src/lib.rs | 4 ++-- core/codegen/tests/ui-fail/responder.rs | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/core/codegen/Cargo.toml b/core/codegen/Cargo.toml index 56523799..9c83d37e 100644 --- a/core/codegen/Cargo.toml +++ b/core/codegen/Cargo.toml @@ -19,7 +19,7 @@ indexmap = "1.0" quote = "1.0" syn = { version = "1.0.72", features = ["full", "visit", "visit-mut", "extra-traits"] } proc-macro2 = "1.0.27" -devise = "0.3" +devise = "0.3.1" rocket_http = { version = "0.5.0-rc.1", path = "../http/" } unicode-xid = "0.2" glob = "0.3" diff --git a/core/codegen/src/lib.rs b/core/codegen/src/lib.rs index e0810c94..c7cd15e7 100644 --- a/core/codegen/src/lib.rs +++ b/core/codegen/src/lib.rs @@ -687,8 +687,8 @@ pub fn derive_from_form_field(input: TokenStream) -> TokenStream { /// } /// ``` /// -/// [`FromForm`]: rocket::form::FromForm -/// [`form::Errors`]: rocket::form::Errors +/// [`FromForm`]: ../rocket/form/trait.FromForm.html +/// [`form::Errors`]: ../rocket/form/struct.Errors.html /// /// # Generics /// diff --git a/core/codegen/tests/ui-fail/responder.rs b/core/codegen/tests/ui-fail/responder.rs index f7b5cc62..c433a1de 100644 --- a/core/codegen/tests/ui-fail/responder.rs +++ b/core/codegen/tests/ui-fail/responder.rs @@ -49,4 +49,19 @@ struct Thing12(()); #[response(status = 404, content_type = 120)] struct Thing13(()); +#[derive(Responder)] // NO ERROR +enum Error<'r, T> { + #[response(status = 400)] + Unauthorized(T), + #[response(status = 404)] + NotFound(rocket::fs::NamedFile), + #[response(status = 500)] + A(&'r str, rocket::http::ContentType), +} + +#[derive(Responder)] // NO ERROR +enum Error2<'r, T> { + Unauthorized(&'r T), +} + fn main() {}