From 67efe143c5dec1c3f4245e6395a8cb9350e1058e Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Tue, 21 Jul 2020 10:23:59 -0700 Subject: [PATCH] Improve diagnostics, especially on stable. --- contrib/codegen/Cargo.toml | 2 +- contrib/codegen/src/lib.rs | 2 +- .../ui-fail-nightly/database-syntax.stderr | 36 +- .../ui-fail-nightly/database-types.stderr | 4 +- .../ui-fail-stable/database-syntax.stderr | 36 +- .../ui-fail-stable/database-types.stderr | 4 +- .../codegen/tests/ui-fail/database-syntax.rs | 9 - .../codegen/tests/ui-fail/database-types.rs | 2 - core/codegen/Cargo.toml | 2 +- core/codegen/src/attribute/async_entry.rs | 10 +- core/codegen/src/attribute/catch.rs | 11 +- core/codegen/src/attribute/route.rs | 10 +- core/codegen/src/bang/mod.rs | 11 +- core/codegen/src/derive/from_form.rs | 12 +- core/codegen/src/derive/from_form_value.rs | 7 +- core/codegen/src/derive/responder.rs | 2 +- core/codegen/src/derive/uri_display.rs | 38 +- core/codegen/src/http_codegen.rs | 2 +- core/codegen/src/lib.rs | 3 +- core/codegen/src/proc_macro_ext.rs | 2 +- .../tests/ui-fail-nightly/async-entry.stderr | 90 ++-- .../tests/ui-fail-nightly/catch.stderr | 42 +- .../ui-fail-nightly/catch_type_errors.stderr | 18 +- .../tests/ui-fail-nightly/catchers.stderr | 6 +- .../tests/ui-fail-nightly/from_form.stderr | 340 ++++++------- .../from_form_type_errors.stderr | 4 +- .../ui-fail-nightly/from_form_value.stderr | 79 ++- .../ui-fail-nightly/responder-types.stderr | 24 +- .../route-attribute-general-syntax.stderr | 160 +++--- .../route-path-bad-syntax.stderr | 198 +++---- .../ui-fail-nightly/route-type-errors.stderr | 22 +- .../ui-fail-nightly/route-warnings.stderr | 14 +- .../tests/ui-fail-nightly/routes.stderr | 6 +- .../ui-fail-nightly/typed-uri-bad-type.stderr | 56 +- .../typed-uris-bad-params.stderr | 164 +++--- .../typed-uris-invalid-syntax.stderr | 20 +- .../tests/ui-fail-nightly/uri_display.stderr | 481 +++--------------- .../uri_display_type_errors.stderr | 24 +- .../tests/ui-fail-stable/async-entry.stderr | 106 ++-- .../codegen/tests/ui-fail-stable/catch.stderr | 38 +- .../ui-fail-stable/catch_type_errors.stderr | 18 +- .../tests/ui-fail-stable/catchers.stderr | 6 +- .../tests/ui-fail-stable/from_form.stderr | 342 ++++++------- .../from_form_type_errors.stderr | 4 +- .../ui-fail-stable/from_form_value.stderr | 84 +-- .../ui-fail-stable/responder-types.stderr | 24 +- .../route-attribute-general-syntax.stderr | 148 +++--- .../route-path-bad-syntax.stderr | 236 ++++----- .../ui-fail-stable/route-type-errors.stderr | 24 +- .../tests/ui-fail-stable/routes.stderr | 6 +- .../ui-fail-stable/typed-uri-bad-type.stderr | 56 +- .../typed-uris-bad-params.stderr | 358 +++++-------- .../typed-uris-invalid-syntax.stderr | 20 +- .../tests/ui-fail-stable/uri_display.stderr | 480 +++-------------- .../uri_display_type_errors.stderr | 24 +- core/codegen/tests/ui-fail/async-entry.rs | 18 +- core/codegen/tests/ui-fail/catch.rs | 27 +- .../tests/ui-fail/catch_type_errors.rs | 5 - core/codegen/tests/ui-fail/catchers.rs | 6 +- core/codegen/tests/ui-fail/from_form.rs | 24 - .../tests/ui-fail/from_form_type_errors.rs | 2 - core/codegen/tests/ui-fail/from_form_value.rs | 8 - core/codegen/tests/ui-fail/responder-types.rs | 10 - .../ui-fail/route-attribute-general-syntax.rs | 74 +-- .../tests/ui-fail/route-path-bad-syntax.rs | 99 ++-- .../tests/ui-fail/route-type-errors.rs | 15 +- core/codegen/tests/ui-fail/route-warnings.rs | 10 +- core/codegen/tests/ui-fail/routes.rs | 6 +- .../tests/ui-fail/typed-uri-bad-type.rs | 17 - .../tests/ui-fail/typed-uris-bad-params.rs | 61 +-- .../ui-fail/typed-uris-invalid-syntax.rs | 20 +- core/codegen/tests/ui-fail/uri_display.rs | 38 -- .../tests/ui-fail/uri_display_type_errors.rs | 7 - core/http/Cargo.toml | 2 +- core/lib/Cargo.toml | 2 +- 75 files changed, 1678 insertions(+), 2700 deletions(-) diff --git a/contrib/codegen/Cargo.toml b/contrib/codegen/Cargo.toml index 3fa48e10..51bea643 100644 --- a/contrib/codegen/Cargo.toml +++ b/contrib/codegen/Cargo.toml @@ -20,7 +20,7 @@ proc-macro = true [dependencies] quote = "1.0" -devise = { git = "https://github.com/SergioBenitez/Devise.git", rev = "952866f7" } +devise = { git = "https://github.com/SergioBenitez/Devise.git", rev = "1e42a2691" } [build-dependencies] yansi = "0.5" diff --git a/contrib/codegen/src/lib.rs b/contrib/codegen/src/lib.rs index b32a9b11..9e8c2e8e 100644 --- a/contrib/codegen/src/lib.rs +++ b/contrib/codegen/src/lib.rs @@ -42,5 +42,5 @@ use proc_macro::TokenStream; #[proc_macro_attribute] pub fn database(attr: TokenStream, input: TokenStream) -> TokenStream { crate::database::database_attr(attr, input) - .unwrap_or_else(|diag| diag.emit_as_tokens().into()) + .unwrap_or_else(|diag| diag.emit_as_item_tokens().into()) } diff --git a/contrib/codegen/tests/ui-fail-nightly/database-syntax.stderr b/contrib/codegen/tests/ui-fail-nightly/database-syntax.stderr index 53260419..d4283c55 100644 --- a/contrib/codegen/tests/ui-fail-nightly/database-syntax.stderr +++ b/contrib/codegen/tests/ui-fail-nightly/database-syntax.stderr @@ -7,51 +7,51 @@ error: unexpected end of input, expected literal = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) error: expected string literal - --> $DIR/database-syntax.rs:10:12 - | -10 | #[database(1)] - | ^ + --> $DIR/database-syntax.rs:9:12 + | +9 | #[database(1)] + | ^ error: expected string literal - --> $DIR/database-syntax.rs:14:12 + --> $DIR/database-syntax.rs:12:12 | -14 | #[database(123)] +12 | #[database(123)] | ^^^ error: unexpected token - --> $DIR/database-syntax.rs:18:20 + --> $DIR/database-syntax.rs:15:20 | -18 | #[database("hello" "hi")] +15 | #[database("hello" "hi")] | ^^^^ error: `database` attribute can only be used on structs - --> $DIR/database-syntax.rs:23:1 + --> $DIR/database-syntax.rs:19:1 | -23 | enum Foo { } +19 | enum Foo { } | ^^^^^^^^^^^^^ error: `database` attribute can only be applied to structs with exactly one unnamed field - --> $DIR/database-syntax.rs:27:11 + --> $DIR/database-syntax.rs:22:11 | -27 | struct Bar(diesel::SqliteConnection, diesel::SqliteConnection); +22 | struct Bar(diesel::SqliteConnection, diesel::SqliteConnection); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: example: `struct MyDatabase(diesel::SqliteConnection);` error: `database` attribute can only be used on structs - --> $DIR/database-syntax.rs:31:1 + --> $DIR/database-syntax.rs:25:1 | -31 | union Baz { } +25 | union Baz { } | ^^^^^^^^^^^^^^ error: `database` attribute cannot be applied to structs with generics - --> $DIR/database-syntax.rs:35:9 + --> $DIR/database-syntax.rs:28:9 | -35 | struct E<'r>(&'r str); +28 | struct E<'r>(&'r str); | ^^^^ error: `database` attribute cannot be applied to structs with generics - --> $DIR/database-syntax.rs:39:9 + --> $DIR/database-syntax.rs:31:9 | -39 | struct F(T); +31 | struct F(T); | ^^^ diff --git a/contrib/codegen/tests/ui-fail-nightly/database-types.stderr b/contrib/codegen/tests/ui-fail-nightly/database-types.stderr index 10c9ae24..b5b4f130 100644 --- a/contrib/codegen/tests/ui-fail-nightly/database-types.stderr +++ b/contrib/codegen/tests/ui-fail-nightly/database-types.stderr @@ -5,7 +5,7 @@ error[E0277]: the trait bound `Unknown: rocket_contrib::databases::Poolable` is | ^^^^^^^ the trait `rocket_contrib::databases::Poolable` is not implemented for `Unknown` error[E0277]: the trait bound `std::vec::Vec: rocket_contrib::databases::Poolable` is not satisfied - --> $DIR/database-types.rs:11:10 + --> $DIR/database-types.rs:10:10 | -11 | struct B(Vec); +10 | struct B(Vec); | ^^^^^^^^ the trait `rocket_contrib::databases::Poolable` is not implemented for `std::vec::Vec` diff --git a/contrib/codegen/tests/ui-fail-stable/database-syntax.stderr b/contrib/codegen/tests/ui-fail-stable/database-syntax.stderr index 3a45ed79..740dda25 100644 --- a/contrib/codegen/tests/ui-fail-stable/database-syntax.stderr +++ b/contrib/codegen/tests/ui-fail-stable/database-syntax.stderr @@ -7,50 +7,50 @@ error: unexpected end of input, expected literal = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) error: expected string literal - --> $DIR/database-syntax.rs:10:12 - | -10 | #[database(1)] - | ^ + --> $DIR/database-syntax.rs:9:12 + | +9 | #[database(1)] + | ^ error: expected string literal - --> $DIR/database-syntax.rs:14:12 + --> $DIR/database-syntax.rs:12:12 | -14 | #[database(123)] +12 | #[database(123)] | ^^^ error: unexpected token - --> $DIR/database-syntax.rs:18:20 + --> $DIR/database-syntax.rs:15:20 | -18 | #[database("hello" "hi")] +15 | #[database("hello" "hi")] | ^^^^ error: `database` attribute can only be used on structs - --> $DIR/database-syntax.rs:23:1 + --> $DIR/database-syntax.rs:19:1 | -23 | enum Foo { } +19 | enum Foo { } | ^^^^ error: `database` attribute can only be applied to structs with exactly one unnamed field --- help: example: `struct MyDatabase(diesel::SqliteConnection);` - --> $DIR/database-syntax.rs:27:11 + --> $DIR/database-syntax.rs:22:11 | -27 | struct Bar(diesel::SqliteConnection, diesel::SqliteConnection); +22 | struct Bar(diesel::SqliteConnection, diesel::SqliteConnection); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `database` attribute can only be used on structs - --> $DIR/database-syntax.rs:31:1 + --> $DIR/database-syntax.rs:25:1 | -31 | union Baz { } +25 | union Baz { } | ^^^^^ error: `database` attribute cannot be applied to structs with generics - --> $DIR/database-syntax.rs:35:9 + --> $DIR/database-syntax.rs:28:9 | -35 | struct E<'r>(&'r str); +28 | struct E<'r>(&'r str); | ^ error: `database` attribute cannot be applied to structs with generics - --> $DIR/database-syntax.rs:39:9 + --> $DIR/database-syntax.rs:31:9 | -39 | struct F(T); +31 | struct F(T); | ^ diff --git a/contrib/codegen/tests/ui-fail-stable/database-types.stderr b/contrib/codegen/tests/ui-fail-stable/database-types.stderr index cae26974..7b85009e 100644 --- a/contrib/codegen/tests/ui-fail-stable/database-types.stderr +++ b/contrib/codegen/tests/ui-fail-stable/database-types.stderr @@ -5,7 +5,7 @@ error[E0277]: the trait bound `Unknown: rocket_contrib::databases::Poolable` is | ^^^^^^^ the trait `rocket_contrib::databases::Poolable` is not implemented for `Unknown` error[E0277]: the trait bound `std::vec::Vec: rocket_contrib::databases::Poolable` is not satisfied - --> $DIR/database-types.rs:11:10 + --> $DIR/database-types.rs:10:10 | -11 | struct B(Vec); +10 | struct B(Vec); | ^^^ the trait `rocket_contrib::databases::Poolable` is not implemented for `std::vec::Vec` diff --git a/contrib/codegen/tests/ui-fail/database-syntax.rs b/contrib/codegen/tests/ui-fail/database-syntax.rs index 8d7e2123..ee2f26ab 100644 --- a/contrib/codegen/tests/ui-fail/database-syntax.rs +++ b/contrib/codegen/tests/ui-fail/database-syntax.rs @@ -4,39 +4,30 @@ use rocket_contrib::databases::diesel; #[database] -//~^ ERROR expected string literal struct A(diesel::SqliteConnection); #[database(1)] -//~^ ERROR expected string literal struct B(diesel::SqliteConnection); #[database(123)] -//~^ ERROR expected string literal struct C(diesel::SqliteConnection); #[database("hello" "hi")] -//~^ ERROR expected string literal struct D(diesel::SqliteConnection); #[database("test")] enum Foo { } -//~^ ERROR on structs #[database("test")] struct Bar(diesel::SqliteConnection, diesel::SqliteConnection); -//~^ ERROR one unnamed field #[database("test")] union Baz { } -//~^ ERROR on structs #[database("test")] struct E<'r>(&'r str); -//~^ ERROR generics #[database("test")] struct F(T); -//~^ ERROR generics fn main() { } diff --git a/contrib/codegen/tests/ui-fail/database-types.rs b/contrib/codegen/tests/ui-fail/database-types.rs index 0cee2fe2..e9841988 100644 --- a/contrib/codegen/tests/ui-fail/database-types.rs +++ b/contrib/codegen/tests/ui-fail/database-types.rs @@ -5,10 +5,8 @@ struct Unknown; #[database("foo")] struct A(Unknown); -//~^ ERROR Unknown: rocket_contrib::databases::Poolable #[database("foo")] struct B(Vec); -//~^ ERROR Vec: rocket_contrib::databases::Poolable fn main() { } diff --git a/core/codegen/Cargo.toml b/core/codegen/Cargo.toml index e32395a5..7c5dd0f0 100644 --- a/core/codegen/Cargo.toml +++ b/core/codegen/Cargo.toml @@ -19,7 +19,7 @@ proc-macro = true indexmap = "1.0" quote = "1.0" rocket_http = { version = "0.5.0-dev", path = "../http/" } -devise = { git = "https://github.com/SergioBenitez/Devise.git", rev = "952866f7" } +devise = { git = "https://github.com/SergioBenitez/Devise.git", rev = "1e42a2691" } glob = "0.3" [build-dependencies] diff --git a/core/codegen/src/attribute/async_entry.rs b/core/codegen/src/attribute/async_entry.rs index c6c75625..dfbe8b2c 100644 --- a/core/codegen/src/attribute/async_entry.rs +++ b/core/codegen/src/attribute/async_entry.rs @@ -18,9 +18,11 @@ impl EntryAttr for Main { fn function(f: &syn::ItemFn, block: &syn::Block) -> Result { let (attrs, vis, mut sig) = (&f.attrs, &f.vis, f.sig.clone()); if sig.ident != "main" { - return Err(Span::call_site() + // FIXME(diag): warning! + Span::call_site() .warning("attribute is typically applied to `main` function") - .span_note(sig.span(), "this function is not `main`")); + .span_note(sig.ident.span(), "this function is not `main`") + .emit_as_item_tokens(); } sig.asyncness = None; @@ -54,7 +56,7 @@ impl EntryAttr for Launch { return Err(Span::call_site() .error("attribute cannot be applied to `main` function") .note("this attribute generates a `main` function") - .span_note(f.sig.span(), "this function cannot be `main`")); + .span_note(f.sig.ident.span(), "this function cannot be `main`")); } let ty = match &f.sig.output { @@ -118,7 +120,7 @@ macro_rules! async_entry { ($name:ident, $kind:ty, $default:expr) => ( pub fn $name(a: proc_macro::TokenStream, i: proc_macro::TokenStream) -> TokenStream { _async_entry::<$kind>(a, i).unwrap_or_else(|d| { - let d = d.emit_as_tokens(); + let d = d.emit_as_item_tokens(); let default = $default; quote!(#d #default) }) diff --git a/core/codegen/src/attribute/catch.rs b/core/codegen/src/attribute/catch.rs index 2e9363d9..5599c4eb 100644 --- a/core/codegen/src/attribute/catch.rs +++ b/core/codegen/src/attribute/catch.rs @@ -63,7 +63,7 @@ pub fn _catch( // Determine the number of parameters that will be passed in. if catch.function.sig.inputs.len() > 1 { - return Err(catch.function.sig.inputs.span() + return Err(catch.function.sig.paren_token.span .error("invalid number of arguments: must be zero or one") .help("catchers may optionally take an argument of type `&Request`")); } @@ -72,7 +72,7 @@ pub fn _catch( // that prevents this from working (error on `Output` type of `Future`), or // this simply isn't possible with `async fn`. // // Typecheck the catcher function if it has arguments. - // user_catcher_fn_name.set_span(catch.function.sig.inputs.span().into()); + // user_catcher_fn_name.set_span(catch.function.sig.paren_token.span.into()); // let user_catcher_fn_call = catch.function.sig.inputs.first() // .map(|arg| { // let ty = quote!(fn(&#Request) -> _).respanned(Span::call_site().into()); @@ -96,7 +96,10 @@ pub fn _catch( // Set the `req` span to that of the arg for a correct `Wrong type` span. let input = catch.function.sig.inputs.first() - .map(|arg| req.respanned(arg.span().into())); + .map(|arg| match arg { + syn::FnArg::Receiver(_) => req.respanned(arg.span()), + syn::FnArg::Typed(a) => req.respanned(a.ty.span()) + }); // We append `.await` to the function call if this is `async`. let dot_await = catch.function.sig.asyncness @@ -138,5 +141,5 @@ pub fn catch_attribute( args: proc_macro::TokenStream, input: proc_macro::TokenStream ) -> TokenStream { - _catch(args, input).unwrap_or_else(|d| d.emit_as_tokens()) + _catch(args, input).unwrap_or_else(|d| d.emit_as_item_tokens()) } diff --git a/core/codegen/src/attribute/route.rs b/core/codegen/src/attribute/route.rs index 698dafa8..9cb90c54 100644 --- a/core/codegen/src/attribute/route.rs +++ b/core/codegen/src/attribute/route.rs @@ -62,7 +62,7 @@ fn parse_route(attr: RouteAttribute, function: syn::ItemFn) -> Result { // FIXME(diag: warning) data.full_span.warning("`data` used with non-payload-supporting method") .span_note(attr.method.span, msg) - .emit_as_tokens(); + .emit_as_item_tokens(); } } @@ -115,11 +115,7 @@ fn parse_route(attr: RouteAttribute, function: syn::ItemFn) -> Result { } // Check that all of the declared parameters are function inputs. - let span = match function.sig.inputs.is_empty() { - false => function.sig.inputs.span(), - true => function.span() - }; - + let span = function.sig.paren_token.span; for missing in segments.difference(&fn_segments) { diags.push(missing.span.error("unused dynamic parameter") .span_note(span, format!("expected argument named `{}` here", missing.name))) @@ -522,5 +518,5 @@ pub fn route_attribute>>( None => complete_route(args.into(), input.into()) }; - result.unwrap_or_else(|diag| diag.emit_as_tokens()) + result.unwrap_or_else(|diag| diag.emit_as_item_tokens()) } diff --git a/core/codegen/src/bang/mod.rs b/core/codegen/src/bang/mod.rs index fd05a192..b8ceec83 100644 --- a/core/codegen/src/bang/mod.rs +++ b/core/codegen/src/bang/mod.rs @@ -45,7 +45,7 @@ fn prefixed_vec( __vector })) .unwrap_or_else(|diag| { - let diag_tokens = diag.emit_as_tokens(); + let diag_tokens = diag.emit_as_expr_tokens(); quote!({ #diag_tokens let __vec: #_Vec<#ty> = vec![]; @@ -64,15 +64,16 @@ pub fn catchers_macro(input: proc_macro::TokenStream) -> TokenStream { pub fn uri_macro(input: proc_macro::TokenStream) -> TokenStream { uri::_uri_macro(input.into()) - .unwrap_or_else(|diag| diag.emit_as_tokens()) + .unwrap_or_else(|diag| diag.emit_as_expr_tokens()) } pub fn uri_internal_macro(input: proc_macro::TokenStream) -> TokenStream { - uri::_uri_internal_macro(input.into()) - .unwrap_or_else(|diag| diag.emit_as_tokens()) + let tokens = uri::_uri_internal_macro(input.into()) + .unwrap_or_else(|diag| diag.emit_as_expr_tokens()); + tokens } pub fn guide_tests_internal(input: proc_macro::TokenStream) -> TokenStream { test_guide::_macro(input) - .unwrap_or_else(|diag| diag.emit_as_tokens()) + .unwrap_or_else(|diag| diag.emit_as_item_tokens()) } diff --git a/core/codegen/src/derive/from_form.rs b/core/codegen/src/derive/from_form.rs index 67531df4..ac36f18a 100644 --- a/core/codegen/src/derive/from_form.rs +++ b/core/codegen/src/derive/from_form.rs @@ -34,9 +34,9 @@ impl FromMeta for FormField { } } -fn validate_struct(gen: &DeriveGenerator, data: Struct<'_>) -> Result<()> { +fn validate_struct(_: &DeriveGenerator, data: Struct<'_>) -> Result<()> { if data.fields().is_empty() { - return Err(gen.input.span().error("at least one field is required")); + return Err(data.fields.span().error("at least one field is required")); } let mut names = ::std::collections::HashMap::new(); @@ -67,9 +67,9 @@ pub fn derive_from_form(input: proc_macro::TokenStream) -> TokenStream { .map_type_generic(|_, ident, _| quote! { #ident : ::rocket::request::FromFormValue<'__f> }) - .validate_generics(|_, generics| match generics.lifetimes().count() > 1 { - true => Err(generics.span().error("only one lifetime is supported")), - false => Ok(()) + .validate_generics(|_, generics| match generics.lifetimes().enumerate().last() { + Some((i, lt)) if i >= 1 => Err(lt.span().error("only one lifetime is supported")), + _ => Ok(()) }) .validate_struct(validate_struct) .function(|_, inner| quote! { @@ -85,7 +85,7 @@ pub fn derive_from_form(input: proc_macro::TokenStream) -> TokenStream { .try_map_fields(move |_, fields| { define_vars_and_mods!(_None, _Some, _Ok, _Err); let (constructors, matchers, builders) = fields.iter().map(|field| { - let (ident, span) = (&field.ident, field.span().into()); + let (ident, span) = (&field.ident, field.span()); let default_name = ident.as_ref().expect("named").to_string(); let name = Form::from_attrs("form", &field.attrs) .map(|result| result.map(|form| form.field.name)) diff --git a/core/codegen/src/derive/from_form_value.rs b/core/codegen/src/derive/from_form_value.rs index 30ef3697..16fc91f6 100644 --- a/core/codegen/src/derive/from_form_value.rs +++ b/core/codegen/src/derive/from_form_value.rs @@ -12,18 +12,17 @@ pub fn derive_from_form_value(input: proc_macro::TokenStream) -> TokenStream { DeriveGenerator::build_for(input, quote!(impl<'__v> ::rocket::request::FromFormValue<'__v>)) .generic_support(GenericSupport::None) .data_support(DataSupport::Enum) - .validate_enum(|generator, data| { + .validate_enum(|_, data| { // This derive only works for variants that are nullary. for variant in data.variants() { if !variant.fields().is_empty() { - return Err(variant.span().error("variants cannot have fields")); + return Err(variant.fields().span().error("variants cannot have fields")); } } // Emit a warning if the enum is empty. if data.variants.is_empty() { - return Err(generator.input.span() - .error("enum must have at least one field")); + return Err(data.brace_token.span.error("enum must have at least one field")); } Ok(()) diff --git a/core/codegen/src/derive/responder.rs b/core/codegen/src/derive/responder.rs index abd2b8ba..9728efb2 100644 --- a/core/codegen/src/derive/responder.rs +++ b/core/codegen/src/derive/responder.rs @@ -43,7 +43,7 @@ pub fn derive_responder(input: proc_macro::TokenStream) -> TokenStream { quote_spanned!(item.span().into() => __res.set_header(#item);) } - let attr = ItemAttr::from_attrs("response", fields.parent_attrs()) + let attr = ItemAttr::from_attrs("response", fields.parent.attrs()) .unwrap_or_else(|| Ok(Default::default()))?; let responder = fields.iter().next().map(|f| { diff --git a/core/codegen/src/derive/uri_display.rs b/core/codegen/src/derive/uri_display.rs index 521dc984..8a7d131a 100644 --- a/core/codegen/src/derive/uri_display.rs +++ b/core/codegen/src/derive/uri_display.rs @@ -2,7 +2,7 @@ use devise::{*, ext::SpanDiagnosticExt}; use crate::derive::from_form::Form; -use crate::proc_macro2::{TokenStream, Span}; +use crate::proc_macro2::TokenStream; const NO_EMPTY_FIELDS: &str = "fieldless structs or variants are not supported"; const NO_NULLARY: &str = "nullary items are not supported"; @@ -10,29 +10,25 @@ const NO_EMPTY_ENUMS: &str = "empty enums are not supported"; const ONLY_ONE_UNNAMED: &str = "tuple structs or variants must have exactly one field"; const EXACTLY_ONE_FIELD: &str = "struct must have exactly one field"; -fn validate_fields(fields: Fields<'_>, parent_span: Span) -> Result<()> { +fn validate_fields(ident: &syn::Ident, fields: Fields<'_>) -> Result<()> { if fields.count() == 0 { - return Err(parent_span.error(NO_EMPTY_FIELDS)) + return Err(ident.span().error(NO_EMPTY_FIELDS)) } else if fields.are_unnamed() && fields.count() > 1 { - return Err(fields.span().error(ONLY_ONE_UNNAMED)); + return Err(fields.span.error(ONLY_ONE_UNNAMED)); } else if fields.are_unit() { - return Err(parent_span.error(NO_NULLARY)); + return Err(fields.span.error(NO_NULLARY)); } Ok(()) } -fn validate_struct(gen: &DeriveGenerator, data: Struct<'_>) -> Result<()> { - validate_fields(data.fields(), gen.input.span()) -} - -fn validate_enum(gen: &DeriveGenerator, data: Enum<'_>) -> Result<()> { +fn validate_enum(_: &DeriveGenerator, data: Enum<'_>) -> Result<()> { if data.variants().count() == 0 { - return Err(gen.input.span().error(NO_EMPTY_ENUMS)); + return Err(data.brace_token.span.error(NO_EMPTY_ENUMS)); } for variant in data.variants() { - validate_fields(variant.fields(), variant.span())?; + validate_fields(&variant.ident, variant.fields())?; } Ok(()) @@ -49,7 +45,7 @@ pub fn derive_uri_display_query(input: proc_macro::TokenStream) -> TokenStream { .data_support(DataSupport::Struct | DataSupport::Enum) .generic_support(GenericSupport::Type | GenericSupport::Lifetime) .validate_enum(validate_enum) - .validate_struct(validate_struct) + .validate_struct(|gen, data| validate_fields(&gen.input.ident, data.fields())) .map_type_generic(move |_, ident, _| quote!(#ident : #UriDisplay)) .function(move |_, inner| quote! { fn fmt(&self, f: &mut #Formatter) -> ::std::fmt::Result { @@ -72,7 +68,12 @@ pub fn derive_uri_display_query(input: proc_macro::TokenStream) -> TokenStream { Ok(tokens) }) - .to_tokens(); + .try_to_tokens(); + + let uri_display = match uri_display { + Ok(tokens) => tokens, + Err(diag) => return diag.emit_as_item_tokens() + }; let i = input.clone(); let gen_trait = quote!(impl #FromUriParam<#Query, Self>); @@ -136,7 +137,7 @@ pub fn derive_uri_display_path(input: proc_macro::TokenStream) -> TokenStream { .map_type_generic(move |_, ident, _| quote!(#ident : #UriDisplay)) .validate_fields(|_, fields| match fields.count() { 1 => Ok(()), - _ => Err(fields.span().error(EXACTLY_ONE_FIELD)) + _ => Err(fields.span.error(EXACTLY_ONE_FIELD)) }) .function(move |_, inner| quote! { fn fmt(&self, f: &mut #Formatter) -> ::std::fmt::Result { @@ -149,7 +150,12 @@ pub fn derive_uri_display_path(input: proc_macro::TokenStream) -> TokenStream { let accessor = field.accessor(); quote_spanned!(span => f.write_value(&#accessor)?;) }) - .to_tokens(); + .try_to_tokens(); + + let uri_display = match uri_display { + Ok(tokens) => tokens, + Err(diag) => return diag.emit_as_item_tokens() + }; let i = input.clone(); let gen_trait = quote!(impl #FromUriParam<#Path, Self>); diff --git a/core/codegen/src/http_codegen.rs b/core/codegen/src/http_codegen.rs index 72cf24c6..f65c8ca7 100644 --- a/core/codegen/src/http_codegen.rs +++ b/core/codegen/src/http_codegen.rs @@ -85,7 +85,7 @@ impl FromMeta for MediaType { // FIXME(diag: warning) meta.value_span() .warning(format!("'{}' is not a known media type", mt)) - .emit_as_tokens(); + .emit_as_item_tokens(); } Ok(MediaType(mt)) diff --git a/core/codegen/src/lib.rs b/core/codegen/src/lib.rs index 2ee24ad2..e1f624d6 100644 --- a/core/codegen/src/lib.rs +++ b/core/codegen/src/lib.rs @@ -86,6 +86,7 @@ vars_and_mods! { FromTransformedData => rocket::data::FromTransformedData, Transform => rocket::data::Transform, Query => rocket::request::Query, + FromFormValue => rocket::request::FromFormValue, Request => rocket::Request, Response => rocket::response::Response, Data => rocket::Data, @@ -136,7 +137,7 @@ macro_rules! emit { let debug_tokens = proc_macro2::Span::call_site() .note("emitting Rocket code generation debug output") .note(tokens.to_string()) - .emit_as_tokens(); + .emit_as_item_tokens(); tokens.extend(debug_tokens); } diff --git a/core/codegen/src/proc_macro_ext.rs b/core/codegen/src/proc_macro_ext.rs index 72776020..c02b970b 100644 --- a/core/codegen/src/proc_macro_ext.rs +++ b/core/codegen/src/proc_macro_ext.rs @@ -30,7 +30,7 @@ impl Diagnostics { let mut last = iter.next().expect("Diagnostic::emit_head empty"); for diag in iter { // FIXME(diag: emit, can there be errors here?) - last.emit_as_tokens(); + last.emit_as_item_tokens(); last = diag; } diff --git a/core/codegen/tests/ui-fail-nightly/async-entry.stderr b/core/codegen/tests/ui-fail-nightly/async-entry.stderr index 6a2a4775..a0667c1b 100644 --- a/core/codegen/tests/ui-fail-nightly/async-entry.stderr +++ b/core/codegen/tests/ui-fail-nightly/async-entry.stderr @@ -18,10 +18,10 @@ warning: attribute is typically applied to `main` function | ^^^^^^^^^^^^^^^ | note: this function is not `main` - --> $DIR/async-entry.rs:13:5 + --> $DIR/async-entry.rs:13:14 | 13 | async fn foo() { } - | ^^^^^^^^^^^^^^ + | ^^^ = note: this warning originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) error: attribute can only be applied to `async` functions @@ -38,120 +38,120 @@ note: this function must be `async` = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) error: attribute cannot be applied to `main` function - --> $DIR/async-entry.rs:55:5 + --> $DIR/async-entry.rs:52:5 | -55 | #[rocket::launch] +52 | #[rocket::launch] | ^^^^^^^^^^^^^^^^^ | = note: this attribute generates a `main` function note: this function cannot be `main` - --> $DIR/async-entry.rs:56:5 + --> $DIR/async-entry.rs:53:8 | -56 | fn main() -> rocket::Rocket { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +53 | fn main() -> rocket::Rocket { + | ^^^^ = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) error: attribute can only be applied to functions that return a value - --> $DIR/async-entry.rs:63:5 + --> $DIR/async-entry.rs:59:5 | -63 | #[rocket::launch] +59 | #[rocket::launch] | ^^^^^^^^^^^^^^^^^ | note: this function must return a value - --> $DIR/async-entry.rs:64:5 + --> $DIR/async-entry.rs:60:5 | -64 | async fn rocket() { +60 | async fn rocket() { | ^^^^^^^^^^^^^^^^^ = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) error: attribute can only be applied to functions that return a value - --> $DIR/async-entry.rs:72:5 + --> $DIR/async-entry.rs:67:5 | -72 | #[rocket::launch] +67 | #[rocket::launch] | ^^^^^^^^^^^^^^^^^ | note: this function must return a value - --> $DIR/async-entry.rs:73:5 + --> $DIR/async-entry.rs:68:5 | -73 | fn rocket() { +68 | fn rocket() { | ^^^^^^^^^^^ = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) error: attribute cannot be applied to `main` function - --> $DIR/async-entry.rs:89:5 + --> $DIR/async-entry.rs:82:5 | -89 | #[rocket::launch] +82 | #[rocket::launch] | ^^^^^^^^^^^^^^^^^ | = note: this attribute generates a `main` function note: this function cannot be `main` - --> $DIR/async-entry.rs:90:5 + --> $DIR/async-entry.rs:83:8 | -90 | fn main() -> &'static str { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +83 | fn main() -> &'static str { + | ^^^^ = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) error: attribute cannot be applied to `main` function - --> $DIR/async-entry.rs:98:5 + --> $DIR/async-entry.rs:90:5 | -98 | #[rocket::launch] +90 | #[rocket::launch] | ^^^^^^^^^^^^^^^^^ | = note: this attribute generates a `main` function note: this function cannot be `main` - --> $DIR/async-entry.rs:99:5 + --> $DIR/async-entry.rs:91:14 | -99 | async fn main() -> rocket::Rocket { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +91 | async fn main() -> rocket::Rocket { + | ^^^^ = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) error[E0728]: `await` is only allowed inside `async` functions and blocks - --> $DIR/async-entry.rs:82:17 + --> $DIR/async-entry.rs:76:17 | -81 | fn rocket() -> rocket::Rocket { +75 | fn rocket() -> rocket::Rocket { | ------ this is not `async` -82 | let _ = rocket::ignite().launch().await; +76 | let _ = rocket::ignite().launch().await; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ only allowed inside `async` functions and blocks error[E0308]: mismatched types - --> $DIR/async-entry.rs:40:9 + --> $DIR/async-entry.rs:38:9 | -40 | rocket::ignite() +38 | rocket::ignite() | ^^^^^^^^^^^^^^^^ expected struct `std::string::String`, found struct `rocket::Rocket` error[E0308]: mismatched types - --> $DIR/async-entry.rs:49:9 + --> $DIR/async-entry.rs:47:9 | -49 | "hi".to_string() +47 | "hi".to_string() | ^^^^^^^^^^^^^^^^ expected struct `rocket::Rocket`, found struct `std::string::String` error[E0308]: mismatched types - --> $DIR/async-entry.rs:27:21 + --> $DIR/async-entry.rs:26:21 | -27 | async fn main() { +26 | async fn main() { | ^ expected `()` because of default return type | _____________________| | | -28 | | //~^ ERROR mismatched types -29 | | rocket::ignite() -30 | | } +27 | | +28 | | rocket::ignite() +29 | | } | | ^- help: try adding a semicolon: `;` | |_____| | expected `()`, found struct `rocket::Rocket` error[E0308]: mismatched types - --> $DIR/async-entry.rs:37:26 + --> $DIR/async-entry.rs:36:26 | -37 | async fn rocket() -> String { +36 | async fn rocket() -> String { | ^^^^^^ | | | expected struct `rocket::Rocket`, found struct `std::string::String` | expected due to this error[E0277]: `main` has invalid return type `rocket::Rocket` - --> $DIR/async-entry.rs:106:20 - | -106 | async fn main() -> rocket::Rocket { - | ^^^^^^^^^^^^^^ `main` can only return types that implement `std::process::Termination` - | - = help: consider using `()`, or a `Result` + --> $DIR/async-entry.rs:97:20 + | +97 | async fn main() -> rocket::Rocket { + | ^^^^^^^^^^^^^^ `main` can only return types that implement `std::process::Termination` + | + = help: consider using `()`, or a `Result` diff --git a/core/codegen/tests/ui-fail-nightly/catch.stderr b/core/codegen/tests/ui-fail-nightly/catch.stderr index 4e99155b..583e5959 100644 --- a/core/codegen/tests/ui-fail-nightly/catch.stderr +++ b/core/codegen/tests/ui-fail-nightly/catch.stderr @@ -7,66 +7,66 @@ error: expected `fn` = help: `#[catch]` can only be used on functions error: expected `fn` - --> $DIR/catch.rs:11:7 - | -11 | const CATCH: &str = "Catcher"; - | ^^^^^ - | - = help: `#[catch]` can only be used on functions + --> $DIR/catch.rs:9:7 + | +9 | const CATCH: &str = "Catcher"; + | ^^^^^ + | + = help: `#[catch]` can only be used on functions error: invalid value: expected unsigned integer literal - --> $DIR/catch.rs:15:9 + --> $DIR/catch.rs:11:9 | -15 | #[catch("404")] //~ ERROR expected unsigned integer literal +11 | #[catch("404")] | ^^^^^ | = help: `#[catch]` expects a single status integer, e.g.: #[catch(404)] error: unexpected keyed parameter: expected literal or identifier - --> $DIR/catch.rs:19:9 + --> $DIR/catch.rs:14:9 | -19 | #[catch(code = "404")] //~ ERROR unexpected keyed parameter +14 | #[catch(code = "404")] | ^^^^^^^^^^^^ | = help: `#[catch]` expects a single status integer, e.g.: #[catch(404)] error: unexpected keyed parameter: expected literal or identifier - --> $DIR/catch.rs:23:9 + --> $DIR/catch.rs:17:9 | -23 | #[catch(code = 404)] //~ ERROR unexpected keyed parameter +17 | #[catch(code = 404)] | ^^^^^^^^^^ | = help: `#[catch]` expects a single status integer, e.g.: #[catch(404)] error: status must be in range [100, 599] - --> $DIR/catch.rs:27:9 + --> $DIR/catch.rs:20:9 | -27 | #[catch(99)] //~ ERROR in range [100, 599] +20 | #[catch(99)] | ^^ | = help: `#[catch]` expects a single status integer, e.g.: #[catch(404)] error: status must be in range [100, 599] - --> $DIR/catch.rs:31:9 + --> $DIR/catch.rs:23:9 | -31 | #[catch(600)] //~ ERROR in range [100, 599] +23 | #[catch(600)] | ^^^ | = help: `#[catch]` expects a single status integer, e.g.: #[catch(404)] error: unexpected attribute parameter: `message` - --> $DIR/catch.rs:35:14 + --> $DIR/catch.rs:26:14 | -35 | #[catch(400, message = "foo")] //~ ERROR unexpected attribute parameter: `message` +26 | #[catch(400, message = "foo")] | ^^^^^^^^^^^^^^^ | = help: `#[catch]` expects a single status integer, e.g.: #[catch(404)] error: invalid number of arguments: must be zero or one - --> $DIR/catch.rs:40:7 + --> $DIR/catch.rs:30:6 | -40 | fn f3(_request: &Request, other: bool) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +30 | fn f3(_request: &Request, other: bool) { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: catchers may optionally take an argument of type `&Request` diff --git a/core/codegen/tests/ui-fail-nightly/catch_type_errors.stderr b/core/codegen/tests/ui-fail-nightly/catch_type_errors.stderr index 4e51feb5..60379299 100644 --- a/core/codegen/tests/ui-fail-nightly/catch_type_errors.stderr +++ b/core/codegen/tests/ui-fail-nightly/catch_type_errors.stderr @@ -7,31 +7,31 @@ error[E0277]: the trait bound `usize: rocket::response::Responder<'_, '_>` is no = note: required by `rocket::response::Responder::respond_to` error[E0277]: the trait bound `bool: rocket::response::Responder<'_, '_>` is not satisfied - --> $DIR/catch_type_errors.rs:12:30 + --> $DIR/catch_type_errors.rs:11:30 | -12 | fn f2(_request: &Request) -> bool { +11 | fn f2(_request: &Request) -> bool { | ^^^^ the trait `rocket::response::Responder<'_, '_>` is not implemented for `bool` | = note: required by `rocket::response::Responder::respond_to` error[E0308]: mismatched types - --> $DIR/catch_type_errors.rs:18:7 + --> $DIR/catch_type_errors.rs:16:17 | -18 | fn f3(_request: bool) -> usize { - | ^^^^^^^^^^^^^^ expected `bool`, found `&rocket::Request<'_>` +16 | fn f3(_request: bool) -> usize { + | ^^^^ expected `bool`, found `&rocket::Request<'_>` error[E0277]: the trait bound `usize: rocket::response::Responder<'_, '_>` is not satisfied - --> $DIR/catch_type_errors.rs:18:26 + --> $DIR/catch_type_errors.rs:16:26 | -18 | fn f3(_request: bool) -> usize { +16 | fn f3(_request: bool) -> usize { | ^^^^^ the trait `rocket::response::Responder<'_, '_>` is not implemented for `usize` | = note: required by `rocket::response::Responder::respond_to` error[E0277]: the trait bound `usize: rocket::response::Responder<'_, '_>` is not satisfied - --> $DIR/catch_type_errors.rs:25:12 + --> $DIR/catch_type_errors.rs:21:12 | -25 | fn f4() -> usize { +21 | fn f4() -> usize { | ^^^^^ the trait `rocket::response::Responder<'_, '_>` is not implemented for `usize` | = note: required by `rocket::response::Responder::respond_to` diff --git a/core/codegen/tests/ui-fail-nightly/catchers.stderr b/core/codegen/tests/ui-fail-nightly/catchers.stderr index 388da528..ca261acd 100644 --- a/core/codegen/tests/ui-fail-nightly/catchers.stderr +++ b/core/codegen/tests/ui-fail-nightly/catchers.stderr @@ -1,19 +1,19 @@ error: expected `,` --> $DIR/catchers.rs:4:25 | -4 | let _ = catchers![a b]; //~ ERROR expected +4 | let _ = catchers![a b]; | ^ error: expected identifier --> $DIR/catchers.rs:6:26 | -6 | let _ = catchers![a::, ]; //~ ERROR expected identifier +6 | let _ = catchers![a::, ]; | ^ error: unexpected end of input, expected identifier --> $DIR/catchers.rs:7:13 | -7 | let _ = catchers![a::]; //~ ERROR expected identifier +7 | let _ = catchers![a::]; | ^^^^^^^^^^^^^^ | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/core/codegen/tests/ui-fail-nightly/from_form.stderr b/core/codegen/tests/ui-fail-nightly/from_form.stderr index eef28aa3..2247f7ff 100644 --- a/core/codegen/tests/ui-fail-nightly/from_form.stderr +++ b/core/codegen/tests/ui-fail-nightly/from_form.stderr @@ -12,37 +12,50 @@ note: error occurred while deriving `FromForm` = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: tuple structs are not supported - --> $DIR/from_form.rs:10:1 - | -10 | struct Foo1; - | ^^^^^^^^^^^^ - | + --> $DIR/from_form.rs:9:1 + | +9 | struct Foo1; + | ^^^^^^^^^^^^ + | note: error occurred while deriving `FromForm` - --> $DIR/from_form.rs:9:10 - | -9 | #[derive(FromForm)] - | ^^^^^^^^ - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + --> $DIR/from_form.rs:8:10 + | +8 | #[derive(FromForm)] + | ^^^^^^^^ + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: at least one field is required - --> $DIR/from_form.rs:14:1 + --> $DIR/from_form.rs:12:13 | -14 | struct Foo2 { } - | ^^^^^^^^^^^^^^^^ +12 | struct Foo2 { } + | ^^^^ | note: error occurred while deriving `FromForm` - --> $DIR/from_form.rs:13:10 + --> $DIR/from_form.rs:11:10 | -13 | #[derive(FromForm)] +11 | #[derive(FromForm)] | ^^^^^^^^ = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: tuple structs are not supported - --> $DIR/from_form.rs:18:1 + --> $DIR/from_form.rs:15:1 | -18 | struct Foo3(usize); +15 | struct Foo3(usize); | ^^^^^^^^^^^^^^^^^^^ | +note: error occurred while deriving `FromForm` + --> $DIR/from_form.rs:14:10 + | +14 | #[derive(FromForm)] + | ^^^^^^^^ + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: only one lifetime is supported + --> $DIR/from_form.rs:18:25 + | +18 | struct NextTodoTask<'f, 'a> { + | ^^ + | note: error occurred while deriving `FromForm` --> $DIR/from_form.rs:17:10 | @@ -50,132 +63,145 @@ note: error occurred while deriving `FromForm` | ^^^^^^^^ = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) -error: only one lifetime is supported - --> $DIR/from_form.rs:22:20 - | -22 | struct NextTodoTask<'f, 'a> { - | ^^^^^^^^ - | -note: error occurred while deriving `FromForm` - --> $DIR/from_form.rs:21:10 - | -21 | #[derive(FromForm)] - | ^^^^^^^^ - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - error: invalid form field name - --> $DIR/from_form.rs:32:20 + --> $DIR/from_form.rs:27:20 | -32 | #[form(field = "isindex")] +27 | #[form(field = "isindex")] | ^^^^^^^^^ | note: error occurred while deriving `FromForm` - --> $DIR/from_form.rs:30:10 + --> $DIR/from_form.rs:25:10 | -30 | #[derive(FromForm)] +25 | #[derive(FromForm)] | ^^^^^^^^ = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: duplicate field name - --> $DIR/from_form.rs:41:5 + --> $DIR/from_form.rs:35:5 | -41 | foo: usize, +35 | foo: usize, | ^^^ | note: previous definition here - --> $DIR/from_form.rs:39:20 + --> $DIR/from_form.rs:33:20 | -39 | #[form(field = "foo")] +33 | #[form(field = "foo")] | ^^^^^ note: error occurred while deriving `FromForm` - --> $DIR/from_form.rs:37:10 + --> $DIR/from_form.rs:31:10 | -37 | #[derive(FromForm)] +31 | #[derive(FromForm)] + | ^^^^^^^^ + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: duplicate field name + --> $DIR/from_form.rs:42:20 + | +42 | #[form(field = "hello")] + | ^^^^^^^ + | +note: previous definition here + --> $DIR/from_form.rs:40:20 + | +40 | #[form(field = "hello")] + | ^^^^^^^ +note: error occurred while deriving `FromForm` + --> $DIR/from_form.rs:38:10 + | +38 | #[derive(FromForm)] | ^^^^^^^^ = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: duplicate field name --> $DIR/from_form.rs:49:20 | -49 | #[form(field = "hello")] +49 | #[form(field = "first")] | ^^^^^^^ | note: previous definition here - --> $DIR/from_form.rs:47:20 + --> $DIR/from_form.rs:48:5 | -47 | #[form(field = "hello")] - | ^^^^^^^ -note: error occurred while deriving `FromForm` - --> $DIR/from_form.rs:45:10 - | -45 | #[derive(FromForm)] - | ^^^^^^^^ - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error: duplicate field name - --> $DIR/from_form.rs:57:20 - | -57 | #[form(field = "first")] - | ^^^^^^^ - | -note: previous definition here - --> $DIR/from_form.rs:56:5 - | -56 | first: String, +48 | first: String, | ^^^^^ note: error occurred while deriving `FromForm` - --> $DIR/from_form.rs:54:10 + --> $DIR/from_form.rs:46:10 | -54 | #[derive(FromForm)] +46 | #[derive(FromForm)] | ^^^^^^^^ = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: duplicate attribute parameter: field - --> $DIR/from_form.rs:64:28 + --> $DIR/from_form.rs:55:28 | -64 | #[form(field = "blah", field = "bloo")] +55 | #[form(field = "blah", field = "bloo")] | ^^^^^^^^^^^^^^ | note: error occurred while deriving `FromForm` - --> $DIR/from_form.rs:62:10 + --> $DIR/from_form.rs:53:10 | -62 | #[derive(FromForm)] +53 | #[derive(FromForm)] | ^^^^^^^^ = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: malformed attribute: expected list - --> $DIR/from_form.rs:71:7 + --> $DIR/from_form.rs:61:7 | -71 | #[form] +61 | #[form] | ^^^^ | = help: expected syntax: #[form(key = value, ..)] note: error occurred while deriving `FromForm` - --> $DIR/from_form.rs:69:10 + --> $DIR/from_form.rs:59:10 | -69 | #[derive(FromForm)] +59 | #[derive(FromForm)] | ^^^^^^^^ = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: expected key/value pair - --> $DIR/from_form.rs:78:12 + --> $DIR/from_form.rs:67:12 | -78 | #[form("blah")] +67 | #[form("blah")] | ^^^^^^ | note: error occurred while deriving `FromForm` - --> $DIR/from_form.rs:76:10 + --> $DIR/from_form.rs:65:10 | -76 | #[derive(FromForm)] +65 | #[derive(FromForm)] | ^^^^^^^^ = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: expected key/value pair - --> $DIR/from_form.rs:85:12 + --> $DIR/from_form.rs:73:12 | -85 | #[form(123)] +73 | #[form(123)] | ^^^ | +note: error occurred while deriving `FromForm` + --> $DIR/from_form.rs:71:10 + | +71 | #[derive(FromForm)] + | ^^^^^^^^ + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: unexpected attribute parameter: `beep` + --> $DIR/from_form.rs:79:12 + | +79 | #[form(beep = "bop")] + | ^^^^^^^^^^^^ + | +note: error occurred while deriving `FromForm` + --> $DIR/from_form.rs:77:10 + | +77 | #[derive(FromForm)] + | ^^^^^^^^ + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: duplicate invocation of `form` attribute + --> $DIR/from_form.rs:86:7 + | +86 | #[form(field = "bleh")] + | ^^^^ + | note: error occurred while deriving `FromForm` --> $DIR/from_form.rs:83:10 | @@ -183,11 +209,11 @@ note: error occurred while deriving `FromForm` | ^^^^^^^^ = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) -error: unexpected attribute parameter: `beep` - --> $DIR/from_form.rs:92:12 +error: invalid value: expected string literal + --> $DIR/from_form.rs:92:20 | -92 | #[form(beep = "bop")] - | ^^^^^^^^^^^^ +92 | #[form(field = true)] + | ^^^^ | note: error occurred while deriving `FromForm` --> $DIR/from_form.rs:90:10 @@ -196,63 +222,76 @@ note: error occurred while deriving `FromForm` | ^^^^^^^^ = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) -error: duplicate invocation of `form` attribute - --> $DIR/from_form.rs:100:5 - | -100 | #[form(field = "bleh")] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | -note: error occurred while deriving `FromForm` - --> $DIR/from_form.rs:97:10 - | -97 | #[derive(FromForm)] - | ^^^^^^^^ - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error: invalid value: expected string literal - --> $DIR/from_form.rs:107:20 - | -107 | #[form(field = true)] - | ^^^^ - | -note: error occurred while deriving `FromForm` - --> $DIR/from_form.rs:105:10 - | -105 | #[derive(FromForm)] - | ^^^^^^^^ - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - error: expected literal or key/value pair - --> $DIR/from_form.rs:114:12 - | -114 | #[form(field)] - | ^^^^^ - | + --> $DIR/from_form.rs:98:12 + | +98 | #[form(field)] + | ^^^^^ + | note: error occurred while deriving `FromForm` - --> $DIR/from_form.rs:112:10 - | -112 | #[derive(FromForm)] - | ^^^^^^^^ - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + --> $DIR/from_form.rs:96:10 + | +96 | #[derive(FromForm)] + | ^^^^^^^^ + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: invalid value: expected string literal - --> $DIR/from_form.rs:121:20 + --> $DIR/from_form.rs:104:20 | -121 | #[form(field = 123)] +104 | #[form(field = 123)] | ^^^ | note: error occurred while deriving `FromForm` - --> $DIR/from_form.rs:119:10 + --> $DIR/from_form.rs:102:10 | -119 | #[derive(FromForm)] +102 | #[derive(FromForm)] + | ^^^^^^^^ + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: invalid form field name + --> $DIR/from_form.rs:110:20 + | +110 | #[form(field = "hello&world")] + | ^^^^^^^^^^^^^ + | +note: error occurred while deriving `FromForm` + --> $DIR/from_form.rs:108:10 + | +108 | #[derive(FromForm)] + | ^^^^^^^^ + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: invalid form field name + --> $DIR/from_form.rs:116:20 + | +116 | #[form(field = "!@#$%^&*()_")] + | ^^^^^^^^^^^^^ + | +note: error occurred while deriving `FromForm` + --> $DIR/from_form.rs:114:10 + | +114 | #[derive(FromForm)] + | ^^^^^^^^ + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: invalid form field name + --> $DIR/from_form.rs:122:20 + | +122 | #[form(field = "?")] + | ^^^ + | +note: error occurred while deriving `FromForm` + --> $DIR/from_form.rs:120:10 + | +120 | #[derive(FromForm)] | ^^^^^^^^ = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: invalid form field name --> $DIR/from_form.rs:128:20 | -128 | #[form(field = "hello&world")] - | ^^^^^^^^^^^^^ +128 | #[form(field = "")] + | ^^ | note: error occurred while deriving `FromForm` --> $DIR/from_form.rs:126:10 @@ -262,66 +301,27 @@ note: error occurred while deriving `FromForm` = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: invalid form field name - --> $DIR/from_form.rs:135:20 + --> $DIR/from_form.rs:134:20 | -135 | #[form(field = "!@#$%^&*()_")] - | ^^^^^^^^^^^^^ - | -note: error occurred while deriving `FromForm` - --> $DIR/from_form.rs:133:10 - | -133 | #[derive(FromForm)] - | ^^^^^^^^ - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error: invalid form field name - --> $DIR/from_form.rs:142:20 - | -142 | #[form(field = "?")] - | ^^^ - | -note: error occurred while deriving `FromForm` - --> $DIR/from_form.rs:140:10 - | -140 | #[derive(FromForm)] - | ^^^^^^^^ - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error: invalid form field name - --> $DIR/from_form.rs:149:20 - | -149 | #[form(field = "")] - | ^^ - | -note: error occurred while deriving `FromForm` - --> $DIR/from_form.rs:147:10 - | -147 | #[derive(FromForm)] - | ^^^^^^^^ - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error: invalid form field name - --> $DIR/from_form.rs:156:20 - | -156 | #[form(field = "a&b")] +134 | #[form(field = "a&b")] | ^^^^^ | note: error occurred while deriving `FromForm` - --> $DIR/from_form.rs:154:10 + --> $DIR/from_form.rs:132:10 | -154 | #[derive(FromForm)] +132 | #[derive(FromForm)] | ^^^^^^^^ = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: invalid form field name - --> $DIR/from_form.rs:163:20 + --> $DIR/from_form.rs:140:20 | -163 | #[form(field = "a=")] +140 | #[form(field = "a=")] | ^^^^ | note: error occurred while deriving `FromForm` - --> $DIR/from_form.rs:161:10 + --> $DIR/from_form.rs:138:10 | -161 | #[derive(FromForm)] +138 | #[derive(FromForm)] | ^^^^^^^^ = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/core/codegen/tests/ui-fail-nightly/from_form_type_errors.stderr b/core/codegen/tests/ui-fail-nightly/from_form_type_errors.stderr index bb938546..9b201ac3 100644 --- a/core/codegen/tests/ui-fail-nightly/from_form_type_errors.stderr +++ b/core/codegen/tests/ui-fail-nightly/from_form_type_errors.stderr @@ -5,7 +5,7 @@ error[E0277]: the trait bound `Unknown: rocket::request::FromFormValue<'_>` is n | ^^^^^^^^^^^^^^ the trait `rocket::request::FromFormValue<'_>` is not implemented for `Unknown` error[E0277]: the trait bound `Foo: rocket::request::FromFormValue<'_>` is not satisfied - --> $DIR/from_form_type_errors.rs:15:5 + --> $DIR/from_form_type_errors.rs:14:5 | -15 | field: Foo, +14 | field: Foo, | ^^^^^^^^^^^^^^^^^ the trait `rocket::request::FromFormValue<'_>` is not implemented for `Foo` diff --git a/core/codegen/tests/ui-fail-nightly/from_form_value.stderr b/core/codegen/tests/ui-fail-nightly/from_form_value.stderr index cd9bfb04..3d1939ab 100644 --- a/core/codegen/tests/ui-fail-nightly/from_form_value.stderr +++ b/core/codegen/tests/ui-fail-nightly/from_form_value.stderr @@ -12,66 +12,78 @@ note: error occurred while deriving `FromFormValue` = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: tuple structs are not supported - --> $DIR/from_form_value.rs:8:1 + --> $DIR/from_form_value.rs:7:1 | -8 | struct Foo2(usize); +7 | struct Foo2(usize); | ^^^^^^^^^^^^^^^^^^^ | note: error occurred while deriving `FromFormValue` - --> $DIR/from_form_value.rs:7:10 + --> $DIR/from_form_value.rs:6:10 | -7 | #[derive(FromFormValue)] +6 | #[derive(FromFormValue)] | ^^^^^^^^^^^^^ = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: named structs are not supported - --> $DIR/from_form_value.rs:12:1 + --> $DIR/from_form_value.rs:10:1 | -12 | / struct Foo3 { -13 | | //~^ ERROR not supported -14 | | foo: usize, -15 | | } +10 | / struct Foo3 { +11 | | foo: usize, +12 | | } | |_^ | note: error occurred while deriving `FromFormValue` - --> $DIR/from_form_value.rs:11:10 + --> $DIR/from_form_value.rs:9:10 | -11 | #[derive(FromFormValue)] +9 | #[derive(FromFormValue)] | ^^^^^^^^^^^^^ = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: variants cannot have fields - --> $DIR/from_form_value.rs:19:5 + --> $DIR/from_form_value.rs:16:7 | -19 | A(usize), - | ^^^^^^^^ +16 | A(usize), + | ^^^^^ | note: error occurred while deriving `FromFormValue` - --> $DIR/from_form_value.rs:17:10 + --> $DIR/from_form_value.rs:14:10 | -17 | #[derive(FromFormValue)] +14 | #[derive(FromFormValue)] | ^^^^^^^^^^^^^ = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: enum must have at least one field - --> $DIR/from_form_value.rs:24:1 + --> $DIR/from_form_value.rs:20:11 | -24 | enum Foo5 { } - | ^^^^^^^^^^^^^ +20 | enum Foo5 { } + | ^^^ | note: error occurred while deriving `FromFormValue` - --> $DIR/from_form_value.rs:23:10 + --> $DIR/from_form_value.rs:19:10 | -23 | #[derive(FromFormValue)] +19 | #[derive(FromFormValue)] | ^^^^^^^^^^^^^ = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: type generics are not supported - --> $DIR/from_form_value.rs:28:11 + --> $DIR/from_form_value.rs:23:11 | -28 | enum Foo6 { +23 | enum Foo6 { | ^ | +note: error occurred while deriving `FromFormValue` + --> $DIR/from_form_value.rs:22:10 + | +22 | #[derive(FromFormValue)] + | ^^^^^^^^^^^^^ + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: invalid value: expected string literal + --> $DIR/from_form_value.rs:29:20 + | +29 | #[form(value = 123)] + | ^^^ + | note: error occurred while deriving `FromFormValue` --> $DIR/from_form_value.rs:27:10 | @@ -79,11 +91,11 @@ note: error occurred while deriving `FromFormValue` | ^^^^^^^^^^^^^ = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) -error: invalid value: expected string literal - --> $DIR/from_form_value.rs:35:20 +error: expected literal or key/value pair + --> $DIR/from_form_value.rs:35:12 | -35 | #[form(value = 123)] - | ^^^ +35 | #[form(value)] + | ^^^^^ | note: error occurred while deriving `FromFormValue` --> $DIR/from_form_value.rs:33:10 @@ -91,16 +103,3 @@ note: error occurred while deriving `FromFormValue` 33 | #[derive(FromFormValue)] | ^^^^^^^^^^^^^ = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error: expected literal or key/value pair - --> $DIR/from_form_value.rs:42:12 - | -42 | #[form(value)] - | ^^^^^ - | -note: error occurred while deriving `FromFormValue` - --> $DIR/from_form_value.rs:40:10 - | -40 | #[derive(FromFormValue)] - | ^^^^^^^^^^^^^ - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/core/codegen/tests/ui-fail-nightly/responder-types.stderr b/core/codegen/tests/ui-fail-nightly/responder-types.stderr index 6d292730..72f0c593 100644 --- a/core/codegen/tests/ui-fail-nightly/responder-types.stderr +++ b/core/codegen/tests/ui-fail-nightly/responder-types.stderr @@ -1,15 +1,15 @@ error[E0277]: the trait bound `u8: rocket::response::Responder<'_, '_>` is not satisfied - --> $DIR/responder-types.rs:9:5 + --> $DIR/responder-types.rs:5:5 | -9 | thing: u8, +5 | thing: u8, | ^^^^^^^^^ the trait `rocket::response::Responder<'_, '_>` is not implemented for `u8` | = note: required by `rocket::response::Responder::respond_to` error[E0277]: the trait bound `rocket::http::Header<'_>: std::convert::From` is not satisfied - --> $DIR/responder-types.rs:16:5 + --> $DIR/responder-types.rs:11:5 | -16 | other: u8, +11 | other: u8, | ^^^^^^^^^ the trait `std::convert::From` is not implemented for `rocket::http::Header<'_>` | = help: the following implementations were found: @@ -18,17 +18,17 @@ error[E0277]: the trait bound `rocket::http::Header<'_>: std::convert::From` = note: required because of the requirements on the impl of `std::convert::Into>` for `u8` error[E0277]: the trait bound `u8: rocket::response::Responder<'_, '_>` is not satisfied - --> $DIR/responder-types.rs:22:5 + --> $DIR/responder-types.rs:16:5 | -22 | thing: u8, +16 | thing: u8, | ^^^^^^^^^ the trait `rocket::response::Responder<'_, '_>` is not implemented for `u8` | = note: required by `rocket::response::Responder::respond_to` error[E0277]: the trait bound `rocket::http::Header<'_>: std::convert::From` is not satisfied - --> $DIR/responder-types.rs:24:5 + --> $DIR/responder-types.rs:17:5 | -24 | other: u8, +17 | other: u8, | ^^^^^^^^^ the trait `std::convert::From` is not implemented for `rocket::http::Header<'_>` | = help: the following implementations were found: @@ -37,9 +37,9 @@ error[E0277]: the trait bound `rocket::http::Header<'_>: std::convert::From` = note: required because of the requirements on the impl of `std::convert::Into>` for `u8` error[E0277]: the trait bound `rocket::http::Header<'_>: std::convert::From` is not satisfied - --> $DIR/responder-types.rs:32:5 + --> $DIR/responder-types.rs:24:5 | -32 | then: String, +24 | then: String, | ^^^^^^^^^^^^ the trait `std::convert::From` is not implemented for `rocket::http::Header<'_>` | = help: the following implementations were found: @@ -48,9 +48,9 @@ error[E0277]: the trait bound `rocket::http::Header<'_>: std::convert::From>` for `std::string::String` error[E0277]: the trait bound `usize: rocket::response::Responder<'_, '_>` is not satisfied - --> $DIR/responder-types.rs:37:13 + --> $DIR/responder-types.rs:28:13 | -37 | fn foo() -> usize { 0 } +28 | fn foo() -> usize { 0 } | ^^^^^ the trait `rocket::response::Responder<'_, '_>` is not implemented for `usize` | = note: required by `rocket::handler::, rocket::http::Status, rocket::Data>>::from` diff --git a/core/codegen/tests/ui-fail-nightly/route-attribute-general-syntax.stderr b/core/codegen/tests/ui-fail-nightly/route-attribute-general-syntax.stderr index f4ffde58..62ff7ef2 100644 --- a/core/codegen/tests/ui-fail-nightly/route-attribute-general-syntax.stderr +++ b/core/codegen/tests/ui-fail-nightly/route-attribute-general-syntax.stderr @@ -1,216 +1,216 @@ error: missing expected parameter: `path` - --> $DIR/route-attribute-general-syntax.rs:5:1 + --> $DIR/route-attribute-general-syntax.rs:4:1 | -5 | #[get()] //~ ERROR missing expected parameter +4 | #[get()] | ^^^^^^^^ | = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) error: expected `fn` - --> $DIR/route-attribute-general-syntax.rs:11:1 - | -11 | struct S; - | ^^^^^^ - | - = help: #[get] can only be used on functions + --> $DIR/route-attribute-general-syntax.rs:9:1 + | +9 | struct S; + | ^^^^^^ + | + = help: #[get] can only be used on functions error: expected `fn` - --> $DIR/route-attribute-general-syntax.rs:16:1 + --> $DIR/route-attribute-general-syntax.rs:12:1 | -16 | enum A { } +12 | enum A { } | ^^^^ | = help: #[get] can only be used on functions error: expected `fn` - --> $DIR/route-attribute-general-syntax.rs:21:1 + --> $DIR/route-attribute-general-syntax.rs:15:1 | -21 | trait Foo { } +15 | trait Foo { } | ^^^^^ | = help: #[get] can only be used on functions error: expected `fn` - --> $DIR/route-attribute-general-syntax.rs:26:1 + --> $DIR/route-attribute-general-syntax.rs:18:1 | -26 | impl S { } +18 | impl S { } | ^^^^ | = help: #[get] can only be used on functions error: expected key/value pair - --> $DIR/route-attribute-general-syntax.rs:32:12 + --> $DIR/route-attribute-general-syntax.rs:21:12 | -32 | #[get("/", 123)] //~ ERROR expected +21 | #[get("/", 123)] | ^^^ error: expected key/value pair - --> $DIR/route-attribute-general-syntax.rs:35:12 + --> $DIR/route-attribute-general-syntax.rs:24:12 | -35 | #[get("/", "/")] //~ ERROR expected +24 | #[get("/", "/")] | ^^^ error: unexpected keyed parameter: expected literal or identifier - --> $DIR/route-attribute-general-syntax.rs:38:7 + --> $DIR/route-attribute-general-syntax.rs:27:7 | -38 | #[get(data = "", "/")] //~ ERROR unexpected keyed parameter +27 | #[get(data = "", "/")] | ^^^^^^^^^^^^^^ error: unexpected attribute parameter: `unknown` - --> $DIR/route-attribute-general-syntax.rs:41:12 + --> $DIR/route-attribute-general-syntax.rs:30:12 | -41 | #[get("/", unknown = "foo")] //~ ERROR unexpected +30 | #[get("/", unknown = "foo")] | ^^^^^^^^^^^^^^^ error: malformed attribute - --> $DIR/route-attribute-general-syntax.rs:44:1 + --> $DIR/route-attribute-general-syntax.rs:33:1 | -44 | #[get("/", ...)] //~ ERROR malformed +33 | #[get("/", ...)] | ^^^^^^^^^^^^^^^^ | = help: expected syntax: #[get(key = value, ..)] = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) error: handler arguments cannot be ignored - --> $DIR/route-attribute-general-syntax.rs:51:7 + --> $DIR/route-attribute-general-syntax.rs:39:7 | -51 | fn c1(_: usize) {} //~ ERROR cannot be ignored +39 | fn c1(_: usize) {} | ^^^^^^^^ | = help: all handler arguments must be of the form: `ident: Type` error: invalid value: expected string literal - --> $DIR/route-attribute-general-syntax.rs:56:7 + --> $DIR/route-attribute-general-syntax.rs:43:7 | -56 | #[get(100)] //~ ERROR expected string +43 | #[get(100)] | ^^^ error: invalid value: expected string literal - --> $DIR/route-attribute-general-syntax.rs:59:7 + --> $DIR/route-attribute-general-syntax.rs:46:7 | -59 | #[get('/')] //~ ERROR expected string +46 | #[get('/')] | ^^^ error: invalid value: expected integer literal - --> $DIR/route-attribute-general-syntax.rs:62:19 + --> $DIR/route-attribute-general-syntax.rs:49:19 | -62 | #[get("/", rank = "1")] //~ ERROR expected integer +49 | #[get("/", rank = "1")] | ^^^ error: invalid value: expected integer literal - --> $DIR/route-attribute-general-syntax.rs:65:19 + --> $DIR/route-attribute-general-syntax.rs:52:19 | -65 | #[get("/", rank = '1')] //~ ERROR expected integer +52 | #[get("/", rank = '1')] | ^^^ error: invalid or unknown media type - --> $DIR/route-attribute-general-syntax.rs:70:21 + --> $DIR/route-attribute-general-syntax.rs:57:21 | -70 | #[get("/", format = "applicationx-custom")] //~ ERROR invalid or unknown media type +57 | #[get("/", format = "applicationx-custom")] | ^^^^^^^^^^^^^^^^^^^^^ error: invalid or unknown media type - --> $DIR/route-attribute-general-syntax.rs:73:21 + --> $DIR/route-attribute-general-syntax.rs:60:21 | -73 | #[get("/", format = "")] //~ ERROR invalid or unknown media type +60 | #[get("/", format = "")] | ^^ error: invalid or unknown media type - --> $DIR/route-attribute-general-syntax.rs:76:21 + --> $DIR/route-attribute-general-syntax.rs:63:21 | -76 | #[get("/", format = "//")] //~ ERROR invalid or unknown media type +63 | #[get("/", format = "//")] | ^^^^ error: invalid or unknown media type - --> $DIR/route-attribute-general-syntax.rs:79:21 + --> $DIR/route-attribute-general-syntax.rs:66:21 | -79 | #[get("/", format = "/")] //~ ERROR invalid or unknown media type +66 | #[get("/", format = "/")] | ^^^ error: invalid or unknown media type - --> $DIR/route-attribute-general-syntax.rs:82:21 + --> $DIR/route-attribute-general-syntax.rs:69:21 | -82 | #[get("/", format = "a/")] //~ ERROR invalid or unknown media type +69 | #[get("/", format = "a/")] | ^^^^ error: invalid or unknown media type - --> $DIR/route-attribute-general-syntax.rs:85:21 + --> $DIR/route-attribute-general-syntax.rs:72:21 | -85 | #[get("/", format = "/a")] //~ ERROR invalid or unknown media type +72 | #[get("/", format = "/a")] | ^^^^ error: invalid or unknown media type - --> $DIR/route-attribute-general-syntax.rs:88:21 + --> $DIR/route-attribute-general-syntax.rs:75:21 | -88 | #[get("/", format = "/a/")] //~ ERROR invalid or unknown media type +75 | #[get("/", format = "/a/")] | ^^^^^ error: invalid or unknown media type - --> $DIR/route-attribute-general-syntax.rs:91:21 + --> $DIR/route-attribute-general-syntax.rs:78:21 | -91 | #[get("/", format = "a/b/")] //~ ERROR invalid or unknown media type +78 | #[get("/", format = "a/b/")] | ^^^^^^ error: invalid or unknown media type - --> $DIR/route-attribute-general-syntax.rs:94:21 + --> $DIR/route-attribute-general-syntax.rs:81:21 | -94 | #[get("/", format = "unknown")] //~ ERROR unknown media type +81 | #[get("/", format = "unknown")] | ^^^^^^^^^ error: invalid value: expected string literal - --> $DIR/route-attribute-general-syntax.rs:97:21 + --> $DIR/route-attribute-general-syntax.rs:84:21 | -97 | #[get("/", format = 12)] //~ ERROR expected string +84 | #[get("/", format = 12)] | ^^ error: invalid value: expected string literal - --> $DIR/route-attribute-general-syntax.rs:100:21 - | -100 | #[get("/", format = 'j')] //~ ERROR expected string - | ^^^ + --> $DIR/route-attribute-general-syntax.rs:87:21 + | +87 | #[get("/", format = 'j')] + | ^^^ error: invalid or unknown media type - --> $DIR/route-attribute-general-syntax.rs:103:21 - | -103 | #[get("/", format = "text//foo")] //~ ERROR invalid or unknown media type - | ^^^^^^^^^^^ + --> $DIR/route-attribute-general-syntax.rs:90:21 + | +90 | #[get("/", format = "text//foo")] + | ^^^^^^^^^^^ error: invalid HTTP method for route handlers - --> $DIR/route-attribute-general-syntax.rs:108:9 - | -108 | #[route(CONNECT, "/")] //~ ERROR invalid HTTP method for route - | ^^^^^^^ - | - = help: method must be one of: `GET`, `PUT`, `POST`, `DELETE`, `HEAD`, `PATCH`, `OPTIONS` + --> $DIR/route-attribute-general-syntax.rs:95:9 + | +95 | #[route(CONNECT, "/")] + | ^^^^^^^ + | + = help: method must be one of: `GET`, `PUT`, `POST`, `DELETE`, `HEAD`, `PATCH`, `OPTIONS` error: invalid HTTP method - --> $DIR/route-attribute-general-syntax.rs:112:9 - | -112 | #[route(FIX, "/")] //~ ERROR invalid HTTP method - | ^^^ - | - = help: method must be one of: `GET`, `PUT`, `POST`, `DELETE`, `HEAD`, `PATCH`, `OPTIONS` + --> $DIR/route-attribute-general-syntax.rs:98:9 + | +98 | #[route(FIX, "/")] + | ^^^ + | + = help: method must be one of: `GET`, `PUT`, `POST`, `DELETE`, `HEAD`, `PATCH`, `OPTIONS` error: expected identifier, found string literal - --> $DIR/route-attribute-general-syntax.rs:116:9 + --> $DIR/route-attribute-general-syntax.rs:101:9 | -116 | #[route("hi", "/")] //~ ERROR expected identifier +101 | #[route("hi", "/")] | ^^^^ | = help: method must be one of: `GET`, `PUT`, `POST`, `DELETE`, `HEAD`, `PATCH`, `OPTIONS` error: expected identifier, found string literal - --> $DIR/route-attribute-general-syntax.rs:120:9 + --> $DIR/route-attribute-general-syntax.rs:104:9 | -120 | #[route("GET", "/")] //~ ERROR expected identifier +104 | #[route("GET", "/")] | ^^^^^ | = help: method must be one of: `GET`, `PUT`, `POST`, `DELETE`, `HEAD`, `PATCH`, `OPTIONS` error: expected identifier, found integer literal - --> $DIR/route-attribute-general-syntax.rs:124:9 + --> $DIR/route-attribute-general-syntax.rs:107:9 | -124 | #[route(120, "/")] //~ ERROR expected identifier +107 | #[route(120, "/")] | ^^^ | = help: method must be one of: `GET`, `PUT`, `POST`, `DELETE`, `HEAD`, `PATCH`, `OPTIONS` diff --git a/core/codegen/tests/ui-fail-nightly/route-path-bad-syntax.stderr b/core/codegen/tests/ui-fail-nightly/route-path-bad-syntax.stderr index c0a6dcc2..385f233b 100644 --- a/core/codegen/tests/ui-fail-nightly/route-path-bad-syntax.stderr +++ b/core/codegen/tests/ui-fail-nightly/route-path-bad-syntax.stderr @@ -1,262 +1,262 @@ error: invalid path URI: expected token / but found a at index 0 --> $DIR/route-path-bad-syntax.rs:5:8 | -5 | #[get("a")] //~ ERROR invalid path URI +5 | #[get("a")] | ^^ | = help: expected path in origin form: "/path/" error: invalid path URI: expected token / but none was found at index 0 - --> $DIR/route-path-bad-syntax.rs:9:8 + --> $DIR/route-path-bad-syntax.rs:8:8 | -9 | #[get("")] //~ ERROR invalid path URI +8 | #[get("")] | ^ | = help: expected path in origin form: "/path/" error: invalid path URI: expected token / but found a at index 0 - --> $DIR/route-path-bad-syntax.rs:13:8 + --> $DIR/route-path-bad-syntax.rs:11:8 | -13 | #[get("a/b/c")] //~ ERROR invalid path URI +11 | #[get("a/b/c")] | ^^^^^^ | = help: expected path in origin form: "/path/" error: paths cannot contain empty segments - --> $DIR/route-path-bad-syntax.rs:17:7 + --> $DIR/route-path-bad-syntax.rs:14:7 | -17 | #[get("/a///b")] //~ ERROR empty segments +14 | #[get("/a///b")] | ^^^^^^^^ | = note: expected '/a/b', found '/a///b' error: query cannot contain empty segments - --> $DIR/route-path-bad-syntax.rs:21:10 + --> $DIR/route-path-bad-syntax.rs:17:10 | -21 | #[get("/?bat&&")] //~ ERROR empty segments +17 | #[get("/?bat&&")] | ^^^^^ error: query cannot contain empty segments - --> $DIR/route-path-bad-syntax.rs:24:10 + --> $DIR/route-path-bad-syntax.rs:20:10 | -24 | #[get("/?bat&&")] //~ ERROR empty segments +20 | #[get("/?bat&&")] | ^^^^^ error: paths cannot contain empty segments - --> $DIR/route-path-bad-syntax.rs:27:7 + --> $DIR/route-path-bad-syntax.rs:23:7 | -27 | #[get("/a/b//")] //~ ERROR empty segments +23 | #[get("/a/b//")] | ^^^^^^^^ | = note: expected '/a/b', found '/a/b//' error: invalid path URI: expected EOF but found # at index 3 - --> $DIR/route-path-bad-syntax.rs:33:11 + --> $DIR/route-path-bad-syntax.rs:28:11 | -33 | #[get("/!@#$%^&*()")] //~ ERROR invalid path URI +28 | #[get("/!@#$%^&*()")] | ^^^^^^^^^ | = help: expected path in origin form: "/path/" error: component contains invalid URI characters - --> $DIR/route-path-bad-syntax.rs:37:9 + --> $DIR/route-path-bad-syntax.rs:31:9 | -37 | #[get("/a%20b")] //~ ERROR invalid URI characters +31 | #[get("/a%20b")] | ^^^^^ | = note: components cannot contain reserved characters = help: reserved characters include: '%', '+', '&', etc. error: component contains invalid URI characters - --> $DIR/route-path-bad-syntax.rs:42:11 + --> $DIR/route-path-bad-syntax.rs:34:11 | -42 | #[get("/a?a%20b")] //~ ERROR invalid URI characters +34 | #[get("/a?a%20b")] | ^^^^^ | = note: components cannot contain reserved characters = help: reserved characters include: '%', '+', '&', etc. error: component contains invalid URI characters - --> $DIR/route-path-bad-syntax.rs:47:11 + --> $DIR/route-path-bad-syntax.rs:37:11 | -47 | #[get("/a?a+b")] //~ ERROR invalid URI characters +37 | #[get("/a?a+b")] | ^^^ | = note: components cannot contain reserved characters = help: reserved characters include: '%', '+', '&', etc. error: unused dynamic parameter - --> $DIR/route-path-bad-syntax.rs:54:9 + --> $DIR/route-path-bad-syntax.rs:42:9 | -54 | #[get("/")] //~ ERROR unused dynamic parameter +42 | #[get("/")] | ^^^^^^ | note: expected argument named `name` here - --> $DIR/route-path-bad-syntax.rs:55:7 + --> $DIR/route-path-bad-syntax.rs:43:6 | -55 | fn h0(_name: usize) {} //~ NOTE expected argument named `name` here - | ^^^^^^^^^^^^ +43 | fn h0(_name: usize) {} + | ^^^^^^^^^^^^^^ error: unused dynamic parameter - --> $DIR/route-path-bad-syntax.rs:57:11 + --> $DIR/route-path-bad-syntax.rs:45:11 | -57 | #[get("/a?")] //~ ERROR unused dynamic parameter +45 | #[get("/a?")] | ^^^ | note: expected argument named `r` here - --> $DIR/route-path-bad-syntax.rs:58:1 + --> $DIR/route-path-bad-syntax.rs:46:6 | -58 | fn h1() {} //~ NOTE expected argument named `r` here - | ^^^^^^^^^^ +46 | fn h1() {} + | ^^ error: unused dynamic parameter - --> $DIR/route-path-bad-syntax.rs:60:22 + --> $DIR/route-path-bad-syntax.rs:48:22 | -60 | #[post("/a", data = "")] //~ ERROR unused dynamic parameter +48 | #[post("/a", data = "")] | ^^^^^^ | note: expected argument named `test` here - --> $DIR/route-path-bad-syntax.rs:61:1 + --> $DIR/route-path-bad-syntax.rs:49:6 | -61 | fn h2() {} //~ NOTE expected argument named `test` here - | ^^^^^^^^^^ +49 | fn h2() {} + | ^^ error: unused dynamic parameter - --> $DIR/route-path-bad-syntax.rs:63:9 + --> $DIR/route-path-bad-syntax.rs:51:9 | -63 | #[get("/<_r>")] //~ ERROR unused dynamic parameter +51 | #[get("/<_r>")] | ^^^^ | note: expected argument named `_r` here - --> $DIR/route-path-bad-syntax.rs:64:1 + --> $DIR/route-path-bad-syntax.rs:52:6 | -64 | fn h3() {} //~ NOTE expected argument named `_r` here - | ^^^^^^^^^^ +52 | fn h3() {} + | ^^ error: unused dynamic parameter - --> $DIR/route-path-bad-syntax.rs:66:9 + --> $DIR/route-path-bad-syntax.rs:54:9 | -66 | #[get("/<_r>/")] //~ ERROR unused dynamic parameter +54 | #[get("/<_r>/")] | ^^^^ | note: expected argument named `_r` here - --> $DIR/route-path-bad-syntax.rs:68:1 + --> $DIR/route-path-bad-syntax.rs:55:6 | -68 | fn h4() {} //~ NOTE expected argument named `_r` here - | ^^^^^^^^^^ +55 | fn h4() {} + | ^^ error: unused dynamic parameter - --> $DIR/route-path-bad-syntax.rs:66:14 + --> $DIR/route-path-bad-syntax.rs:54:14 | -66 | #[get("/<_r>/")] //~ ERROR unused dynamic parameter +54 | #[get("/<_r>/")] | ^^^ | note: expected argument named `b` here - --> $DIR/route-path-bad-syntax.rs:68:1 + --> $DIR/route-path-bad-syntax.rs:55:6 | -68 | fn h4() {} //~ NOTE expected argument named `_r` here - | ^^^^^^^^^^ +55 | fn h4() {} + | ^^ error: `foo_.` is not a valid identifier - --> $DIR/route-path-bad-syntax.rs:73:9 + --> $DIR/route-path-bad-syntax.rs:60:9 | -73 | #[get("/")] //~ ERROR `foo_.` is not a valid identifier +60 | #[get("/")] | ^^^^^^^ | = help: parameter names must be valid identifiers error: `foo*` is not a valid identifier - --> $DIR/route-path-bad-syntax.rs:77:9 + --> $DIR/route-path-bad-syntax.rs:63:9 | -77 | #[get("/")] //~ ERROR `foo*` is not a valid identifier +63 | #[get("/")] | ^^^^^^ | = help: parameter names must be valid identifiers error: `!` is not a valid identifier - --> $DIR/route-path-bad-syntax.rs:81:9 + --> $DIR/route-path-bad-syntax.rs:66:9 | -81 | #[get("/")] //~ ERROR `!` is not a valid identifier +66 | #[get("/")] | ^^^ | = help: parameter names must be valid identifiers error: `name>: $DIR/route-path-bad-syntax.rs:85:9 + --> $DIR/route-path-bad-syntax.rs:69:9 | -85 | #[get("/:")] //~ ERROR `name>::")] | ^^^^^^^^^^^ | = help: parameter names must be valid identifiers error: malformed parameter - --> $DIR/route-path-bad-syntax.rs:91:20 + --> $DIR/route-path-bad-syntax.rs:74:20 | -91 | #[get("/", data = "foo")] //~ ERROR malformed parameter +74 | #[get("/", data = "foo")] | ^^^ | = help: parameter must be of the form '' error: malformed parameter - --> $DIR/route-path-bad-syntax.rs:95:20 + --> $DIR/route-path-bad-syntax.rs:77:20 | -95 | #[get("/", data = "")] //~ ERROR malformed parameter +77 | #[get("/", data = "")] | ^^^^^^^ | = help: parameter must be of the form '' error: parameter is missing a closing bracket - --> $DIR/route-path-bad-syntax.rs:99:20 + --> $DIR/route-path-bad-syntax.rs:80:20 | -99 | #[get("/", data = "'? error: `test ` is not a valid identifier - --> $DIR/route-path-bad-syntax.rs:103:20 - | -103 | #[get("/", data = "")] //~ ERROR `test ` is not a valid identifier - | ^^^^^^^ - | - = help: parameter names must be valid identifiers + --> $DIR/route-path-bad-syntax.rs:83:20 + | +83 | #[get("/", data = "")] + | ^^^^^^^ + | + = help: parameter names must be valid identifiers error: parameters must be named - --> $DIR/route-path-bad-syntax.rs:109:9 - | -109 | #[get("/<_>")] //~ ERROR must be named - | ^^^ - | - = help: use a name such as `_guard` or `_param` + --> $DIR/route-path-bad-syntax.rs:88:9 + | +88 | #[get("/<_>")] + | ^^^ + | + = help: use a name such as `_guard` or `_param` error: parameter names cannot be empty - --> $DIR/route-path-bad-syntax.rs:114:9 - | -114 | #[get("/<>")] //~ ERROR cannot be empty - | ^^ + --> $DIR/route-path-bad-syntax.rs:93:9 + | +93 | #[get("/<>")] + | ^^ error: malformed parameter or identifier - --> $DIR/route-path-bad-syntax.rs:117:9 - | -117 | #[get("/<")] //~ ERROR malformed parameter - | ^^^^^ - | - = help: parameters must be of the form '' - = help: identifiers cannot contain '<' or '>' + --> $DIR/route-path-bad-syntax.rs:96:9 + | +96 | #[get("/<")] + | ^^^^^ + | + = help: parameters must be of the form '' + = help: identifiers cannot contain '<' or '>' error: malformed parameter or identifier - --> $DIR/route-path-bad-syntax.rs:122:9 + --> $DIR/route-path-bad-syntax.rs:99:9 + | +99 | #[get("/<<<<")] + | ^^^^^^^^ + | + = help: parameters must be of the form '' + = help: identifiers cannot contain '<' or '>' + +error: malformed parameter or identifier + --> $DIR/route-path-bad-syntax.rs:102:9 | -122 | #[get("/<<<<")] //~ ERROR malformed parameter - | ^^^^^^^^ - | - = help: parameters must be of the form '' - = help: identifiers cannot contain '<' or '>' - -error: malformed parameter or identifier - --> $DIR/route-path-bad-syntax.rs:127:9 - | -127 | #[get("/<>name><")] //~ ERROR malformed parameter +102 | #[get("/<>name><")] | ^^^^^^^^ | = help: parameters must be of the form '' diff --git a/core/codegen/tests/ui-fail-nightly/route-type-errors.stderr b/core/codegen/tests/ui-fail-nightly/route-type-errors.stderr index 958a61bd..1192dbd6 100644 --- a/core/codegen/tests/ui-fail-nightly/route-type-errors.stderr +++ b/core/codegen/tests/ui-fail-nightly/route-type-errors.stderr @@ -1,31 +1,31 @@ error[E0277]: the trait bound `Q: rocket::request::FromParam<'_>` is not satisfied --> $DIR/route-type-errors.rs:6:7 | -6 | fn f0(foo: Q) {} //~ ERROR FromParam +6 | fn f0(foo: Q) {} | ^^^^^^ the trait `rocket::request::FromParam<'_>` is not implemented for `Q` error[E0277]: the trait bound `Q: rocket::request::FromSegments<'_>` is not satisfied --> $DIR/route-type-errors.rs:9:7 | -9 | fn f1(foo: Q) {} //~ ERROR FromSegments +9 | fn f1(foo: Q) {} | ^^^^^^ the trait `rocket::request::FromSegments<'_>` is not implemented for `Q` error[E0277]: the trait bound `Q: rocket::request::FromFormValue<'_>` is not satisfied --> $DIR/route-type-errors.rs:12:7 | -12 | fn f2(foo: Q) {} //~ ERROR FromFormValue +12 | fn f2(foo: Q) {} | ^^^^^^ the trait `rocket::request::FromFormValue<'_>` is not implemented for `Q` error[E0277]: the trait bound `Q: rocket::request::FromQuery<'_>` is not satisfied --> $DIR/route-type-errors.rs:15:7 | -15 | fn f3(foo: Q) {} //~ ERROR FromQuery +15 | fn f3(foo: Q) {} | ^^^^^^ the trait `rocket::request::FromQuery<'_>` is not implemented for `Q` error[E0277]: the trait bound `Q: rocket::data::FromData` is not satisfied --> $DIR/route-type-errors.rs:18:7 | -18 | fn f4(foo: Q) {} //~ ERROR FromData +18 | fn f4(foo: Q) {} | ^^^^^^ the trait `rocket::data::FromData` is not implemented for `Q` | = note: required because of the requirements on the impl of `rocket::data::FromTransformedData<'_>` for `Q` @@ -43,19 +43,19 @@ error[E0277]: the trait bound `Q: rocket::request::FromParam<'_>` is not satisfi | ^^^^^^ the trait `rocket::request::FromParam<'_>` is not implemented for `Q` error[E0277]: the trait bound `Q: rocket::request::FromRequest<'_, '_>` is not satisfied - --> $DIR/route-type-errors.rs:26:7 + --> $DIR/route-type-errors.rs:24:7 | -26 | fn f6(a: Q, foo: Q, good: usize, bar: Q) {} +24 | fn f6(a: Q, foo: Q, good: usize, bar: Q) {} | ^^^^ the trait `rocket::request::FromRequest<'_, '_>` is not implemented for `Q` error[E0277]: the trait bound `Q: rocket::request::FromParam<'_>` is not satisfied - --> $DIR/route-type-errors.rs:26:13 + --> $DIR/route-type-errors.rs:24:13 | -26 | fn f6(a: Q, foo: Q, good: usize, bar: Q) {} +24 | fn f6(a: Q, foo: Q, good: usize, bar: Q) {} | ^^^^^^ the trait `rocket::request::FromParam<'_>` is not implemented for `Q` error[E0277]: the trait bound `Q: rocket::request::FromParam<'_>` is not satisfied - --> $DIR/route-type-errors.rs:26:34 + --> $DIR/route-type-errors.rs:24:34 | -26 | fn f6(a: Q, foo: Q, good: usize, bar: Q) {} +24 | fn f6(a: Q, foo: Q, good: usize, bar: Q) {} | ^^^^^^ the trait `rocket::request::FromParam<'_>` is not implemented for `Q` diff --git a/core/codegen/tests/ui-fail-nightly/route-warnings.stderr b/core/codegen/tests/ui-fail-nightly/route-warnings.stderr index 6e864351..5201fb4d 100644 --- a/core/codegen/tests/ui-fail-nightly/route-warnings.stderr +++ b/core/codegen/tests/ui-fail-nightly/route-warnings.stderr @@ -1,44 +1,44 @@ warning: 'application/x-custom' is not a known media type --> $DIR/route-warnings.rs:7:21 | -7 | #[get("/", format = "application/x-custom")] //~ WARNING not a known media type +7 | #[get("/", format = "application/x-custom")] | ^^^^^^^^^^^^^^^^^^^^^^ warning: 'x-custom/plain' is not a known media type --> $DIR/route-warnings.rs:10:21 | -10 | #[get("/", format = "x-custom/plain")] //~ WARNING not a known media type +10 | #[get("/", format = "x-custom/plain")] | ^^^^^^^^^^^^^^^^ warning: 'x-custom/x-custom' is not a known media type --> $DIR/route-warnings.rs:13:21 | -13 | #[get("/", format = "x-custom/x-custom")] //~ WARNING not a known media type +13 | #[get("/", format = "x-custom/x-custom")] | ^^^^^^^^^^^^^^^^^^^ warning: `data` used with non-payload-supporting method --> $DIR/route-warnings.rs:18:12 | -18 | #[get("/", data = "<_foo>")] //~ WARNING used with non-payload-supporting method +18 | #[get("/", data = "<_foo>")] | ^^^^^^^^^^^^^^^ | note: 'GET' does not typically support payloads --> $DIR/route-warnings.rs:18:3 | -18 | #[get("/", data = "<_foo>")] //~ WARNING used with non-payload-supporting method +18 | #[get("/", data = "<_foo>")] | ^^^ = note: this warning originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) warning: `data` used with non-payload-supporting method --> $DIR/route-warnings.rs:21:13 | -21 | #[head("/", data = "<_foo>")] //~ WARNING used with non-payload-supporting method +21 | #[head("/", data = "<_foo>")] | ^^^^^^^^^^^^^^^ | note: 'HEAD' does not typically support payloads --> $DIR/route-warnings.rs:21:3 | -21 | #[head("/", data = "<_foo>")] //~ WARNING used with non-payload-supporting method +21 | #[head("/", data = "<_foo>")] | ^^^^ = note: this warning originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/core/codegen/tests/ui-fail-nightly/routes.stderr b/core/codegen/tests/ui-fail-nightly/routes.stderr index cb39b641..4da81dbb 100644 --- a/core/codegen/tests/ui-fail-nightly/routes.stderr +++ b/core/codegen/tests/ui-fail-nightly/routes.stderr @@ -1,19 +1,19 @@ error: expected `,` --> $DIR/routes.rs:4:23 | -4 | let _ = routes![a b]; //~ ERROR expected `,` +4 | let _ = routes![a b]; | ^ error: expected identifier --> $DIR/routes.rs:6:24 | -6 | let _ = routes![a::, ]; //~ ERROR expected identifier +6 | let _ = routes![a::, ]; | ^ error: unexpected end of input, expected identifier --> $DIR/routes.rs:7:13 | -7 | let _ = routes![a::]; //~ ERROR expected identifier +7 | let _ = routes![a::]; | ^^^^^^^^^^^^ | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/core/codegen/tests/ui-fail-nightly/typed-uri-bad-type.stderr b/core/codegen/tests/ui-fail-nightly/typed-uri-bad-type.stderr index 60176759..c9e88aee 100644 --- a/core/codegen/tests/ui-fail-nightly/typed-uri-bad-type.stderr +++ b/core/codegen/tests/ui-fail-nightly/typed-uri-bad-type.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `usize: rocket::http::uri::FromUriParam` is not satisfied - --> $DIR/typed-uri-bad-type.rs:48:23 + --> $DIR/typed-uri-bad-type.rs:42:23 | -48 | uri!(simple: id = "hi"); +42 | uri!(simple: id = "hi"); | ^^^^ the trait `rocket::http::uri::FromUriParam` is not implemented for `usize` | = help: the following implementations were found: @@ -11,9 +11,9 @@ error[E0277]: the trait bound `usize: rocket::http::uri::FromUriParam` is not satisfied - --> $DIR/typed-uri-bad-type.rs:51:18 + --> $DIR/typed-uri-bad-type.rs:44:18 | -51 | uri!(simple: "hello"); +44 | uri!(simple: "hello"); | ^^^^^^^ the trait `rocket::http::uri::FromUriParam` is not implemented for `usize` | = help: the following implementations were found: @@ -23,9 +23,9 @@ error[E0277]: the trait bound `usize: rocket::http::uri::FromUriParam` is not satisfied - --> $DIR/typed-uri-bad-type.rs:54:23 + --> $DIR/typed-uri-bad-type.rs:46:23 | -54 | uri!(simple: id = 239239i64); +46 | uri!(simple: id = 239239i64); | ^^^^^^^^^ the trait `rocket::http::uri::FromUriParam` is not implemented for `usize` | = help: the following implementations were found: @@ -35,15 +35,15 @@ error[E0277]: the trait bound `usize: rocket::http::uri::FromUriParam` is not satisfied - --> $DIR/typed-uri-bad-type.rs:57:31 + --> $DIR/typed-uri-bad-type.rs:48:31 | -57 | uri!(not_uri_display: 10, S); +48 | uri!(not_uri_display: 10, S); | ^ the trait `rocket::http::uri::FromUriParam` is not implemented for `S` error[E0277]: the trait bound `i32: rocket::http::uri::FromUriParam>` is not satisfied - --> $DIR/typed-uri-bad-type.rs:63:26 + --> $DIR/typed-uri-bad-type.rs:53:26 | -63 | uri!(optionals: id = Some(10), name = Ok("bob".into())); +53 | uri!(optionals: id = Some(10), name = Ok("bob".into())); | ^^^^^^^^ the trait `rocket::http::uri::FromUriParam>` is not implemented for `i32` | = help: the following implementations were found: @@ -53,9 +53,9 @@ error[E0277]: the trait bound `i32: rocket::http::uri::FromUriParam>` for `std::option::Option` error[E0277]: the trait bound `std::string::String: rocket::http::uri::FromUriParam>` is not satisfied - --> $DIR/typed-uri-bad-type.rs:63:43 + --> $DIR/typed-uri-bad-type.rs:53:43 | -63 | uri!(optionals: id = Some(10), name = Ok("bob".into())); +53 | uri!(optionals: id = Some(10), name = Ok("bob".into())); | ^^^^^^^^^^^^^^^^ the trait `rocket::http::uri::FromUriParam>` is not implemented for `std::string::String` | = help: the following implementations were found: @@ -67,9 +67,9 @@ error[E0277]: the trait bound `std::string::String: rocket::http::uri::FromUriPa = note: required because of the requirements on the impl of `rocket::http::uri::FromUriParam>` for `std::result::Result` error[E0277]: the trait bound `isize: rocket::http::uri::FromUriParam` is not satisfied - --> $DIR/typed-uri-bad-type.rs:67:20 + --> $DIR/typed-uri-bad-type.rs:55:20 | -67 | uri!(simple_q: "hi"); +55 | uri!(simple_q: "hi"); | ^^^^ the trait `rocket::http::uri::FromUriParam` is not implemented for `isize` | = help: the following implementations were found: @@ -79,9 +79,9 @@ error[E0277]: the trait bound `isize: rocket::http::uri::FromUriParam` is not satisfied - --> $DIR/typed-uri-bad-type.rs:70:25 + --> $DIR/typed-uri-bad-type.rs:57:25 | -70 | uri!(simple_q: id = "hi"); +57 | uri!(simple_q: id = "hi"); | ^^^^ the trait `rocket::http::uri::FromUriParam` is not implemented for `isize` | = help: the following implementations were found: @@ -91,24 +91,24 @@ error[E0277]: the trait bound `isize: rocket::http::uri::FromUriParam` is not satisfied - --> $DIR/typed-uri-bad-type.rs:73:24 + --> $DIR/typed-uri-bad-type.rs:59:24 | -73 | uri!(other_q: 100, S); +59 | uri!(other_q: 100, S); | ^ the trait `rocket::http::uri::FromUriParam` is not implemented for `S` error[E0277]: the trait bound `S: rocket::http::uri::FromUriParam` is not satisfied - --> $DIR/typed-uri-bad-type.rs:76:26 + --> $DIR/typed-uri-bad-type.rs:61:26 | -76 | uri!(other_q: rest = S, id = 100); +61 | uri!(other_q: rest = S, id = 100); | ^ the trait `rocket::http::uri::FromUriParam` is not implemented for `S` error[E0277]: the trait bound `S: rocket::http::uri::Ignorable` is not satisfied - --> $DIR/typed-uri-bad-type.rs:40:29 + --> $DIR/typed-uri-bad-type.rs:36:29 | -40 | fn other_q(id: usize, rest: S) { } +36 | fn other_q(id: usize, rest: S) { } | ^ the trait `rocket::http::uri::Ignorable` is not implemented for `S` ... -79 | uri!(other_q: rest = _, id = 100); +63 | uri!(other_q: rest = _, id = 100); | ---------------------------------- in this macro invocation | ::: $WORKSPACE/core/http/src/uri/uri_display.rs:465:40 @@ -119,12 +119,12 @@ error[E0277]: the trait bound `S: rocket::http::uri::Ignorable` is not satisfied - --> $DIR/typed-uri-bad-type.rs:40:16 + --> $DIR/typed-uri-bad-type.rs:36:16 | -40 | fn other_q(id: usize, rest: S) { } +36 | fn other_q(id: usize, rest: S) { } | ^^^^^ the trait `rocket::http::uri::Ignorable` is not implemented for `usize` ... -81 | uri!(other_q: rest = S, id = _); +65 | uri!(other_q: rest = S, id = _); | -------------------------------- in this macro invocation | ::: $WORKSPACE/core/http/src/uri/uri_display.rs:465:40 @@ -135,7 +135,7 @@ error[E0277]: the trait bound `usize: rocket::http::uri::Ignorable` is not satisfied - --> $DIR/typed-uri-bad-type.rs:81:26 + --> $DIR/typed-uri-bad-type.rs:65:26 | -81 | uri!(other_q: rest = S, id = _); +65 | uri!(other_q: rest = S, id = _); | ^ the trait `rocket::http::uri::FromUriParam` is not implemented for `S` diff --git a/core/codegen/tests/ui-fail-nightly/typed-uris-bad-params.stderr b/core/codegen/tests/ui-fail-nightly/typed-uris-bad-params.stderr index 72ef9ebb..24819efe 100644 --- a/core/codegen/tests/ui-fail-nightly/typed-uris-bad-params.stderr +++ b/core/codegen/tests/ui-fail-nightly/typed-uris-bad-params.stderr @@ -1,246 +1,238 @@ error: path parameters cannot be ignored - --> $DIR/typed-uris-bad-params.rs:77:37 + --> $DIR/typed-uris-bad-params.rs:55:37 | -77 | uri!(optionals: id = 10, name = _); +55 | uri!(optionals: id = 10, name = _); | ^ error: path parameters cannot be ignored - --> $DIR/typed-uris-bad-params.rs:74:26 + --> $DIR/typed-uris-bad-params.rs:53:26 | -74 | uri!(optionals: id = _, name = "bob".into()); +53 | uri!(optionals: id = _, name = "bob".into()); | ^ error: invalid parameters for `has_two` route uri - --> $DIR/typed-uris-bad-params.rs:70:19 + --> $DIR/typed-uris-bad-params.rs:51:19 | -70 | uri!(has_two: id = 100, cookies = "hi"); //~ ERROR invalid parameters +51 | uri!(has_two: id = 100, cookies = "hi"); | ^^^^^^^^^^^^^^^^^^^^^^^^ | = note: uri parameters are: id: i32, name: String = help: missing parameter: `name` help: unknown parameter: `cookies` - --> $DIR/typed-uris-bad-params.rs:70:29 + --> $DIR/typed-uris-bad-params.rs:51:29 | -70 | uri!(has_two: id = 100, cookies = "hi"); //~ ERROR invalid parameters +51 | uri!(has_two: id = 100, cookies = "hi"); | ^^^^^^^ error: invalid parameters for `has_two` route uri - --> $DIR/typed-uris-bad-params.rs:65:19 + --> $DIR/typed-uris-bad-params.rs:49:19 | -65 | uri!(has_two: cookies = "hi", id = 100, id = 10, id = 10); //~ ERROR invalid parameters +49 | uri!(has_two: cookies = "hi", id = 100, id = 10, id = 10); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: uri parameters are: id: i32, name: String = help: missing parameter: `name` help: unknown parameter: `cookies` - --> $DIR/typed-uris-bad-params.rs:65:19 + --> $DIR/typed-uris-bad-params.rs:49:19 | -65 | uri!(has_two: cookies = "hi", id = 100, id = 10, id = 10); //~ ERROR invalid parameters +49 | uri!(has_two: cookies = "hi", id = 100, id = 10, id = 10); | ^^^^^^^ help: duplicate parameter: `id` - --> $DIR/typed-uris-bad-params.rs:65:45 + --> $DIR/typed-uris-bad-params.rs:49:45 | -65 | uri!(has_two: cookies = "hi", id = 100, id = 10, id = 10); //~ ERROR invalid parameters +49 | uri!(has_two: cookies = "hi", id = 100, id = 10, id = 10); | ^^ ^^ error: invalid parameters for `has_two` route uri - --> $DIR/typed-uris-bad-params.rs:62:19 + --> $DIR/typed-uris-bad-params.rs:47:19 | -62 | uri!(has_two: name = "hi"); //~ ERROR invalid parameters +47 | uri!(has_two: name = "hi"); | ^^^^^^^^^^^ | = note: uri parameters are: id: i32, name: String = help: missing parameter: `id` error: invalid parameters for `has_two` route uri - --> $DIR/typed-uris-bad-params.rs:58:19 + --> $DIR/typed-uris-bad-params.rs:45:19 | -58 | uri!(has_two: id = 100, id = 100, ); //~ ERROR invalid parameters +45 | uri!(has_two: id = 100, id = 100, ); | ^^^^^^^^^^^^^^^^^^^ | = note: uri parameters are: id: i32, name: String = help: missing parameter: `name` help: duplicate parameter: `id` - --> $DIR/typed-uris-bad-params.rs:58:29 + --> $DIR/typed-uris-bad-params.rs:45:29 | -58 | uri!(has_two: id = 100, id = 100, ); //~ ERROR invalid parameters +45 | uri!(has_two: id = 100, id = 100, ); | ^^ error: invalid parameters for `has_one_guarded` route uri - --> $DIR/typed-uris-bad-params.rs:55:27 + --> $DIR/typed-uris-bad-params.rs:43:27 | -55 | uri!(has_one_guarded: id = 100, cookies = "hi"); //~ ERROR invalid parameters +43 | uri!(has_one_guarded: id = 100, cookies = "hi"); | ^^^^^^^^^^^^^^^^^^^^^^^^ | = note: uri parameters are: id: i32 help: unknown parameter: `cookies` - --> $DIR/typed-uris-bad-params.rs:55:37 + --> $DIR/typed-uris-bad-params.rs:43:37 | -55 | uri!(has_one_guarded: id = 100, cookies = "hi"); //~ ERROR invalid parameters +43 | uri!(has_one_guarded: id = 100, cookies = "hi"); | ^^^^^^^ error: invalid parameters for `has_one_guarded` route uri - --> $DIR/typed-uris-bad-params.rs:52:27 + --> $DIR/typed-uris-bad-params.rs:41:27 | -52 | uri!(has_one_guarded: cookies = "hi", id = 100); //~ ERROR invalid parameters +41 | uri!(has_one_guarded: cookies = "hi", id = 100); | ^^^^^^^^^^^^^^^^^^^^^^^^ | = note: uri parameters are: id: i32 help: unknown parameter: `cookies` - --> $DIR/typed-uris-bad-params.rs:52:27 + --> $DIR/typed-uris-bad-params.rs:41:27 | -52 | uri!(has_one_guarded: cookies = "hi", id = 100); //~ ERROR invalid parameters +41 | uri!(has_one_guarded: cookies = "hi", id = 100); | ^^^^^^^ error: invalid parameters for `has_one` route uri - --> $DIR/typed-uris-bad-params.rs:48:19 + --> $DIR/typed-uris-bad-params.rs:39:19 | -48 | uri!(has_one: name = "hi"); //~ ERROR invalid parameters +39 | uri!(has_one: name = "hi"); | ^^^^^^^^^^^ | = note: uri parameters are: id: i32 = help: missing parameter: `id` help: unknown parameter: `name` - --> $DIR/typed-uris-bad-params.rs:48:19 + --> $DIR/typed-uris-bad-params.rs:39:19 | -48 | uri!(has_one: name = "hi"); //~ ERROR invalid parameters +39 | uri!(has_one: name = "hi"); | ^^^^ error: invalid parameters for `has_one` route uri - --> $DIR/typed-uris-bad-params.rs:45:19 + --> $DIR/typed-uris-bad-params.rs:37:19 | -45 | uri!(has_one: id = 100, id = 100, ); //~ ERROR invalid parameters +37 | uri!(has_one: id = 100, id = 100, ); | ^^^^^^^^^^^^^^^^^^^ | = note: uri parameters are: id: i32 help: duplicate parameter: `id` - --> $DIR/typed-uris-bad-params.rs:45:29 + --> $DIR/typed-uris-bad-params.rs:37:29 | -45 | uri!(has_one: id = 100, id = 100, ); //~ ERROR invalid parameters +37 | uri!(has_one: id = 100, id = 100, ); | ^^ error: invalid parameters for `has_one` route uri - --> $DIR/typed-uris-bad-params.rs:42:19 + --> $DIR/typed-uris-bad-params.rs:35:19 | -42 | uri!(has_one: id = 100, id = 100); //~ ERROR invalid parameters +35 | uri!(has_one: id = 100, id = 100); | ^^^^^^^^^^^^^^^^^^ | = note: uri parameters are: id: i32 help: duplicate parameter: `id` - --> $DIR/typed-uris-bad-params.rs:42:29 + --> $DIR/typed-uris-bad-params.rs:35:29 | -42 | uri!(has_one: id = 100, id = 100); //~ ERROR invalid parameters +35 | uri!(has_one: id = 100, id = 100); | ^^ error: invalid parameters for `has_one` route uri - --> $DIR/typed-uris-bad-params.rs:38:19 + --> $DIR/typed-uris-bad-params.rs:33:19 | -38 | uri!(has_one: name = 100, age = 50, id = 100, id = 50); //~ ERROR invalid parameters +33 | uri!(has_one: name = 100, age = 50, id = 100, id = 50); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: uri parameters are: id: i32 help: unknown parameters: `name`, `age` - --> $DIR/typed-uris-bad-params.rs:38:19 + --> $DIR/typed-uris-bad-params.rs:33:19 | -38 | uri!(has_one: name = 100, age = 50, id = 100, id = 50); //~ ERROR invalid parameters +33 | uri!(has_one: name = 100, age = 50, id = 100, id = 50); | ^^^^ ^^^ help: duplicate parameter: `id` - --> $DIR/typed-uris-bad-params.rs:38:51 + --> $DIR/typed-uris-bad-params.rs:33:51 | -38 | uri!(has_one: name = 100, age = 50, id = 100, id = 50); //~ ERROR invalid parameters +33 | uri!(has_one: name = 100, age = 50, id = 100, id = 50); | ^^ error: invalid parameters for `has_one` route uri - --> $DIR/typed-uris-bad-params.rs:35:19 + --> $DIR/typed-uris-bad-params.rs:31:19 | -35 | uri!(has_one: name = 100, age = 50, id = 100); //~ ERROR invalid parameters +31 | uri!(has_one: name = 100, age = 50, id = 100); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: uri parameters are: id: i32 help: unknown parameters: `name`, `age` - --> $DIR/typed-uris-bad-params.rs:35:19 + --> $DIR/typed-uris-bad-params.rs:31:19 | -35 | uri!(has_one: name = 100, age = 50, id = 100); //~ ERROR invalid parameters +31 | uri!(has_one: name = 100, age = 50, id = 100); | ^^^^ ^^^ -error: invalid parameters for `has_one` route uri - --> $DIR/typed-uris-bad-params.rs:32:19 - | -32 | uri!(has_one: name = 100, id = 100); //~ ERROR invalid parameters - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: uri parameters are: id: i32 -help: unknown parameter: `name` - --> $DIR/typed-uris-bad-params.rs:32:19 - | -32 | uri!(has_one: name = 100, id = 100); //~ ERROR invalid parameters - | ^^^^ - error: invalid parameters for `has_one` route uri --> $DIR/typed-uris-bad-params.rs:29:19 | -29 | uri!(has_one: id = 100, name = "hi"); //~ ERROR invalid parameters +29 | uri!(has_one: name = 100, id = 100); + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: uri parameters are: id: i32 +help: unknown parameter: `name` + --> $DIR/typed-uris-bad-params.rs:29:19 + | +29 | uri!(has_one: name = 100, id = 100); + | ^^^^ + +error: invalid parameters for `has_one` route uri + --> $DIR/typed-uris-bad-params.rs:27:19 + | +27 | uri!(has_one: id = 100, name = "hi"); | ^^^^^^^^^^^^^^^^^^^^^ | = note: uri parameters are: id: i32 help: unknown parameter: `name` - --> $DIR/typed-uris-bad-params.rs:29:29 + --> $DIR/typed-uris-bad-params.rs:27:29 | -29 | uri!(has_one: id = 100, name = "hi"); //~ ERROR invalid parameters +27 | uri!(has_one: id = 100, name = "hi"); | ^^^^ error: `has_two` route uri expects 2 parameters but 1 was supplied - --> $DIR/typed-uris-bad-params.rs:27:19 + --> $DIR/typed-uris-bad-params.rs:25:19 | -27 | uri!(has_two: 10); //~ ERROR expects 2 parameters but 1 +25 | uri!(has_two: 10); | ^^ | = note: expected parameters: id: i32, name: String error: `has_two` route uri expects 2 parameters but 3 were supplied - --> $DIR/typed-uris-bad-params.rs:26:19 + --> $DIR/typed-uris-bad-params.rs:24:19 | -26 | uri!(has_two: 10, "hi", "there"); //~ ERROR expects 2 parameters but 3 +24 | uri!(has_two: 10, "hi", "there"); | ^^^^^^^^^^^^^^^^^ | = note: expected parameters: id: i32, name: String error: `has_one_guarded` route uri expects 1 parameter but 2 were supplied - --> $DIR/typed-uris-bad-params.rs:24:27 + --> $DIR/typed-uris-bad-params.rs:22:27 | -24 | uri!(has_one_guarded: "hi", 100); //~ ERROR expects 1 parameter but 2 +22 | uri!(has_one_guarded: "hi", 100); | ^^^^^^^^^ | = note: expected parameter: id: i32 error: `has_one` route uri expects 1 parameter but 2 were supplied - --> $DIR/typed-uris-bad-params.rs:23:19 + --> $DIR/typed-uris-bad-params.rs:21:19 | -23 | uri!(has_one: "Hello", 23, ); //~ ERROR expects 1 parameter but 2 +21 | uri!(has_one: "Hello", 23, ); | ^^^^^^^^^^^^ | = note: expected parameter: id: i32 error: `has_one` route uri expects 1 parameter but 2 were supplied - --> $DIR/typed-uris-bad-params.rs:22:19 + --> $DIR/typed-uris-bad-params.rs:20:19 | -22 | uri!(has_one: 1, 23); //~ ERROR expects 1 parameter but 2 +20 | uri!(has_one: 1, 23); | ^^^^^ | = note: expected parameter: id: i32 error: `has_one` route uri expects 1 parameter but 0 were supplied - --> $DIR/typed-uris-bad-params.rs:20:10 + --> $DIR/typed-uris-bad-params.rs:18:10 | -20 | uri!(has_one); //~ ERROR expects 1 parameter but 0 +18 | uri!(has_one); | ^^^^^^^ | = note: expected parameter: id: i32 - -warning: unused import: `std::fmt` - --> $DIR/typed-uris-bad-params.rs:3:5 - | -3 | use std::fmt; - | ^^^^^^^^ - | - = note: `#[warn(unused_imports)]` on by default diff --git a/core/codegen/tests/ui-fail-nightly/typed-uris-invalid-syntax.stderr b/core/codegen/tests/ui-fail-nightly/typed-uris-invalid-syntax.stderr index 843899d1..62acf634 100644 --- a/core/codegen/tests/ui-fail-nightly/typed-uris-invalid-syntax.stderr +++ b/core/codegen/tests/ui-fail-nightly/typed-uris-invalid-syntax.stderr @@ -1,37 +1,37 @@ error: named and unnamed parameters cannot be mixed --> $DIR/typed-uris-invalid-syntax.rs:7:18 | -7 | uri!(simple: id = 100, "Hello"); //~ ERROR named and unnamed +7 | uri!(simple: id = 100, "Hello"); | ^^^^^^^^^^^^^^^^^ error: named and unnamed parameters cannot be mixed --> $DIR/typed-uris-invalid-syntax.rs:8:18 | -8 | uri!(simple: "Hello", id = 100); //~ ERROR named and unnamed +8 | uri!(simple: "Hello", id = 100); | ^^^^^^^^^^^^^^^^^ error: expected `:` --> $DIR/typed-uris-invalid-syntax.rs:9:16 | -9 | uri!(simple,); //~ ERROR expected `:` +9 | uri!(simple,); | ^ error: expected argument list after `:` --> $DIR/typed-uris-invalid-syntax.rs:10:16 | -10 | uri!(simple:); //~ ERROR argument list +10 | uri!(simple:); | ^ error: unexpected end of input: expected ',' followed by route path --> $DIR/typed-uris-invalid-syntax.rs:11:10 | -11 | uri!("/mount"); //~ ERROR route path +11 | uri!("/mount"); | ^^^^^^^^ error: unexpected end of input, expected identifier --> $DIR/typed-uris-invalid-syntax.rs:12:5 | -12 | uri!("/mount",); //~ ERROR expected identifier +12 | uri!("/mount",); | ^^^^^^^^^^^^^^^^ | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) @@ -39,19 +39,19 @@ error: unexpected end of input, expected identifier error: invalid mount point; mount points must be static, absolute URIs: `/example` --> $DIR/typed-uris-invalid-syntax.rs:13:10 | -13 | uri!("mount", simple); //~ invalid mount point +13 | uri!("mount", simple); | ^^^^^^^ error: invalid mount point; mount points must be static, absolute URIs: `/example` --> $DIR/typed-uris-invalid-syntax.rs:14:10 | -14 | uri!("/mount/", simple); //~ invalid mount point +14 | uri!("/mount/", simple); | ^^^^^^^^^^^^^ error: unexpected end of input, call to `uri!` cannot be empty --> $DIR/typed-uris-invalid-syntax.rs:15:5 | -15 | uri!(); //~ unexpected end of input +15 | uri!(); | ^^^^^^^ | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) @@ -59,7 +59,7 @@ error: unexpected end of input, call to `uri!` cannot be empty error: unexpected end of input, expected expression --> $DIR/typed-uris-invalid-syntax.rs:16:5 | -16 | uri!(simple: id = ); //~ expected expression +16 | uri!(simple: id = ); | ^^^^^^^^^^^^^^^^^^^^ | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/core/codegen/tests/ui-fail-nightly/uri_display.stderr b/core/codegen/tests/ui-fail-nightly/uri_display.stderr index 9f2b5466..9dcf7f6c 100644 --- a/core/codegen/tests/ui-fail-nightly/uri_display.stderr +++ b/core/codegen/tests/ui-fail-nightly/uri_display.stderr @@ -1,21 +1,47 @@ error: fieldless structs or variants are not supported - --> $DIR/uri_display.rs:9:1 + --> $DIR/uri_display.rs:4:8 | -9 | struct Foo1; - | ^^^^^^^^^^^^ +4 | struct Foo1; + | ^^^^ | note: error occurred while deriving `UriDisplay` - --> $DIR/uri_display.rs:5:10 + --> $DIR/uri_display.rs:3:10 | -5 | #[derive(UriDisplayQuery)] +3 | #[derive(UriDisplayQuery)] | ^^^^^^^^^^^^^^^ = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: fieldless structs or variants are not supported - --> $DIR/uri_display.rs:16:1 + --> $DIR/uri_display.rs:7:8 + | +7 | struct Foo2(); + | ^^^^ + | +note: error occurred while deriving `UriDisplay` + --> $DIR/uri_display.rs:6:10 + | +6 | #[derive(UriDisplayQuery)] + | ^^^^^^^^^^^^^^^ + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: empty enums are not supported + --> $DIR/uri_display.rs:10:11 | -16 | struct Foo2(); - | ^^^^^^^^^^^^^^ +10 | enum Foo3 { } + | ^^^ + | +note: error occurred while deriving `UriDisplay` + --> $DIR/uri_display.rs:9:10 + | +9 | #[derive(UriDisplayQuery)] + | ^^^^^^^^^^^^^^^ + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: fieldless structs or variants are not supported + --> $DIR/uri_display.rs:14:5 + | +14 | Variant, + | ^^^^^^^ | note: error occurred while deriving `UriDisplay` --> $DIR/uri_display.rs:12:10 @@ -24,463 +50,82 @@ note: error occurred while deriving `UriDisplay` | ^^^^^^^^^^^^^^^ = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) -error: empty enums are not supported - --> $DIR/uri_display.rs:23:1 - | -23 | enum Foo3 { } - | ^^^^^^^^^^^^^ - | -note: error occurred while deriving `UriDisplay` - --> $DIR/uri_display.rs:19:10 - | -19 | #[derive(UriDisplayQuery)] - | ^^^^^^^^^^^^^^^ - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error: fieldless structs or variants are not supported - --> $DIR/uri_display.rs:31:5 - | -31 | Variant, - | ^^^^^^^ - | -note: error occurred while deriving `UriDisplay` - --> $DIR/uri_display.rs:26:10 - | -26 | #[derive(UriDisplayQuery)] - | ^^^^^^^^^^^^^^^ - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - error: tuple structs or variants must have exactly one field - --> $DIR/uri_display.rs:39:13 + --> $DIR/uri_display.rs:18:12 | -39 | struct Foo5(String, String); - | ^^^^^^^^^^^^^^ +18 | struct Foo5(String, String); + | ^^^^^^^^^^^^^^^^ | note: error occurred while deriving `UriDisplay` - --> $DIR/uri_display.rs:35:10 + --> $DIR/uri_display.rs:17:10 | -35 | #[derive(UriDisplayQuery)] +17 | #[derive(UriDisplayQuery)] | ^^^^^^^^^^^^^^^ = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: invalid value: expected string literal - --> $DIR/uri_display.rs:47:20 + --> $DIR/uri_display.rs:22:20 | -47 | #[form(field = 123)] +22 | #[form(field = 123)] | ^^^ | note: error occurred while deriving `UriDisplay` - --> $DIR/uri_display.rs:42:10 + --> $DIR/uri_display.rs:20:10 | -42 | #[derive(UriDisplayQuery)] +20 | #[derive(UriDisplayQuery)] | ^^^^^^^^^^^^^^^ = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: struct must have exactly one field - --> $DIR/uri_display.rs:55:13 + --> $DIR/uri_display.rs:27:12 | -55 | struct Foo7(String, usize); - | ^^^^^^^^^^^^^ +27 | struct Foo7(String, usize); + | ^^^^^^^^^^^^^^^ | note: error occurred while deriving `UriDisplay` - --> $DIR/uri_display.rs:52:10 + --> $DIR/uri_display.rs:26:10 | -52 | #[derive(UriDisplayPath)] +26 | #[derive(UriDisplayPath)] | ^^^^^^^^^^^^^^ = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: struct must have exactly one field - --> $DIR/uri_display.rs:61:1 + --> $DIR/uri_display.rs:30:8 | -61 | struct Foo8; - | ^^^^^^^^^^^^ +30 | struct Foo8; + | ^^^^ | note: error occurred while deriving `UriDisplay` - --> $DIR/uri_display.rs:58:10 + --> $DIR/uri_display.rs:29:10 | -58 | #[derive(UriDisplayPath)] +29 | #[derive(UriDisplayPath)] | ^^^^^^^^^^^^^^ = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: enums are not supported - --> $DIR/uri_display.rs:67:1 + --> $DIR/uri_display.rs:33:1 | -67 | enum Foo9 { } +33 | enum Foo9 { } | ^^^^^^^^^^^^^^ | note: error occurred while deriving `UriDisplay` - --> $DIR/uri_display.rs:64:10 + --> $DIR/uri_display.rs:32:10 | -64 | #[derive(UriDisplayPath)] +32 | #[derive(UriDisplayPath)] | ^^^^^^^^^^^^^^ = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: named structs are not supported - --> $DIR/uri_display.rs:73:1 + --> $DIR/uri_display.rs:36:1 | -73 | / struct Foo10 { -74 | | //~^ ERROR not supported -75 | | named: usize -76 | | } +36 | / struct Foo10 { +37 | | named: usize +38 | | } | |_^ | note: error occurred while deriving `UriDisplay` - --> $DIR/uri_display.rs:70:10 + --> $DIR/uri_display.rs:35:10 | -70 | #[derive(UriDisplayPath)] +35 | #[derive(UriDisplayPath)] | ^^^^^^^^^^^^^^ = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo1: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:5:10 - | -5 | #[derive(UriDisplayQuery)] - | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo1` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo1: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:5:10 - | -5 | #[derive(UriDisplayQuery)] - | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo1` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&Foo1` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo1: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:5:10 - | -5 | #[derive(UriDisplayQuery)] - | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo1` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&mut Foo1` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo2: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:12:10 - | -12 | #[derive(UriDisplayQuery)] - | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo2` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo2: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:12:10 - | -12 | #[derive(UriDisplayQuery)] - | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo2` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&Foo2` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo2: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:12:10 - | -12 | #[derive(UriDisplayQuery)] - | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo2` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&mut Foo2` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo3: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:19:10 - | -19 | #[derive(UriDisplayQuery)] - | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo3` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo3: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:19:10 - | -19 | #[derive(UriDisplayQuery)] - | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo3` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&Foo3` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo3: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:19:10 - | -19 | #[derive(UriDisplayQuery)] - | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo3` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&mut Foo3` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo4: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:26:10 - | -26 | #[derive(UriDisplayQuery)] - | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo4` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo4: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:26:10 - | -26 | #[derive(UriDisplayQuery)] - | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo4` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&Foo4` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo4: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:26:10 - | -26 | #[derive(UriDisplayQuery)] - | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo4` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&mut Foo4` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo5: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:35:10 - | -35 | #[derive(UriDisplayQuery)] - | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo5` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo5: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:35:10 - | -35 | #[derive(UriDisplayQuery)] - | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo5` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&Foo5` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo5: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:35:10 - | -35 | #[derive(UriDisplayQuery)] - | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo5` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&mut Foo5` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo6: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:42:10 - | -42 | #[derive(UriDisplayQuery)] - | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo6` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo6: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:42:10 - | -42 | #[derive(UriDisplayQuery)] - | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo6` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&Foo6` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo6: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:42:10 - | -42 | #[derive(UriDisplayQuery)] - | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo6` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&mut Foo6` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo7: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:52:10 - | -52 | #[derive(UriDisplayPath)] - | ^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo7` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo7: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:52:10 - | -52 | #[derive(UriDisplayPath)] - | ^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo7` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&Foo7` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo8: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:58:10 - | -58 | #[derive(UriDisplayPath)] - | ^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo8` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo8: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:58:10 - | -58 | #[derive(UriDisplayPath)] - | ^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo8` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&Foo8` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo9: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:64:10 - | -64 | #[derive(UriDisplayPath)] - | ^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo9` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo9: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:64:10 - | -64 | #[derive(UriDisplayPath)] - | ^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo9` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&Foo9` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo10: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:70:10 - | -70 | #[derive(UriDisplayPath)] - | ^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo10` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo10: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:70:10 - | -70 | #[derive(UriDisplayPath)] - | ^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo10` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&Foo10` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/core/codegen/tests/ui-fail-nightly/uri_display_type_errors.stderr b/core/codegen/tests/ui-fail-nightly/uri_display_type_errors.stderr index 559ae716..bd58d0ee 100644 --- a/core/codegen/tests/ui-fail-nightly/uri_display_type_errors.stderr +++ b/core/codegen/tests/ui-fail-nightly/uri_display_type_errors.stderr @@ -7,52 +7,52 @@ error[E0277]: the trait bound `BadType: rocket::http::uri::UriDisplay` for `&BadType` error[E0277]: the trait bound `BadType: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display_type_errors.rs:11:5 + --> $DIR/uri_display_type_errors.rs:10:5 | -11 | field: BadType, +10 | field: BadType, | ^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `BadType` | = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&BadType` error[E0277]: the trait bound `BadType: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display_type_errors.rs:18:5 + --> $DIR/uri_display_type_errors.rs:16:5 | -18 | bad: BadType, +16 | bad: BadType, | ^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `BadType` | = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&BadType` error[E0277]: the trait bound `BadType: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display_type_errors.rs:24:11 + --> $DIR/uri_display_type_errors.rs:21:11 | -24 | Inner(BadType), +21 | Inner(BadType), | ^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `BadType` | = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&BadType` = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&&BadType` error[E0277]: the trait bound `BadType: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display_type_errors.rs:31:9 + --> $DIR/uri_display_type_errors.rs:27:9 | -31 | field: BadType, +27 | field: BadType, | ^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `BadType` | = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&BadType` = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&&BadType` error[E0277]: the trait bound `BadType: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display_type_errors.rs:40:9 + --> $DIR/uri_display_type_errors.rs:35:9 | -40 | other: BadType, +35 | other: BadType, | ^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `BadType` | = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&BadType` = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&&BadType` error[E0277]: the trait bound `BadType: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display_type_errors.rs:46:12 + --> $DIR/uri_display_type_errors.rs:40:12 | -46 | struct Baz(BadType); +40 | struct Baz(BadType); | ^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `BadType` | = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&BadType` diff --git a/core/codegen/tests/ui-fail-stable/async-entry.stderr b/core/codegen/tests/ui-fail-stable/async-entry.stderr index 9001c2db..772d6302 100644 --- a/core/codegen/tests/ui-fail-stable/async-entry.stderr +++ b/core/codegen/tests/ui-fail-stable/async-entry.stderr @@ -12,20 +12,6 @@ error: [note] this function must be `async` 7 | fn foo() { } | ^^ -error: [warning] attribute is typically applied to `main` function - --> $DIR/async-entry.rs:12:5 - | -12 | #[rocket::main] - | ^^^^^^^^^^^^^^^ - | - = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error: [note] this function is not `main` - --> $DIR/async-entry.rs:13:5 - | -13 | async fn foo() { } - | ^^^^^ - error: attribute can only be applied to `async` functions --> $DIR/async-entry.rs:18:5 | @@ -42,124 +28,124 @@ error: [note] this function must be `async` error: attribute cannot be applied to `main` function --- note: this attribute generates a `main` function - --> $DIR/async-entry.rs:55:5 + --> $DIR/async-entry.rs:52:5 | -55 | #[rocket::launch] +52 | #[rocket::launch] | ^^^^^^^^^^^^^^^^^ | = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) error: [note] this function cannot be `main` - --> $DIR/async-entry.rs:56:5 + --> $DIR/async-entry.rs:53:8 | -56 | fn main() -> rocket::Rocket { - | ^^ +53 | fn main() -> rocket::Rocket { + | ^^^^ error: attribute can only be applied to functions that return a value - --> $DIR/async-entry.rs:63:5 + --> $DIR/async-entry.rs:59:5 | -63 | #[rocket::launch] +59 | #[rocket::launch] | ^^^^^^^^^^^^^^^^^ | = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) error: [note] this function must return a value - --> $DIR/async-entry.rs:64:5 + --> $DIR/async-entry.rs:60:5 | -64 | async fn rocket() { +60 | async fn rocket() { | ^^^^^ error: attribute can only be applied to functions that return a value - --> $DIR/async-entry.rs:72:5 + --> $DIR/async-entry.rs:67:5 | -72 | #[rocket::launch] +67 | #[rocket::launch] | ^^^^^^^^^^^^^^^^^ | = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) error: [note] this function must return a value - --> $DIR/async-entry.rs:73:5 + --> $DIR/async-entry.rs:68:5 | -73 | fn rocket() { +68 | fn rocket() { | ^^ error: attribute cannot be applied to `main` function --- note: this attribute generates a `main` function - --> $DIR/async-entry.rs:89:5 + --> $DIR/async-entry.rs:82:5 | -89 | #[rocket::launch] +82 | #[rocket::launch] | ^^^^^^^^^^^^^^^^^ | = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) error: [note] this function cannot be `main` + --> $DIR/async-entry.rs:83:8 + | +83 | fn main() -> &'static str { + | ^^^^ + +error: attribute cannot be applied to `main` function + --- note: this attribute generates a `main` function --> $DIR/async-entry.rs:90:5 | -90 | fn main() -> &'static str { - | ^^ - -error: attribute cannot be applied to `main` function - --- note: this attribute generates a `main` function - --> $DIR/async-entry.rs:98:5 - | -98 | #[rocket::launch] +90 | #[rocket::launch] | ^^^^^^^^^^^^^^^^^ | = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) error: [note] this function cannot be `main` - --> $DIR/async-entry.rs:99:5 + --> $DIR/async-entry.rs:91:14 | -99 | async fn main() -> rocket::Rocket { - | ^^^^^ +91 | async fn main() -> rocket::Rocket { + | ^^^^ error[E0728]: `await` is only allowed inside `async` functions and blocks - --> $DIR/async-entry.rs:82:17 + --> $DIR/async-entry.rs:76:17 | -81 | fn rocket() -> rocket::Rocket { +75 | fn rocket() -> rocket::Rocket { | ------ this is not `async` -82 | let _ = rocket::ignite().launch().await; +76 | let _ = rocket::ignite().launch().await; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ only allowed inside `async` functions and blocks error[E0308]: mismatched types - --> $DIR/async-entry.rs:40:9 + --> $DIR/async-entry.rs:38:9 | -40 | rocket::ignite() +38 | rocket::ignite() | ^^^^^^^^^^^^^^^^ expected struct `std::string::String`, found struct `rocket::rocket::Rocket` error[E0308]: mismatched types - --> $DIR/async-entry.rs:49:9 + --> $DIR/async-entry.rs:47:9 | -49 | "hi".to_string() +47 | "hi".to_string() | ^^^^^^^^^^^^^^^^ expected struct `rocket::rocket::Rocket`, found struct `std::string::String` error[E0308]: mismatched types - --> $DIR/async-entry.rs:27:21 + --> $DIR/async-entry.rs:26:21 | -27 | async fn main() { +26 | async fn main() { | ^ expected `()` because of default return type | _____________________| | | -28 | | //~^ ERROR mismatched types -29 | | rocket::ignite() -30 | | } +27 | | +28 | | rocket::ignite() +29 | | } | | ^- help: try adding a semicolon: `;` | |_____| | expected `()`, found struct `rocket::rocket::Rocket` error[E0308]: mismatched types - --> $DIR/async-entry.rs:37:26 + --> $DIR/async-entry.rs:36:26 | -37 | async fn rocket() -> String { +36 | async fn rocket() -> String { | ^^^^^^ | | | expected struct `rocket::rocket::Rocket`, found struct `std::string::String` | expected due to this error[E0277]: `main` has invalid return type `rocket::rocket::Rocket` - --> $DIR/async-entry.rs:106:20 - | -106 | async fn main() -> rocket::Rocket { - | ^^^^^^^^^^^^^^ `main` can only return types that implement `std::process::Termination` - | - = help: consider using `()`, or a `Result` + --> $DIR/async-entry.rs:97:20 + | +97 | async fn main() -> rocket::Rocket { + | ^^^^^^^^^^^^^^ `main` can only return types that implement `std::process::Termination` + | + = help: consider using `()`, or a `Result` diff --git a/core/codegen/tests/ui-fail-stable/catch.stderr b/core/codegen/tests/ui-fail-stable/catch.stderr index f7781bc9..019d75a9 100644 --- a/core/codegen/tests/ui-fail-stable/catch.stderr +++ b/core/codegen/tests/ui-fail-stable/catch.stderr @@ -7,59 +7,59 @@ error: expected `fn` error: expected `fn` --- help: `#[catch]` can only be used on functions - --> $DIR/catch.rs:11:7 - | -11 | const CATCH: &str = "Catcher"; - | ^^^^^ + --> $DIR/catch.rs:9:7 + | +9 | const CATCH: &str = "Catcher"; + | ^^^^^ error: invalid value: expected unsigned integer literal --- help: `#[catch]` expects a single status integer, e.g.: #[catch(404)] - --> $DIR/catch.rs:15:9 + --> $DIR/catch.rs:11:9 | -15 | #[catch("404")] //~ ERROR expected unsigned integer literal +11 | #[catch("404")] | ^^^^^ error: unexpected keyed parameter: expected literal or identifier --- help: `#[catch]` expects a single status integer, e.g.: #[catch(404)] - --> $DIR/catch.rs:19:9 + --> $DIR/catch.rs:14:9 | -19 | #[catch(code = "404")] //~ ERROR unexpected keyed parameter +14 | #[catch(code = "404")] | ^^^^ error: unexpected keyed parameter: expected literal or identifier --- help: `#[catch]` expects a single status integer, e.g.: #[catch(404)] - --> $DIR/catch.rs:23:9 + --> $DIR/catch.rs:17:9 | -23 | #[catch(code = 404)] //~ ERROR unexpected keyed parameter +17 | #[catch(code = 404)] | ^^^^ error: status must be in range [100, 599] --- help: `#[catch]` expects a single status integer, e.g.: #[catch(404)] - --> $DIR/catch.rs:27:9 + --> $DIR/catch.rs:20:9 | -27 | #[catch(99)] //~ ERROR in range [100, 599] +20 | #[catch(99)] | ^^ error: status must be in range [100, 599] --- help: `#[catch]` expects a single status integer, e.g.: #[catch(404)] - --> $DIR/catch.rs:31:9 + --> $DIR/catch.rs:23:9 | -31 | #[catch(600)] //~ ERROR in range [100, 599] +23 | #[catch(600)] | ^^^ error: unexpected attribute parameter: `message` --- help: `#[catch]` expects a single status integer, e.g.: #[catch(404)] - --> $DIR/catch.rs:35:14 + --> $DIR/catch.rs:26:14 | -35 | #[catch(400, message = "foo")] //~ ERROR unexpected attribute parameter: `message` +26 | #[catch(400, message = "foo")] | ^^^^^^^ error: invalid number of arguments: must be zero or one --- help: catchers may optionally take an argument of type `&Request` - --> $DIR/catch.rs:40:7 + --> $DIR/catch.rs:30:6 | -40 | fn f3(_request: &Request, other: bool) { - | ^^^^^^^^ +30 | fn f3(_request: &Request, other: bool) { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused import: `rocket::Request` --> $DIR/catch.rs:3:5 diff --git a/core/codegen/tests/ui-fail-stable/catch_type_errors.stderr b/core/codegen/tests/ui-fail-stable/catch_type_errors.stderr index f1f5d387..60379299 100644 --- a/core/codegen/tests/ui-fail-stable/catch_type_errors.stderr +++ b/core/codegen/tests/ui-fail-stable/catch_type_errors.stderr @@ -7,31 +7,31 @@ error[E0277]: the trait bound `usize: rocket::response::Responder<'_, '_>` is no = note: required by `rocket::response::Responder::respond_to` error[E0277]: the trait bound `bool: rocket::response::Responder<'_, '_>` is not satisfied - --> $DIR/catch_type_errors.rs:12:30 + --> $DIR/catch_type_errors.rs:11:30 | -12 | fn f2(_request: &Request) -> bool { +11 | fn f2(_request: &Request) -> bool { | ^^^^ the trait `rocket::response::Responder<'_, '_>` is not implemented for `bool` | = note: required by `rocket::response::Responder::respond_to` error[E0308]: mismatched types - --> $DIR/catch_type_errors.rs:18:7 + --> $DIR/catch_type_errors.rs:16:17 | -18 | fn f3(_request: bool) -> usize { - | ^^^^^^^^ expected `bool`, found `&rocket::Request<'_>` +16 | fn f3(_request: bool) -> usize { + | ^^^^ expected `bool`, found `&rocket::Request<'_>` error[E0277]: the trait bound `usize: rocket::response::Responder<'_, '_>` is not satisfied - --> $DIR/catch_type_errors.rs:18:26 + --> $DIR/catch_type_errors.rs:16:26 | -18 | fn f3(_request: bool) -> usize { +16 | fn f3(_request: bool) -> usize { | ^^^^^ the trait `rocket::response::Responder<'_, '_>` is not implemented for `usize` | = note: required by `rocket::response::Responder::respond_to` error[E0277]: the trait bound `usize: rocket::response::Responder<'_, '_>` is not satisfied - --> $DIR/catch_type_errors.rs:25:12 + --> $DIR/catch_type_errors.rs:21:12 | -25 | fn f4() -> usize { +21 | fn f4() -> usize { | ^^^^^ the trait `rocket::response::Responder<'_, '_>` is not implemented for `usize` | = note: required by `rocket::response::Responder::respond_to` diff --git a/core/codegen/tests/ui-fail-stable/catchers.stderr b/core/codegen/tests/ui-fail-stable/catchers.stderr index 388da528..ca261acd 100644 --- a/core/codegen/tests/ui-fail-stable/catchers.stderr +++ b/core/codegen/tests/ui-fail-stable/catchers.stderr @@ -1,19 +1,19 @@ error: expected `,` --> $DIR/catchers.rs:4:25 | -4 | let _ = catchers![a b]; //~ ERROR expected +4 | let _ = catchers![a b]; | ^ error: expected identifier --> $DIR/catchers.rs:6:26 | -6 | let _ = catchers![a::, ]; //~ ERROR expected identifier +6 | let _ = catchers![a::, ]; | ^ error: unexpected end of input, expected identifier --> $DIR/catchers.rs:7:13 | -7 | let _ = catchers![a::]; //~ ERROR expected identifier +7 | let _ = catchers![a::]; | ^^^^^^^^^^^^^^ | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/core/codegen/tests/ui-fail-stable/from_form.stderr b/core/codegen/tests/ui-fail-stable/from_form.stderr index 87992d11..65e7bda0 100644 --- a/core/codegen/tests/ui-fail-stable/from_form.stderr +++ b/core/codegen/tests/ui-fail-stable/from_form.stderr @@ -13,39 +13,53 @@ error: [note] error occurred while deriving `FromForm` = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: tuple structs are not supported - --> $DIR/from_form.rs:10:1 - | -10 | struct Foo1; - | ^^^^^^ + --> $DIR/from_form.rs:9:1 + | +9 | struct Foo1; + | ^^^^^^ error: [note] error occurred while deriving `FromForm` - --> $DIR/from_form.rs:9:10 + --> $DIR/from_form.rs:8:10 | -9 | #[derive(FromForm)] +8 | #[derive(FromForm)] | ^^^^^^^^ | = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: at least one field is required - --> $DIR/from_form.rs:14:1 + --> $DIR/from_form.rs:12:13 | -14 | struct Foo2 { } - | ^^^^^^ +12 | struct Foo2 { } + | ^^^^ error: [note] error occurred while deriving `FromForm` - --> $DIR/from_form.rs:13:10 + --> $DIR/from_form.rs:11:10 | -13 | #[derive(FromForm)] +11 | #[derive(FromForm)] | ^^^^^^^^ | = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: tuple structs are not supported - --> $DIR/from_form.rs:18:1 + --> $DIR/from_form.rs:15:1 | -18 | struct Foo3(usize); +15 | struct Foo3(usize); | ^^^^^^ +error: [note] error occurred while deriving `FromForm` + --> $DIR/from_form.rs:14:10 + | +14 | #[derive(FromForm)] + | ^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: only one lifetime is supported + --> $DIR/from_form.rs:18:25 + | +18 | struct NextTodoTask<'f, 'a> { + | ^^ + error: [note] error occurred while deriving `FromForm` --> $DIR/from_form.rs:17:10 | @@ -54,50 +68,56 @@ error: [note] error occurred while deriving `FromForm` | = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) -error: only one lifetime is supported - --> $DIR/from_form.rs:22:20 - | -22 | struct NextTodoTask<'f, 'a> { - | ^ - -error: [note] error occurred while deriving `FromForm` - --> $DIR/from_form.rs:21:10 - | -21 | #[derive(FromForm)] - | ^^^^^^^^ - | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - error: invalid form field name - --> $DIR/from_form.rs:32:20 + --> $DIR/from_form.rs:27:20 | -32 | #[form(field = "isindex")] +27 | #[form(field = "isindex")] | ^^^^^^^^^ error: [note] error occurred while deriving `FromForm` - --> $DIR/from_form.rs:30:10 + --> $DIR/from_form.rs:25:10 | -30 | #[derive(FromForm)] +25 | #[derive(FromForm)] | ^^^^^^^^ | = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: duplicate field name - --> $DIR/from_form.rs:41:5 + --> $DIR/from_form.rs:35:5 | -41 | foo: usize, +35 | foo: usize, | ^^^ error: [note] previous definition here - --> $DIR/from_form.rs:39:20 + --> $DIR/from_form.rs:33:20 | -39 | #[form(field = "foo")] +33 | #[form(field = "foo")] | ^^^^^ error: [note] error occurred while deriving `FromForm` - --> $DIR/from_form.rs:37:10 + --> $DIR/from_form.rs:31:10 | -37 | #[derive(FromForm)] +31 | #[derive(FromForm)] + | ^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: duplicate field name + --> $DIR/from_form.rs:42:20 + | +42 | #[form(field = "hello")] + | ^^^^^^^ + +error: [note] previous definition here + --> $DIR/from_form.rs:40:20 + | +40 | #[form(field = "hello")] + | ^^^^^^^ + +error: [note] error occurred while deriving `FromForm` + --> $DIR/from_form.rs:38:10 + | +38 | #[derive(FromForm)] | ^^^^^^^^ | = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) @@ -105,92 +125,100 @@ error: [note] error occurred while deriving `FromForm` error: duplicate field name --> $DIR/from_form.rs:49:20 | -49 | #[form(field = "hello")] +49 | #[form(field = "first")] | ^^^^^^^ error: [note] previous definition here - --> $DIR/from_form.rs:47:20 + --> $DIR/from_form.rs:48:5 | -47 | #[form(field = "hello")] - | ^^^^^^^ - -error: [note] error occurred while deriving `FromForm` - --> $DIR/from_form.rs:45:10 - | -45 | #[derive(FromForm)] - | ^^^^^^^^ - | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error: duplicate field name - --> $DIR/from_form.rs:57:20 - | -57 | #[form(field = "first")] - | ^^^^^^^ - -error: [note] previous definition here - --> $DIR/from_form.rs:56:5 - | -56 | first: String, +48 | first: String, | ^^^^^ error: [note] error occurred while deriving `FromForm` - --> $DIR/from_form.rs:54:10 + --> $DIR/from_form.rs:46:10 | -54 | #[derive(FromForm)] +46 | #[derive(FromForm)] | ^^^^^^^^ | = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: duplicate attribute parameter: field - --> $DIR/from_form.rs:64:28 + --> $DIR/from_form.rs:55:28 | -64 | #[form(field = "blah", field = "bloo")] +55 | #[form(field = "blah", field = "bloo")] | ^^^^^ error: [note] error occurred while deriving `FromForm` - --> $DIR/from_form.rs:62:10 + --> $DIR/from_form.rs:53:10 | -62 | #[derive(FromForm)] +53 | #[derive(FromForm)] | ^^^^^^^^ | = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: malformed attribute: expected list --- help: expected syntax: #[form(key = value, ..)] - --> $DIR/from_form.rs:71:7 + --> $DIR/from_form.rs:61:7 | -71 | #[form] +61 | #[form] | ^^^^ error: [note] error occurred while deriving `FromForm` - --> $DIR/from_form.rs:69:10 + --> $DIR/from_form.rs:59:10 | -69 | #[derive(FromForm)] +59 | #[derive(FromForm)] | ^^^^^^^^ | = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: expected key/value pair - --> $DIR/from_form.rs:78:12 + --> $DIR/from_form.rs:67:12 | -78 | #[form("blah")] +67 | #[form("blah")] | ^^^^^^ error: [note] error occurred while deriving `FromForm` - --> $DIR/from_form.rs:76:10 + --> $DIR/from_form.rs:65:10 | -76 | #[derive(FromForm)] +65 | #[derive(FromForm)] | ^^^^^^^^ | = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: expected key/value pair - --> $DIR/from_form.rs:85:12 + --> $DIR/from_form.rs:73:12 | -85 | #[form(123)] +73 | #[form(123)] | ^^^ +error: [note] error occurred while deriving `FromForm` + --> $DIR/from_form.rs:71:10 + | +71 | #[derive(FromForm)] + | ^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: unexpected attribute parameter: `beep` + --> $DIR/from_form.rs:79:12 + | +79 | #[form(beep = "bop")] + | ^^^^ + +error: [note] error occurred while deriving `FromForm` + --> $DIR/from_form.rs:77:10 + | +77 | #[derive(FromForm)] + | ^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: duplicate invocation of `form` attribute + --> $DIR/from_form.rs:86:7 + | +86 | #[form(field = "bleh")] + | ^^^^ + error: [note] error occurred while deriving `FromForm` --> $DIR/from_form.rs:83:10 | @@ -199,11 +227,11 @@ error: [note] error occurred while deriving `FromForm` | = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) -error: unexpected attribute parameter: `beep` - --> $DIR/from_form.rs:92:12 +error: invalid value: expected string literal + --> $DIR/from_form.rs:92:20 | -92 | #[form(beep = "bop")] - | ^^^^ +92 | #[form(field = true)] + | ^^^^ error: [note] error occurred while deriving `FromForm` --> $DIR/from_form.rs:90:10 @@ -213,58 +241,72 @@ error: [note] error occurred while deriving `FromForm` | = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) -error: duplicate invocation of `form` attribute - --> $DIR/from_form.rs:100:5 - | -100 | #[form(field = "bleh")] - | ^ +error: expected literal or key/value pair + --> $DIR/from_form.rs:98:12 + | +98 | #[form(field)] + | ^^^^^ error: [note] error occurred while deriving `FromForm` - --> $DIR/from_form.rs:97:10 + --> $DIR/from_form.rs:96:10 | -97 | #[derive(FromForm)] +96 | #[derive(FromForm)] | ^^^^^^^^ | = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: invalid value: expected string literal - --> $DIR/from_form.rs:107:20 + --> $DIR/from_form.rs:104:20 | -107 | #[form(field = true)] - | ^^^^ - -error: [note] error occurred while deriving `FromForm` - --> $DIR/from_form.rs:105:10 - | -105 | #[derive(FromForm)] - | ^^^^^^^^ - | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error: expected literal or key/value pair - --> $DIR/from_form.rs:114:12 - | -114 | #[form(field)] - | ^^^^^ - -error: [note] error occurred while deriving `FromForm` - --> $DIR/from_form.rs:112:10 - | -112 | #[derive(FromForm)] - | ^^^^^^^^ - | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error: invalid value: expected string literal - --> $DIR/from_form.rs:121:20 - | -121 | #[form(field = 123)] +104 | #[form(field = 123)] | ^^^ error: [note] error occurred while deriving `FromForm` - --> $DIR/from_form.rs:119:10 + --> $DIR/from_form.rs:102:10 | -119 | #[derive(FromForm)] +102 | #[derive(FromForm)] + | ^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: invalid form field name + --> $DIR/from_form.rs:110:20 + | +110 | #[form(field = "hello&world")] + | ^^^^^^^^^^^^^ + +error: [note] error occurred while deriving `FromForm` + --> $DIR/from_form.rs:108:10 + | +108 | #[derive(FromForm)] + | ^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: invalid form field name + --> $DIR/from_form.rs:116:20 + | +116 | #[form(field = "!@#$%^&*()_")] + | ^^^^^^^^^^^^^ + +error: [note] error occurred while deriving `FromForm` + --> $DIR/from_form.rs:114:10 + | +114 | #[derive(FromForm)] + | ^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: invalid form field name + --> $DIR/from_form.rs:122:20 + | +122 | #[form(field = "?")] + | ^^^ + +error: [note] error occurred while deriving `FromForm` + --> $DIR/from_form.rs:120:10 + | +120 | #[derive(FromForm)] | ^^^^^^^^ | = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) @@ -272,8 +314,8 @@ error: [note] error occurred while deriving `FromForm` error: invalid form field name --> $DIR/from_form.rs:128:20 | -128 | #[form(field = "hello&world")] - | ^^^^^^^^^^^^^ +128 | #[form(field = "")] + | ^^ error: [note] error occurred while deriving `FromForm` --> $DIR/from_form.rs:126:10 @@ -284,71 +326,29 @@ error: [note] error occurred while deriving `FromForm` = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: invalid form field name - --> $DIR/from_form.rs:135:20 + --> $DIR/from_form.rs:134:20 | -135 | #[form(field = "!@#$%^&*()_")] - | ^^^^^^^^^^^^^ - -error: [note] error occurred while deriving `FromForm` - --> $DIR/from_form.rs:133:10 - | -133 | #[derive(FromForm)] - | ^^^^^^^^ - | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error: invalid form field name - --> $DIR/from_form.rs:142:20 - | -142 | #[form(field = "?")] - | ^^^ - -error: [note] error occurred while deriving `FromForm` - --> $DIR/from_form.rs:140:10 - | -140 | #[derive(FromForm)] - | ^^^^^^^^ - | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error: invalid form field name - --> $DIR/from_form.rs:149:20 - | -149 | #[form(field = "")] - | ^^ - -error: [note] error occurred while deriving `FromForm` - --> $DIR/from_form.rs:147:10 - | -147 | #[derive(FromForm)] - | ^^^^^^^^ - | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error: invalid form field name - --> $DIR/from_form.rs:156:20 - | -156 | #[form(field = "a&b")] +134 | #[form(field = "a&b")] | ^^^^^ error: [note] error occurred while deriving `FromForm` - --> $DIR/from_form.rs:154:10 + --> $DIR/from_form.rs:132:10 | -154 | #[derive(FromForm)] +132 | #[derive(FromForm)] | ^^^^^^^^ | = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: invalid form field name - --> $DIR/from_form.rs:163:20 + --> $DIR/from_form.rs:140:20 | -163 | #[form(field = "a=")] +140 | #[form(field = "a=")] | ^^^^ error: [note] error occurred while deriving `FromForm` - --> $DIR/from_form.rs:161:10 + --> $DIR/from_form.rs:138:10 | -161 | #[derive(FromForm)] +138 | #[derive(FromForm)] | ^^^^^^^^ | = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/core/codegen/tests/ui-fail-stable/from_form_type_errors.stderr b/core/codegen/tests/ui-fail-stable/from_form_type_errors.stderr index 6e80d104..ba620874 100644 --- a/core/codegen/tests/ui-fail-stable/from_form_type_errors.stderr +++ b/core/codegen/tests/ui-fail-stable/from_form_type_errors.stderr @@ -5,7 +5,7 @@ error[E0277]: the trait bound `Unknown: rocket::request::FromFormValue<'_>` is n | ^^^^^ the trait `rocket::request::FromFormValue<'_>` is not implemented for `Unknown` error[E0277]: the trait bound `Foo: rocket::request::FromFormValue<'_>` is not satisfied - --> $DIR/from_form_type_errors.rs:15:5 + --> $DIR/from_form_type_errors.rs:14:5 | -15 | field: Foo, +14 | field: Foo, | ^^^^^ the trait `rocket::request::FromFormValue<'_>` is not implemented for `Foo` diff --git a/core/codegen/tests/ui-fail-stable/from_form_value.stderr b/core/codegen/tests/ui-fail-stable/from_form_value.stderr index b4eef63a..bb5a9a59 100644 --- a/core/codegen/tests/ui-fail-stable/from_form_value.stderr +++ b/core/codegen/tests/ui-fail-stable/from_form_value.stderr @@ -13,67 +13,81 @@ error: [note] error occurred while deriving `FromFormValue` = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: tuple structs are not supported - --> $DIR/from_form_value.rs:8:1 + --> $DIR/from_form_value.rs:7:1 | -8 | struct Foo2(usize); +7 | struct Foo2(usize); | ^^^^^^ error: [note] error occurred while deriving `FromFormValue` - --> $DIR/from_form_value.rs:7:10 + --> $DIR/from_form_value.rs:6:10 | -7 | #[derive(FromFormValue)] +6 | #[derive(FromFormValue)] | ^^^^^^^^^^^^^ | = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: named structs are not supported - --> $DIR/from_form_value.rs:12:1 + --> $DIR/from_form_value.rs:10:1 | -12 | struct Foo3 { +10 | struct Foo3 { | ^^^^^^ error: [note] error occurred while deriving `FromFormValue` - --> $DIR/from_form_value.rs:11:10 - | -11 | #[derive(FromFormValue)] - | ^^^^^^^^^^^^^ - | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + --> $DIR/from_form_value.rs:9:10 + | +9 | #[derive(FromFormValue)] + | ^^^^^^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: variants cannot have fields - --> $DIR/from_form_value.rs:19:5 + --> $DIR/from_form_value.rs:16:7 | -19 | A(usize), - | ^ +16 | A(usize), + | ^^^^^ error: [note] error occurred while deriving `FromFormValue` - --> $DIR/from_form_value.rs:17:10 + --> $DIR/from_form_value.rs:14:10 | -17 | #[derive(FromFormValue)] +14 | #[derive(FromFormValue)] | ^^^^^^^^^^^^^ | = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: enum must have at least one field - --> $DIR/from_form_value.rs:24:1 + --> $DIR/from_form_value.rs:20:11 | -24 | enum Foo5 { } - | ^^^^ +20 | enum Foo5 { } + | ^^^ error: [note] error occurred while deriving `FromFormValue` - --> $DIR/from_form_value.rs:23:10 + --> $DIR/from_form_value.rs:19:10 | -23 | #[derive(FromFormValue)] +19 | #[derive(FromFormValue)] | ^^^^^^^^^^^^^ | = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: type generics are not supported - --> $DIR/from_form_value.rs:28:11 + --> $DIR/from_form_value.rs:23:11 | -28 | enum Foo6 { +23 | enum Foo6 { | ^ +error: [note] error occurred while deriving `FromFormValue` + --> $DIR/from_form_value.rs:22:10 + | +22 | #[derive(FromFormValue)] + | ^^^^^^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: invalid value: expected string literal + --> $DIR/from_form_value.rs:29:20 + | +29 | #[form(value = 123)] + | ^^^ + error: [note] error occurred while deriving `FromFormValue` --> $DIR/from_form_value.rs:27:10 | @@ -82,11 +96,11 @@ error: [note] error occurred while deriving `FromFormValue` | = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) -error: invalid value: expected string literal - --> $DIR/from_form_value.rs:35:20 +error: expected literal or key/value pair + --> $DIR/from_form_value.rs:35:12 | -35 | #[form(value = 123)] - | ^^^ +35 | #[form(value)] + | ^^^^^ error: [note] error occurred while deriving `FromFormValue` --> $DIR/from_form_value.rs:33:10 @@ -95,17 +109,3 @@ error: [note] error occurred while deriving `FromFormValue` | ^^^^^^^^^^^^^ | = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error: expected literal or key/value pair - --> $DIR/from_form_value.rs:42:12 - | -42 | #[form(value)] - | ^^^^^ - -error: [note] error occurred while deriving `FromFormValue` - --> $DIR/from_form_value.rs:40:10 - | -40 | #[derive(FromFormValue)] - | ^^^^^^^^^^^^^ - | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/core/codegen/tests/ui-fail-stable/responder-types.stderr b/core/codegen/tests/ui-fail-stable/responder-types.stderr index df37ef81..64f74b09 100644 --- a/core/codegen/tests/ui-fail-stable/responder-types.stderr +++ b/core/codegen/tests/ui-fail-stable/responder-types.stderr @@ -1,15 +1,15 @@ error[E0277]: the trait bound `u8: rocket::response::Responder<'_, '_>` is not satisfied - --> $DIR/responder-types.rs:9:5 + --> $DIR/responder-types.rs:5:5 | -9 | thing: u8, +5 | thing: u8, | ^^^^^ the trait `rocket::response::Responder<'_, '_>` is not implemented for `u8` | = note: required by `rocket::response::Responder::respond_to` error[E0277]: the trait bound `rocket::http::Header<'_>: std::convert::From` is not satisfied - --> $DIR/responder-types.rs:16:5 + --> $DIR/responder-types.rs:11:5 | -16 | other: u8, +11 | other: u8, | ^^^^^ the trait `std::convert::From` is not implemented for `rocket::http::Header<'_>` | = help: the following implementations were found: @@ -18,17 +18,17 @@ error[E0277]: the trait bound `rocket::http::Header<'_>: std::convert::From` = note: required because of the requirements on the impl of `std::convert::Into>` for `u8` error[E0277]: the trait bound `u8: rocket::response::Responder<'_, '_>` is not satisfied - --> $DIR/responder-types.rs:22:5 + --> $DIR/responder-types.rs:16:5 | -22 | thing: u8, +16 | thing: u8, | ^^^^^ the trait `rocket::response::Responder<'_, '_>` is not implemented for `u8` | = note: required by `rocket::response::Responder::respond_to` error[E0277]: the trait bound `rocket::http::Header<'_>: std::convert::From` is not satisfied - --> $DIR/responder-types.rs:24:5 + --> $DIR/responder-types.rs:17:5 | -24 | other: u8, +17 | other: u8, | ^^^^^ the trait `std::convert::From` is not implemented for `rocket::http::Header<'_>` | = help: the following implementations were found: @@ -37,9 +37,9 @@ error[E0277]: the trait bound `rocket::http::Header<'_>: std::convert::From` = note: required because of the requirements on the impl of `std::convert::Into>` for `u8` error[E0277]: the trait bound `rocket::http::Header<'_>: std::convert::From` is not satisfied - --> $DIR/responder-types.rs:32:5 + --> $DIR/responder-types.rs:24:5 | -32 | then: String, +24 | then: String, | ^^^^ the trait `std::convert::From` is not implemented for `rocket::http::Header<'_>` | = help: the following implementations were found: @@ -48,9 +48,9 @@ error[E0277]: the trait bound `rocket::http::Header<'_>: std::convert::From>` for `std::string::String` error[E0277]: the trait bound `usize: rocket::response::Responder<'_, '_>` is not satisfied - --> $DIR/responder-types.rs:37:13 + --> $DIR/responder-types.rs:28:13 | -37 | fn foo() -> usize { 0 } +28 | fn foo() -> usize { 0 } | ^^^^^ the trait `rocket::response::Responder<'_, '_>` is not implemented for `usize` | = note: required by `rocket::handler::, rocket::http::Status, rocket::Data>>::from` diff --git a/core/codegen/tests/ui-fail-stable/route-attribute-general-syntax.stderr b/core/codegen/tests/ui-fail-stable/route-attribute-general-syntax.stderr index 1350efe9..77b383bb 100644 --- a/core/codegen/tests/ui-fail-stable/route-attribute-general-syntax.stderr +++ b/core/codegen/tests/ui-fail-stable/route-attribute-general-syntax.stderr @@ -1,206 +1,206 @@ error: missing expected parameter: `path` - --> $DIR/route-attribute-general-syntax.rs:5:1 + --> $DIR/route-attribute-general-syntax.rs:4:1 | -5 | #[get()] //~ ERROR missing expected parameter +4 | #[get()] | ^^^^^^^^ | = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) error: expected `fn` --- help: #[get] can only be used on functions - --> $DIR/route-attribute-general-syntax.rs:11:1 - | -11 | struct S; - | ^^^^^^ + --> $DIR/route-attribute-general-syntax.rs:9:1 + | +9 | struct S; + | ^^^^^^ error: expected `fn` --- help: #[get] can only be used on functions - --> $DIR/route-attribute-general-syntax.rs:16:1 + --> $DIR/route-attribute-general-syntax.rs:12:1 | -16 | enum A { } +12 | enum A { } | ^^^^ error: expected `fn` --- help: #[get] can only be used on functions - --> $DIR/route-attribute-general-syntax.rs:21:1 + --> $DIR/route-attribute-general-syntax.rs:15:1 | -21 | trait Foo { } +15 | trait Foo { } | ^^^^^ error: expected `fn` --- help: #[get] can only be used on functions - --> $DIR/route-attribute-general-syntax.rs:26:1 + --> $DIR/route-attribute-general-syntax.rs:18:1 | -26 | impl S { } +18 | impl S { } | ^^^^ error: expected key/value pair - --> $DIR/route-attribute-general-syntax.rs:32:12 + --> $DIR/route-attribute-general-syntax.rs:21:12 | -32 | #[get("/", 123)] //~ ERROR expected +21 | #[get("/", 123)] | ^^^ error: expected key/value pair - --> $DIR/route-attribute-general-syntax.rs:35:12 + --> $DIR/route-attribute-general-syntax.rs:24:12 | -35 | #[get("/", "/")] //~ ERROR expected +24 | #[get("/", "/")] | ^^^ error: unexpected keyed parameter: expected literal or identifier - --> $DIR/route-attribute-general-syntax.rs:38:7 + --> $DIR/route-attribute-general-syntax.rs:27:7 | -38 | #[get(data = "", "/")] //~ ERROR unexpected keyed parameter +27 | #[get(data = "", "/")] | ^^^^ error: unexpected attribute parameter: `unknown` - --> $DIR/route-attribute-general-syntax.rs:41:12 + --> $DIR/route-attribute-general-syntax.rs:30:12 | -41 | #[get("/", unknown = "foo")] //~ ERROR unexpected +30 | #[get("/", unknown = "foo")] | ^^^^^^^ error: malformed attribute --- help: expected syntax: #[get(key = value, ..)] - --> $DIR/route-attribute-general-syntax.rs:44:1 + --> $DIR/route-attribute-general-syntax.rs:33:1 | -44 | #[get("/", ...)] //~ ERROR malformed +33 | #[get("/", ...)] | ^^^^^^^^^^^^^^^^ | = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) error: handler arguments cannot be ignored --- help: all handler arguments must be of the form: `ident: Type` - --> $DIR/route-attribute-general-syntax.rs:51:7 + --> $DIR/route-attribute-general-syntax.rs:39:7 | -51 | fn c1(_: usize) {} //~ ERROR cannot be ignored +39 | fn c1(_: usize) {} | ^ error: invalid value: expected string literal - --> $DIR/route-attribute-general-syntax.rs:56:7 + --> $DIR/route-attribute-general-syntax.rs:43:7 | -56 | #[get(100)] //~ ERROR expected string +43 | #[get(100)] | ^^^ error: invalid value: expected string literal - --> $DIR/route-attribute-general-syntax.rs:59:7 + --> $DIR/route-attribute-general-syntax.rs:46:7 | -59 | #[get('/')] //~ ERROR expected string +46 | #[get('/')] | ^^^ error: invalid value: expected integer literal - --> $DIR/route-attribute-general-syntax.rs:62:19 + --> $DIR/route-attribute-general-syntax.rs:49:19 | -62 | #[get("/", rank = "1")] //~ ERROR expected integer +49 | #[get("/", rank = "1")] | ^^^ error: invalid value: expected integer literal - --> $DIR/route-attribute-general-syntax.rs:65:19 + --> $DIR/route-attribute-general-syntax.rs:52:19 | -65 | #[get("/", rank = '1')] //~ ERROR expected integer +52 | #[get("/", rank = '1')] | ^^^ error: invalid or unknown media type - --> $DIR/route-attribute-general-syntax.rs:70:21 + --> $DIR/route-attribute-general-syntax.rs:57:21 | -70 | #[get("/", format = "applicationx-custom")] //~ ERROR invalid or unknown media type +57 | #[get("/", format = "applicationx-custom")] | ^^^^^^^^^^^^^^^^^^^^^ error: invalid or unknown media type - --> $DIR/route-attribute-general-syntax.rs:73:21 + --> $DIR/route-attribute-general-syntax.rs:60:21 | -73 | #[get("/", format = "")] //~ ERROR invalid or unknown media type +60 | #[get("/", format = "")] | ^^ error: invalid or unknown media type - --> $DIR/route-attribute-general-syntax.rs:76:21 + --> $DIR/route-attribute-general-syntax.rs:63:21 | -76 | #[get("/", format = "//")] //~ ERROR invalid or unknown media type +63 | #[get("/", format = "//")] | ^^^^ error: invalid or unknown media type - --> $DIR/route-attribute-general-syntax.rs:79:21 + --> $DIR/route-attribute-general-syntax.rs:66:21 | -79 | #[get("/", format = "/")] //~ ERROR invalid or unknown media type +66 | #[get("/", format = "/")] | ^^^ error: invalid or unknown media type - --> $DIR/route-attribute-general-syntax.rs:82:21 + --> $DIR/route-attribute-general-syntax.rs:69:21 | -82 | #[get("/", format = "a/")] //~ ERROR invalid or unknown media type +69 | #[get("/", format = "a/")] | ^^^^ error: invalid or unknown media type - --> $DIR/route-attribute-general-syntax.rs:85:21 + --> $DIR/route-attribute-general-syntax.rs:72:21 | -85 | #[get("/", format = "/a")] //~ ERROR invalid or unknown media type +72 | #[get("/", format = "/a")] | ^^^^ error: invalid or unknown media type - --> $DIR/route-attribute-general-syntax.rs:88:21 + --> $DIR/route-attribute-general-syntax.rs:75:21 | -88 | #[get("/", format = "/a/")] //~ ERROR invalid or unknown media type +75 | #[get("/", format = "/a/")] | ^^^^^ error: invalid or unknown media type - --> $DIR/route-attribute-general-syntax.rs:91:21 + --> $DIR/route-attribute-general-syntax.rs:78:21 | -91 | #[get("/", format = "a/b/")] //~ ERROR invalid or unknown media type +78 | #[get("/", format = "a/b/")] | ^^^^^^ error: invalid or unknown media type - --> $DIR/route-attribute-general-syntax.rs:94:21 + --> $DIR/route-attribute-general-syntax.rs:81:21 | -94 | #[get("/", format = "unknown")] //~ ERROR unknown media type +81 | #[get("/", format = "unknown")] | ^^^^^^^^^ error: invalid value: expected string literal - --> $DIR/route-attribute-general-syntax.rs:97:21 + --> $DIR/route-attribute-general-syntax.rs:84:21 | -97 | #[get("/", format = 12)] //~ ERROR expected string +84 | #[get("/", format = 12)] | ^^ error: invalid value: expected string literal - --> $DIR/route-attribute-general-syntax.rs:100:21 - | -100 | #[get("/", format = 'j')] //~ ERROR expected string - | ^^^ + --> $DIR/route-attribute-general-syntax.rs:87:21 + | +87 | #[get("/", format = 'j')] + | ^^^ error: invalid or unknown media type - --> $DIR/route-attribute-general-syntax.rs:103:21 - | -103 | #[get("/", format = "text//foo")] //~ ERROR invalid or unknown media type - | ^^^^^^^^^^^ + --> $DIR/route-attribute-general-syntax.rs:90:21 + | +90 | #[get("/", format = "text//foo")] + | ^^^^^^^^^^^ error: invalid HTTP method for route handlers --- help: method must be one of: `GET`, `PUT`, `POST`, `DELETE`, `HEAD`, `PATCH`, `OPTIONS` - --> $DIR/route-attribute-general-syntax.rs:108:9 - | -108 | #[route(CONNECT, "/")] //~ ERROR invalid HTTP method for route - | ^^^^^^^ + --> $DIR/route-attribute-general-syntax.rs:95:9 + | +95 | #[route(CONNECT, "/")] + | ^^^^^^^ error: invalid HTTP method --- help: method must be one of: `GET`, `PUT`, `POST`, `DELETE`, `HEAD`, `PATCH`, `OPTIONS` - --> $DIR/route-attribute-general-syntax.rs:112:9 - | -112 | #[route(FIX, "/")] //~ ERROR invalid HTTP method - | ^^^ + --> $DIR/route-attribute-general-syntax.rs:98:9 + | +98 | #[route(FIX, "/")] + | ^^^ error: expected identifier, found string literal --- help: method must be one of: `GET`, `PUT`, `POST`, `DELETE`, `HEAD`, `PATCH`, `OPTIONS` - --> $DIR/route-attribute-general-syntax.rs:116:9 + --> $DIR/route-attribute-general-syntax.rs:101:9 | -116 | #[route("hi", "/")] //~ ERROR expected identifier +101 | #[route("hi", "/")] | ^^^^ error: expected identifier, found string literal --- help: method must be one of: `GET`, `PUT`, `POST`, `DELETE`, `HEAD`, `PATCH`, `OPTIONS` - --> $DIR/route-attribute-general-syntax.rs:120:9 + --> $DIR/route-attribute-general-syntax.rs:104:9 | -120 | #[route("GET", "/")] //~ ERROR expected identifier +104 | #[route("GET", "/")] | ^^^^^ error: expected identifier, found integer literal --- help: method must be one of: `GET`, `PUT`, `POST`, `DELETE`, `HEAD`, `PATCH`, `OPTIONS` - --> $DIR/route-attribute-general-syntax.rs:124:9 + --> $DIR/route-attribute-general-syntax.rs:107:9 | -124 | #[route(120, "/")] //~ ERROR expected identifier +107 | #[route(120, "/")] | ^^^ diff --git a/core/codegen/tests/ui-fail-stable/route-path-bad-syntax.stderr b/core/codegen/tests/ui-fail-stable/route-path-bad-syntax.stderr index 4a771fa1..5de5013a 100644 --- a/core/codegen/tests/ui-fail-stable/route-path-bad-syntax.stderr +++ b/core/codegen/tests/ui-fail-stable/route-path-bad-syntax.stderr @@ -2,229 +2,229 @@ error: invalid path URI: expected token / but found a at index 0 --- help: expected path in origin form: "/path/" --> $DIR/route-path-bad-syntax.rs:5:7 | -5 | #[get("a")] //~ ERROR invalid path URI +5 | #[get("a")] | ^^^ error: invalid path URI: expected token / but none was found at index 0 --- help: expected path in origin form: "/path/" - --> $DIR/route-path-bad-syntax.rs:9:7 + --> $DIR/route-path-bad-syntax.rs:8:7 | -9 | #[get("")] //~ ERROR invalid path URI +8 | #[get("")] | ^^ error: invalid path URI: expected token / but found a at index 0 --- help: expected path in origin form: "/path/" - --> $DIR/route-path-bad-syntax.rs:13:7 + --> $DIR/route-path-bad-syntax.rs:11:7 | -13 | #[get("a/b/c")] //~ ERROR invalid path URI +11 | #[get("a/b/c")] | ^^^^^^^ error: paths cannot contain empty segments --- note: expected '/a/b', found '/a///b' - --> $DIR/route-path-bad-syntax.rs:17:7 + --> $DIR/route-path-bad-syntax.rs:14:7 | -17 | #[get("/a///b")] //~ ERROR empty segments +14 | #[get("/a///b")] | ^^^^^^^^ error: query cannot contain empty segments - --> $DIR/route-path-bad-syntax.rs:21:7 + --> $DIR/route-path-bad-syntax.rs:17:7 | -21 | #[get("/?bat&&")] //~ ERROR empty segments +17 | #[get("/?bat&&")] | ^^^^^^^^^ error: query cannot contain empty segments - --> $DIR/route-path-bad-syntax.rs:24:7 + --> $DIR/route-path-bad-syntax.rs:20:7 | -24 | #[get("/?bat&&")] //~ ERROR empty segments +20 | #[get("/?bat&&")] | ^^^^^^^^^ error: paths cannot contain empty segments --- note: expected '/a/b', found '/a/b//' - --> $DIR/route-path-bad-syntax.rs:27:7 + --> $DIR/route-path-bad-syntax.rs:23:7 | -27 | #[get("/a/b//")] //~ ERROR empty segments +23 | #[get("/a/b//")] | ^^^^^^^^ error: invalid path URI: expected EOF but found # at index 3 --- help: expected path in origin form: "/path/" - --> $DIR/route-path-bad-syntax.rs:33:7 + --> $DIR/route-path-bad-syntax.rs:28:7 | -33 | #[get("/!@#$%^&*()")] //~ ERROR invalid path URI +28 | #[get("/!@#$%^&*()")] | ^^^^^^^^^^^^^ +error: component contains invalid URI characters + --- note: components cannot contain reserved characters + --- help: reserved characters include: '%', '+', '&', etc. + --> $DIR/route-path-bad-syntax.rs:31:7 + | +31 | #[get("/a%20b")] + | ^^^^^^^^ + +error: component contains invalid URI characters + --- note: components cannot contain reserved characters + --- help: reserved characters include: '%', '+', '&', etc. + --> $DIR/route-path-bad-syntax.rs:34:7 + | +34 | #[get("/a?a%20b")] + | ^^^^^^^^^^ + error: component contains invalid URI characters --- note: components cannot contain reserved characters --- help: reserved characters include: '%', '+', '&', etc. --> $DIR/route-path-bad-syntax.rs:37:7 | -37 | #[get("/a%20b")] //~ ERROR invalid URI characters +37 | #[get("/a?a+b")] | ^^^^^^^^ -error: component contains invalid URI characters - --- note: components cannot contain reserved characters - --- help: reserved characters include: '%', '+', '&', etc. +error: unused dynamic parameter --> $DIR/route-path-bad-syntax.rs:42:7 | -42 | #[get("/a?a%20b")] //~ ERROR invalid URI characters - | ^^^^^^^^^^ +42 | #[get("/")] + | ^^^^^^^^^ -error: component contains invalid URI characters - --- note: components cannot contain reserved characters - --- help: reserved characters include: '%', '+', '&', etc. - --> $DIR/route-path-bad-syntax.rs:47:7 +error: [note] expected argument named `name` here + --> $DIR/route-path-bad-syntax.rs:43:6 | -47 | #[get("/a?a+b")] //~ ERROR invalid URI characters +43 | fn h0(_name: usize) {} + | ^^^^^^^^^^^^^^ + +error: unused dynamic parameter + --> $DIR/route-path-bad-syntax.rs:45:7 + | +45 | #[get("/a?")] | ^^^^^^^^ +error: [note] expected argument named `r` here + --> $DIR/route-path-bad-syntax.rs:46:6 + | +46 | fn h1() {} + | ^^ + +error: unused dynamic parameter + --> $DIR/route-path-bad-syntax.rs:48:21 + | +48 | #[post("/a", data = "")] + | ^^^^^^^^ + +error: [note] expected argument named `test` here + --> $DIR/route-path-bad-syntax.rs:49:6 + | +49 | fn h2() {} + | ^^ + +error: unused dynamic parameter + --> $DIR/route-path-bad-syntax.rs:51:7 + | +51 | #[get("/<_r>")] + | ^^^^^^^ + +error: [note] expected argument named `_r` here + --> $DIR/route-path-bad-syntax.rs:52:6 + | +52 | fn h3() {} + | ^^ + error: unused dynamic parameter --> $DIR/route-path-bad-syntax.rs:54:7 | -54 | #[get("/")] //~ ERROR unused dynamic parameter - | ^^^^^^^^^ - -error: [note] expected argument named `name` here - --> $DIR/route-path-bad-syntax.rs:55:7 - | -55 | fn h0(_name: usize) {} //~ NOTE expected argument named `name` here - | ^^^^^ - -error: unused dynamic parameter - --> $DIR/route-path-bad-syntax.rs:57:7 - | -57 | #[get("/a?")] //~ ERROR unused dynamic parameter - | ^^^^^^^^ - -error: [note] expected argument named `r` here - --> $DIR/route-path-bad-syntax.rs:58:1 - | -58 | fn h1() {} //~ NOTE expected argument named `r` here - | ^^ - -error: unused dynamic parameter - --> $DIR/route-path-bad-syntax.rs:60:21 - | -60 | #[post("/a", data = "")] //~ ERROR unused dynamic parameter - | ^^^^^^^^ - -error: [note] expected argument named `test` here - --> $DIR/route-path-bad-syntax.rs:61:1 - | -61 | fn h2() {} //~ NOTE expected argument named `test` here - | ^^ - -error: unused dynamic parameter - --> $DIR/route-path-bad-syntax.rs:63:7 - | -63 | #[get("/<_r>")] //~ ERROR unused dynamic parameter - | ^^^^^^^ - -error: [note] expected argument named `_r` here - --> $DIR/route-path-bad-syntax.rs:64:1 - | -64 | fn h3() {} //~ NOTE expected argument named `_r` here - | ^^ - -error: unused dynamic parameter - --> $DIR/route-path-bad-syntax.rs:66:7 - | -66 | #[get("/<_r>/")] //~ ERROR unused dynamic parameter +54 | #[get("/<_r>/")] | ^^^^^^^^^^^ error: [note] expected argument named `b` here - --> $DIR/route-path-bad-syntax.rs:68:1 + --> $DIR/route-path-bad-syntax.rs:55:6 | -68 | fn h4() {} //~ NOTE expected argument named `_r` here - | ^^ +55 | fn h4() {} + | ^^ error: `foo_.` is not a valid identifier --- help: parameter names must be valid identifiers - --> $DIR/route-path-bad-syntax.rs:73:7 + --> $DIR/route-path-bad-syntax.rs:60:7 | -73 | #[get("/")] //~ ERROR `foo_.` is not a valid identifier +60 | #[get("/")] | ^^^^^^^^^^ error: `foo*` is not a valid identifier --- help: parameter names must be valid identifiers - --> $DIR/route-path-bad-syntax.rs:77:7 + --> $DIR/route-path-bad-syntax.rs:63:7 | -77 | #[get("/")] //~ ERROR `foo*` is not a valid identifier +63 | #[get("/")] | ^^^^^^^^^ error: `!` is not a valid identifier --- help: parameter names must be valid identifiers - --> $DIR/route-path-bad-syntax.rs:81:7 + --> $DIR/route-path-bad-syntax.rs:66:7 | -81 | #[get("/")] //~ ERROR `!` is not a valid identifier +66 | #[get("/")] | ^^^^^^ error: `name>: $DIR/route-path-bad-syntax.rs:85:7 + --> $DIR/route-path-bad-syntax.rs:69:7 | -85 | #[get("/:")] //~ ERROR `name>::")] | ^^^^^^^^^^^^^^ error: malformed parameter --- help: parameter must be of the form '' - --> $DIR/route-path-bad-syntax.rs:91:19 + --> $DIR/route-path-bad-syntax.rs:74:19 | -91 | #[get("/", data = "foo")] //~ ERROR malformed parameter +74 | #[get("/", data = "foo")] | ^^^^^ error: malformed parameter --- help: parameter must be of the form '' - --> $DIR/route-path-bad-syntax.rs:95:19 + --> $DIR/route-path-bad-syntax.rs:77:19 | -95 | #[get("/", data = "")] //~ ERROR malformed parameter +77 | #[get("/", data = "")] | ^^^^^^^^^ error: parameter is missing a closing bracket --- help: did you mean ''? - --> $DIR/route-path-bad-syntax.rs:99:19 + --> $DIR/route-path-bad-syntax.rs:80:19 | -99 | #[get("/", data = " $DIR/route-path-bad-syntax.rs:103:19 - | -103 | #[get("/", data = "")] //~ ERROR `test ` is not a valid identifier - | ^^^^^^^^^ + --> $DIR/route-path-bad-syntax.rs:83:19 + | +83 | #[get("/", data = "")] + | ^^^^^^^^^ error: parameters must be named --- help: use a name such as `_guard` or `_param` - --> $DIR/route-path-bad-syntax.rs:109:7 - | -109 | #[get("/<_>")] //~ ERROR must be named - | ^^^^^^ + --> $DIR/route-path-bad-syntax.rs:88:7 + | +88 | #[get("/<_>")] + | ^^^^^^ error: parameter names cannot be empty - --> $DIR/route-path-bad-syntax.rs:114:7 - | -114 | #[get("/<>")] //~ ERROR cannot be empty - | ^^^^^ + --> $DIR/route-path-bad-syntax.rs:93:7 + | +93 | #[get("/<>")] + | ^^^^^ error: malformed parameter or identifier --- help: parameters must be of the form '' --- help: identifiers cannot contain '<' or '>' - --> $DIR/route-path-bad-syntax.rs:117:7 - | -117 | #[get("/<")] //~ ERROR malformed parameter - | ^^^^^^^^ + --> $DIR/route-path-bad-syntax.rs:96:7 + | +96 | #[get("/<")] + | ^^^^^^^^ error: malformed parameter or identifier --- help: parameters must be of the form '' --- help: identifiers cannot contain '<' or '>' - --> $DIR/route-path-bad-syntax.rs:122:7 + --> $DIR/route-path-bad-syntax.rs:99:7 + | +99 | #[get("/<<<<")] + | ^^^^^^^^^^^ + +error: malformed parameter or identifier + --- help: parameters must be of the form '' + --- help: identifiers cannot contain '<' or '>' + --> $DIR/route-path-bad-syntax.rs:102:7 | -122 | #[get("/<<<<")] //~ ERROR malformed parameter - | ^^^^^^^^^^^ - -error: malformed parameter or identifier - --- help: parameters must be of the form '' - --- help: identifiers cannot contain '<' or '>' - --> $DIR/route-path-bad-syntax.rs:127:7 - | -127 | #[get("/<>name><")] //~ ERROR malformed parameter +102 | #[get("/<>name><")] | ^^^^^^^^^^^ diff --git a/core/codegen/tests/ui-fail-stable/route-type-errors.stderr b/core/codegen/tests/ui-fail-stable/route-type-errors.stderr index da6e9e8f..84e36115 100644 --- a/core/codegen/tests/ui-fail-stable/route-type-errors.stderr +++ b/core/codegen/tests/ui-fail-stable/route-type-errors.stderr @@ -1,37 +1,37 @@ error[E0277]: the trait bound `Q: rocket::request::FromParam<'_>` is not satisfied --> $DIR/route-type-errors.rs:6:12 | -6 | fn f0(foo: Q) {} //~ ERROR FromParam +6 | fn f0(foo: Q) {} | ^ the trait `rocket::request::FromParam<'_>` is not implemented for `Q` error[E0277]: the trait bound `Q: rocket::request::FromSegments<'_>` is not satisfied --> $DIR/route-type-errors.rs:9:12 | -9 | fn f1(foo: Q) {} //~ ERROR FromSegments +9 | fn f1(foo: Q) {} | ^ the trait `rocket::request::FromSegments<'_>` is not implemented for `Q` error[E0277]: the trait bound `Q: rocket::request::FromFormValue<'_>` is not satisfied --> $DIR/route-type-errors.rs:12:12 | -12 | fn f2(foo: Q) {} //~ ERROR FromFormValue +12 | fn f2(foo: Q) {} | ^ the trait `rocket::request::FromFormValue<'_>` is not implemented for `Q` error[E0277]: the trait bound `Q: rocket::request::FromFormValue<'_>` is not satisfied --> $DIR/route-type-errors.rs:12:7 | -12 | fn f2(foo: Q) {} //~ ERROR FromFormValue +12 | fn f2(foo: Q) {} | ^^^^^^ the trait `rocket::request::FromFormValue<'_>` is not implemented for `Q` error[E0277]: the trait bound `Q: rocket::request::FromQuery<'_>` is not satisfied --> $DIR/route-type-errors.rs:15:12 | -15 | fn f3(foo: Q) {} //~ ERROR FromQuery +15 | fn f3(foo: Q) {} | ^ the trait `rocket::request::FromQuery<'_>` is not implemented for `Q` error[E0277]: the trait bound `Q: rocket::data::FromData` is not satisfied --> $DIR/route-type-errors.rs:18:12 | -18 | fn f4(foo: Q) {} //~ ERROR FromData +18 | fn f4(foo: Q) {} | ^ the trait `rocket::data::FromData` is not implemented for `Q` | = note: required because of the requirements on the impl of `rocket::data::FromTransformedData<'_>` for `Q` @@ -49,19 +49,19 @@ error[E0277]: the trait bound `Q: rocket::request::FromParam<'_>` is not satisfi | ^ the trait `rocket::request::FromParam<'_>` is not implemented for `Q` error[E0277]: the trait bound `Q: rocket::request::FromRequest<'_, '_>` is not satisfied - --> $DIR/route-type-errors.rs:26:10 + --> $DIR/route-type-errors.rs:24:10 | -26 | fn f6(a: Q, foo: Q, good: usize, bar: Q) {} +24 | fn f6(a: Q, foo: Q, good: usize, bar: Q) {} | ^ the trait `rocket::request::FromRequest<'_, '_>` is not implemented for `Q` error[E0277]: the trait bound `Q: rocket::request::FromParam<'_>` is not satisfied - --> $DIR/route-type-errors.rs:26:18 + --> $DIR/route-type-errors.rs:24:18 | -26 | fn f6(a: Q, foo: Q, good: usize, bar: Q) {} +24 | fn f6(a: Q, foo: Q, good: usize, bar: Q) {} | ^ the trait `rocket::request::FromParam<'_>` is not implemented for `Q` error[E0277]: the trait bound `Q: rocket::request::FromParam<'_>` is not satisfied - --> $DIR/route-type-errors.rs:26:39 + --> $DIR/route-type-errors.rs:24:39 | -26 | fn f6(a: Q, foo: Q, good: usize, bar: Q) {} +24 | fn f6(a: Q, foo: Q, good: usize, bar: Q) {} | ^ the trait `rocket::request::FromParam<'_>` is not implemented for `Q` diff --git a/core/codegen/tests/ui-fail-stable/routes.stderr b/core/codegen/tests/ui-fail-stable/routes.stderr index cb39b641..4da81dbb 100644 --- a/core/codegen/tests/ui-fail-stable/routes.stderr +++ b/core/codegen/tests/ui-fail-stable/routes.stderr @@ -1,19 +1,19 @@ error: expected `,` --> $DIR/routes.rs:4:23 | -4 | let _ = routes![a b]; //~ ERROR expected `,` +4 | let _ = routes![a b]; | ^ error: expected identifier --> $DIR/routes.rs:6:24 | -6 | let _ = routes![a::, ]; //~ ERROR expected identifier +6 | let _ = routes![a::, ]; | ^ error: unexpected end of input, expected identifier --> $DIR/routes.rs:7:13 | -7 | let _ = routes![a::]; //~ ERROR expected identifier +7 | let _ = routes![a::]; | ^^^^^^^^^^^^ | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/core/codegen/tests/ui-fail-stable/typed-uri-bad-type.stderr b/core/codegen/tests/ui-fail-stable/typed-uri-bad-type.stderr index 98fcfb07..2da9bc8d 100644 --- a/core/codegen/tests/ui-fail-stable/typed-uri-bad-type.stderr +++ b/core/codegen/tests/ui-fail-stable/typed-uri-bad-type.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `usize: rocket::http::uri::FromUriParam` is not satisfied - --> $DIR/typed-uri-bad-type.rs:48:23 + --> $DIR/typed-uri-bad-type.rs:42:23 | -48 | uri!(simple: id = "hi"); +42 | uri!(simple: id = "hi"); | ^^^^ the trait `rocket::http::uri::FromUriParam` is not implemented for `usize` | = help: the following implementations were found: @@ -11,9 +11,9 @@ error[E0277]: the trait bound `usize: rocket::http::uri::FromUriParam` is not satisfied - --> $DIR/typed-uri-bad-type.rs:51:18 + --> $DIR/typed-uri-bad-type.rs:44:18 | -51 | uri!(simple: "hello"); +44 | uri!(simple: "hello"); | ^^^^^^^ the trait `rocket::http::uri::FromUriParam` is not implemented for `usize` | = help: the following implementations were found: @@ -23,9 +23,9 @@ error[E0277]: the trait bound `usize: rocket::http::uri::FromUriParam` is not satisfied - --> $DIR/typed-uri-bad-type.rs:54:23 + --> $DIR/typed-uri-bad-type.rs:46:23 | -54 | uri!(simple: id = 239239i64); +46 | uri!(simple: id = 239239i64); | ^^^^^^^^^ the trait `rocket::http::uri::FromUriParam` is not implemented for `usize` | = help: the following implementations were found: @@ -35,15 +35,15 @@ error[E0277]: the trait bound `usize: rocket::http::uri::FromUriParam` is not satisfied - --> $DIR/typed-uri-bad-type.rs:57:31 + --> $DIR/typed-uri-bad-type.rs:48:31 | -57 | uri!(not_uri_display: 10, S); +48 | uri!(not_uri_display: 10, S); | ^ the trait `rocket::http::uri::FromUriParam` is not implemented for `S` error[E0277]: the trait bound `i32: rocket::http::uri::FromUriParam>` is not satisfied - --> $DIR/typed-uri-bad-type.rs:63:26 + --> $DIR/typed-uri-bad-type.rs:53:26 | -63 | uri!(optionals: id = Some(10), name = Ok("bob".into())); +53 | uri!(optionals: id = Some(10), name = Ok("bob".into())); | ^^^^ the trait `rocket::http::uri::FromUriParam>` is not implemented for `i32` | = help: the following implementations were found: @@ -53,9 +53,9 @@ error[E0277]: the trait bound `i32: rocket::http::uri::FromUriParam>` for `std::option::Option` error[E0277]: the trait bound `std::string::String: rocket::http::uri::FromUriParam>` is not satisfied - --> $DIR/typed-uri-bad-type.rs:63:43 + --> $DIR/typed-uri-bad-type.rs:53:43 | -63 | uri!(optionals: id = Some(10), name = Ok("bob".into())); +53 | uri!(optionals: id = Some(10), name = Ok("bob".into())); | ^^ the trait `rocket::http::uri::FromUriParam>` is not implemented for `std::string::String` | = help: the following implementations were found: @@ -67,9 +67,9 @@ error[E0277]: the trait bound `std::string::String: rocket::http::uri::FromUriPa = note: required because of the requirements on the impl of `rocket::http::uri::FromUriParam>` for `std::result::Result` error[E0277]: the trait bound `isize: rocket::http::uri::FromUriParam` is not satisfied - --> $DIR/typed-uri-bad-type.rs:67:20 + --> $DIR/typed-uri-bad-type.rs:55:20 | -67 | uri!(simple_q: "hi"); +55 | uri!(simple_q: "hi"); | ^^^^ the trait `rocket::http::uri::FromUriParam` is not implemented for `isize` | = help: the following implementations were found: @@ -79,9 +79,9 @@ error[E0277]: the trait bound `isize: rocket::http::uri::FromUriParam` is not satisfied - --> $DIR/typed-uri-bad-type.rs:70:25 + --> $DIR/typed-uri-bad-type.rs:57:25 | -70 | uri!(simple_q: id = "hi"); +57 | uri!(simple_q: id = "hi"); | ^^^^ the trait `rocket::http::uri::FromUriParam` is not implemented for `isize` | = help: the following implementations were found: @@ -91,24 +91,24 @@ error[E0277]: the trait bound `isize: rocket::http::uri::FromUriParam` is not satisfied - --> $DIR/typed-uri-bad-type.rs:73:24 + --> $DIR/typed-uri-bad-type.rs:59:24 | -73 | uri!(other_q: 100, S); +59 | uri!(other_q: 100, S); | ^ the trait `rocket::http::uri::FromUriParam` is not implemented for `S` error[E0277]: the trait bound `S: rocket::http::uri::FromUriParam` is not satisfied - --> $DIR/typed-uri-bad-type.rs:76:26 + --> $DIR/typed-uri-bad-type.rs:61:26 | -76 | uri!(other_q: rest = S, id = 100); +61 | uri!(other_q: rest = S, id = 100); | ^ the trait `rocket::http::uri::FromUriParam` is not implemented for `S` error[E0277]: the trait bound `S: rocket::http::uri::Ignorable` is not satisfied - --> $DIR/typed-uri-bad-type.rs:40:29 + --> $DIR/typed-uri-bad-type.rs:36:29 | -40 | fn other_q(id: usize, rest: S) { } +36 | fn other_q(id: usize, rest: S) { } | ^ the trait `rocket::http::uri::Ignorable` is not implemented for `S` ... -79 | uri!(other_q: rest = _, id = 100); +63 | uri!(other_q: rest = _, id = 100); | ---------------------------------- in this macro invocation | ::: $WORKSPACE/core/http/src/uri/uri_display.rs:465:40 @@ -119,12 +119,12 @@ error[E0277]: the trait bound `S: rocket::http::uri::Ignorable` is not satisfied - --> $DIR/typed-uri-bad-type.rs:40:16 + --> $DIR/typed-uri-bad-type.rs:36:16 | -40 | fn other_q(id: usize, rest: S) { } +36 | fn other_q(id: usize, rest: S) { } | ^^^^^ the trait `rocket::http::uri::Ignorable` is not implemented for `usize` ... -81 | uri!(other_q: rest = S, id = _); +65 | uri!(other_q: rest = S, id = _); | -------------------------------- in this macro invocation | ::: $WORKSPACE/core/http/src/uri/uri_display.rs:465:40 @@ -135,7 +135,7 @@ error[E0277]: the trait bound `usize: rocket::http::uri::Ignorable` is not satisfied - --> $DIR/typed-uri-bad-type.rs:81:26 + --> $DIR/typed-uri-bad-type.rs:65:26 | -81 | uri!(other_q: rest = S, id = _); +65 | uri!(other_q: rest = S, id = _); | ^ the trait `rocket::http::uri::FromUriParam` is not implemented for `S` diff --git a/core/codegen/tests/ui-fail-stable/typed-uris-bad-params.stderr b/core/codegen/tests/ui-fail-stable/typed-uris-bad-params.stderr index 6c36fd08..0d00572f 100644 --- a/core/codegen/tests/ui-fail-stable/typed-uris-bad-params.stderr +++ b/core/codegen/tests/ui-fail-stable/typed-uris-bad-params.stderr @@ -1,313 +1,233 @@ error: path parameters cannot be ignored - --> $DIR/typed-uris-bad-params.rs:77:37 + --> $DIR/typed-uris-bad-params.rs:55:37 | -77 | uri!(optionals: id = 10, name = _); +55 | uri!(optionals: id = 10, name = _); | ^ error: path parameters cannot be ignored - --> $DIR/typed-uris-bad-params.rs:74:26 + --> $DIR/typed-uris-bad-params.rs:53:26 | -74 | uri!(optionals: id = _, name = "bob".into()); +53 | uri!(optionals: id = _, name = "bob".into()); | ^ -error: macro expansion ignores token `compile_error` and any following - --> $DIR/typed-uris-bad-params.rs:70:29 +error: invalid parameters for `has_two` route uri + --- note: uri parameters are: id: i32, name: String + --- help: missing parameter: `name` + --> $DIR/typed-uris-bad-params.rs:51:19 | -13 | #[post("/?")] - | ------------------------ help: you might be missing a semicolon here: `;` - | | - | caused by the macro expansion here -... -70 | uri!(has_two: id = 100, cookies = "hi"); //~ ERROR invalid parameters +51 | uri!(has_two: id = 100, cookies = "hi"); + | ^^ + +error: [help] unknown parameter: `cookies` + --> $DIR/typed-uris-bad-params.rs:51:29 + | +51 | uri!(has_two: id = 100, cookies = "hi"); | ^^^^^^^ - | - = note: the usage of `rocket::rocket_internal_uri!` is likely invalid in expression context error: invalid parameters for `has_two` route uri --- note: uri parameters are: id: i32, name: String --- help: missing parameter: `name` - --> $DIR/typed-uris-bad-params.rs:70:19 + --> $DIR/typed-uris-bad-params.rs:49:19 | -70 | uri!(has_two: id = 100, cookies = "hi"); //~ ERROR invalid parameters - | ^^ - -error: macro expansion ignores token `compile_error` and any following - --> $DIR/typed-uris-bad-params.rs:65:19 - | -13 | #[post("/?")] - | ------------------------ help: you might be missing a semicolon here: `;` - | | - | caused by the macro expansion here -... -65 | uri!(has_two: cookies = "hi", id = 100, id = 10, id = 10); //~ ERROR invalid parameters +49 | uri!(has_two: cookies = "hi", id = 100, id = 10, id = 10); | ^^^^^^^ - | - = note: the usage of `rocket::rocket_internal_uri!` is likely invalid in expression context -error: invalid parameters for `has_two` route uri - --- note: uri parameters are: id: i32, name: String - --- help: missing parameter: `name` - --> $DIR/typed-uris-bad-params.rs:65:19 +error: [help] unknown parameter: `cookies` + --> $DIR/typed-uris-bad-params.rs:49:19 | -65 | uri!(has_two: cookies = "hi", id = 100, id = 10, id = 10); //~ ERROR invalid parameters +49 | uri!(has_two: cookies = "hi", id = 100, id = 10, id = 10); | ^^^^^^^ +error: [help] duplicate parameter: `id` + --> $DIR/typed-uris-bad-params.rs:49:45 + | +49 | uri!(has_two: cookies = "hi", id = 100, id = 10, id = 10); + | ^^ + error: invalid parameters for `has_two` route uri --- note: uri parameters are: id: i32, name: String --- help: missing parameter: `id` - --> $DIR/typed-uris-bad-params.rs:62:19 + --> $DIR/typed-uris-bad-params.rs:47:19 | -62 | uri!(has_two: name = "hi"); //~ ERROR invalid parameters +47 | uri!(has_two: name = "hi"); | ^^^^ -error: macro expansion ignores token `compile_error` and any following - --> $DIR/typed-uris-bad-params.rs:58:29 - | -13 | #[post("/?")] - | ------------------------ help: you might be missing a semicolon here: `;` - | | - | caused by the macro expansion here -... -58 | uri!(has_two: id = 100, id = 100, ); //~ ERROR invalid parameters - | ^^ - | - = note: the usage of `rocket::rocket_internal_uri!` is likely invalid in expression context - error: invalid parameters for `has_two` route uri --- note: uri parameters are: id: i32, name: String --- help: missing parameter: `name` - --> $DIR/typed-uris-bad-params.rs:58:19 - | -58 | uri!(has_two: id = 100, id = 100, ); //~ ERROR invalid parameters - | ^^ - -error: macro expansion ignores token `compile_error` and any following - --> $DIR/typed-uris-bad-params.rs:55:37 - | -10 | #[post("/")] - | ----------------- help: you might be missing a semicolon here: `;` - | | - | caused by the macro expansion here -... -55 | uri!(has_one_guarded: id = 100, cookies = "hi"); //~ ERROR invalid parameters - | ^^^^^^^ - | - = note: the usage of `rocket::rocket_internal_uri!` is likely invalid in expression context - -error: invalid parameters for `has_one_guarded` route uri - --- note: uri parameters are: id: i32 - --> $DIR/typed-uris-bad-params.rs:55:27 - | -55 | uri!(has_one_guarded: id = 100, cookies = "hi"); //~ ERROR invalid parameters - | ^^ - -error: macro expansion ignores token `compile_error` and any following - --> $DIR/typed-uris-bad-params.rs:52:27 - | -10 | #[post("/")] - | ----------------- help: you might be missing a semicolon here: `;` - | | - | caused by the macro expansion here -... -52 | uri!(has_one_guarded: cookies = "hi", id = 100); //~ ERROR invalid parameters - | ^^^^^^^ - | - = note: the usage of `rocket::rocket_internal_uri!` is likely invalid in expression context - -error: invalid parameters for `has_one_guarded` route uri - --- note: uri parameters are: id: i32 - --> $DIR/typed-uris-bad-params.rs:52:27 - | -52 | uri!(has_one_guarded: cookies = "hi", id = 100); //~ ERROR invalid parameters - | ^^^^^^^ - -error: macro expansion ignores token `compile_error` and any following - --> $DIR/typed-uris-bad-params.rs:48:19 - | -7 | #[post("/")] - | ----------------- help: you might be missing a semicolon here: `;` - | | - | caused by the macro expansion here -... -48 | uri!(has_one: name = "hi"); //~ ERROR invalid parameters - | ^^^^ - | - = note: the usage of `rocket::rocket_internal_uri!` is likely invalid in expression context - -error: invalid parameters for `has_one` route uri - --- note: uri parameters are: id: i32 - --- help: missing parameter: `id` - --> $DIR/typed-uris-bad-params.rs:48:19 - | -48 | uri!(has_one: name = "hi"); //~ ERROR invalid parameters - | ^^^^ - -error: macro expansion ignores token `compile_error` and any following - --> $DIR/typed-uris-bad-params.rs:45:29 - | -7 | #[post("/")] - | ----------------- help: you might be missing a semicolon here: `;` - | | - | caused by the macro expansion here -... -45 | uri!(has_one: id = 100, id = 100, ); //~ ERROR invalid parameters - | ^^ - | - = note: the usage of `rocket::rocket_internal_uri!` is likely invalid in expression context - -error: invalid parameters for `has_one` route uri - --- note: uri parameters are: id: i32 --> $DIR/typed-uris-bad-params.rs:45:19 | -45 | uri!(has_one: id = 100, id = 100, ); //~ ERROR invalid parameters +45 | uri!(has_two: id = 100, id = 100, ); | ^^ -error: macro expansion ignores token `compile_error` and any following - --> $DIR/typed-uris-bad-params.rs:42:29 +error: [help] duplicate parameter: `id` + --> $DIR/typed-uris-bad-params.rs:45:29 | -7 | #[post("/")] - | ----------------- help: you might be missing a semicolon here: `;` - | | - | caused by the macro expansion here -... -42 | uri!(has_one: id = 100, id = 100); //~ ERROR invalid parameters +45 | uri!(has_two: id = 100, id = 100, ); | ^^ + +error: invalid parameters for `has_one_guarded` route uri + --- note: uri parameters are: id: i32 + --> $DIR/typed-uris-bad-params.rs:43:27 | - = note: the usage of `rocket::rocket_internal_uri!` is likely invalid in expression context +43 | uri!(has_one_guarded: id = 100, cookies = "hi"); + | ^^ + +error: [help] unknown parameter: `cookies` + --> $DIR/typed-uris-bad-params.rs:43:37 + | +43 | uri!(has_one_guarded: id = 100, cookies = "hi"); + | ^^^^^^^ + +error: invalid parameters for `has_one_guarded` route uri + --- note: uri parameters are: id: i32 + --> $DIR/typed-uris-bad-params.rs:41:27 + | +41 | uri!(has_one_guarded: cookies = "hi", id = 100); + | ^^^^^^^ + +error: [help] unknown parameter: `cookies` + --> $DIR/typed-uris-bad-params.rs:41:27 + | +41 | uri!(has_one_guarded: cookies = "hi", id = 100); + | ^^^^^^^ error: invalid parameters for `has_one` route uri --- note: uri parameters are: id: i32 - --> $DIR/typed-uris-bad-params.rs:42:19 + --- help: missing parameter: `id` + --> $DIR/typed-uris-bad-params.rs:39:19 | -42 | uri!(has_one: id = 100, id = 100); //~ ERROR invalid parameters +39 | uri!(has_one: name = "hi"); + | ^^^^ + +error: [help] unknown parameter: `name` + --> $DIR/typed-uris-bad-params.rs:39:19 + | +39 | uri!(has_one: name = "hi"); + | ^^^^ + +error: invalid parameters for `has_one` route uri + --- note: uri parameters are: id: i32 + --> $DIR/typed-uris-bad-params.rs:37:19 + | +37 | uri!(has_one: id = 100, id = 100, ); | ^^ -error: macro expansion ignores token `compile_error` and any following - --> $DIR/typed-uris-bad-params.rs:38:19 +error: [help] duplicate parameter: `id` + --> $DIR/typed-uris-bad-params.rs:37:29 | -7 | #[post("/")] - | ----------------- help: you might be missing a semicolon here: `;` - | | - | caused by the macro expansion here -... -38 | uri!(has_one: name = 100, age = 50, id = 100, id = 50); //~ ERROR invalid parameters - | ^^^^ - | - = note: the usage of `rocket::rocket_internal_uri!` is likely invalid in expression context - -error: invalid parameters for `has_one` route uri - --- note: uri parameters are: id: i32 - --> $DIR/typed-uris-bad-params.rs:38:19 - | -38 | uri!(has_one: name = 100, age = 50, id = 100, id = 50); //~ ERROR invalid parameters - | ^^^^ - -error: macro expansion ignores token `compile_error` and any following - --> $DIR/typed-uris-bad-params.rs:35:19 - | -7 | #[post("/")] - | ----------------- help: you might be missing a semicolon here: `;` - | | - | caused by the macro expansion here -... -35 | uri!(has_one: name = 100, age = 50, id = 100); //~ ERROR invalid parameters - | ^^^^ - | - = note: the usage of `rocket::rocket_internal_uri!` is likely invalid in expression context +37 | uri!(has_one: id = 100, id = 100, ); + | ^^ error: invalid parameters for `has_one` route uri --- note: uri parameters are: id: i32 --> $DIR/typed-uris-bad-params.rs:35:19 | -35 | uri!(has_one: name = 100, age = 50, id = 100); //~ ERROR invalid parameters - | ^^^^ +35 | uri!(has_one: id = 100, id = 100); + | ^^ -error: macro expansion ignores token `compile_error` and any following - --> $DIR/typed-uris-bad-params.rs:32:19 +error: [help] duplicate parameter: `id` + --> $DIR/typed-uris-bad-params.rs:35:29 | -7 | #[post("/")] - | ----------------- help: you might be missing a semicolon here: `;` - | | - | caused by the macro expansion here -... -32 | uri!(has_one: name = 100, id = 100); //~ ERROR invalid parameters - | ^^^^ - | - = note: the usage of `rocket::rocket_internal_uri!` is likely invalid in expression context +35 | uri!(has_one: id = 100, id = 100); + | ^^ error: invalid parameters for `has_one` route uri --- note: uri parameters are: id: i32 - --> $DIR/typed-uris-bad-params.rs:32:19 + --> $DIR/typed-uris-bad-params.rs:33:19 | -32 | uri!(has_one: name = 100, id = 100); //~ ERROR invalid parameters +33 | uri!(has_one: name = 100, age = 50, id = 100, id = 50); | ^^^^ -error: macro expansion ignores token `compile_error` and any following - --> $DIR/typed-uris-bad-params.rs:29:29 +error: [help] unknown parameters: `name`, `age` + --> $DIR/typed-uris-bad-params.rs:33:19 | -7 | #[post("/")] - | ----------------- help: you might be missing a semicolon here: `;` - | | - | caused by the macro expansion here -... -29 | uri!(has_one: id = 100, name = "hi"); //~ ERROR invalid parameters - | ^^^^ +33 | uri!(has_one: name = 100, age = 50, id = 100, id = 50); + | ^^^^ + +error: [help] duplicate parameter: `id` + --> $DIR/typed-uris-bad-params.rs:33:51 | - = note: the usage of `rocket::rocket_internal_uri!` is likely invalid in expression context +33 | uri!(has_one: name = 100, age = 50, id = 100, id = 50); + | ^^ + +error: invalid parameters for `has_one` route uri + --- note: uri parameters are: id: i32 + --> $DIR/typed-uris-bad-params.rs:31:19 + | +31 | uri!(has_one: name = 100, age = 50, id = 100); + | ^^^^ + +error: [help] unknown parameters: `name`, `age` + --> $DIR/typed-uris-bad-params.rs:31:19 + | +31 | uri!(has_one: name = 100, age = 50, id = 100); + | ^^^^ error: invalid parameters for `has_one` route uri --- note: uri parameters are: id: i32 --> $DIR/typed-uris-bad-params.rs:29:19 | -29 | uri!(has_one: id = 100, name = "hi"); //~ ERROR invalid parameters +29 | uri!(has_one: name = 100, id = 100); + | ^^^^ + +error: [help] unknown parameter: `name` + --> $DIR/typed-uris-bad-params.rs:29:19 + | +29 | uri!(has_one: name = 100, id = 100); + | ^^^^ + +error: invalid parameters for `has_one` route uri + --- note: uri parameters are: id: i32 + --> $DIR/typed-uris-bad-params.rs:27:19 + | +27 | uri!(has_one: id = 100, name = "hi"); | ^^ +error: [help] unknown parameter: `name` + --> $DIR/typed-uris-bad-params.rs:27:29 + | +27 | uri!(has_one: id = 100, name = "hi"); + | ^^^^ + error: `has_two` route uri expects 2 parameters but 1 was supplied --- note: expected parameters: id: i32, name: String - --> $DIR/typed-uris-bad-params.rs:27:19 + --> $DIR/typed-uris-bad-params.rs:25:19 | -27 | uri!(has_two: 10); //~ ERROR expects 2 parameters but 1 +25 | uri!(has_two: 10); | ^^ error: `has_two` route uri expects 2 parameters but 3 were supplied --- note: expected parameters: id: i32, name: String - --> $DIR/typed-uris-bad-params.rs:26:19 + --> $DIR/typed-uris-bad-params.rs:24:19 | -26 | uri!(has_two: 10, "hi", "there"); //~ ERROR expects 2 parameters but 3 +24 | uri!(has_two: 10, "hi", "there"); | ^^ error: `has_one_guarded` route uri expects 1 parameter but 2 were supplied --- note: expected parameter: id: i32 - --> $DIR/typed-uris-bad-params.rs:24:27 + --> $DIR/typed-uris-bad-params.rs:22:27 | -24 | uri!(has_one_guarded: "hi", 100); //~ ERROR expects 1 parameter but 2 +22 | uri!(has_one_guarded: "hi", 100); | ^^^^ error: `has_one` route uri expects 1 parameter but 2 were supplied --- note: expected parameter: id: i32 - --> $DIR/typed-uris-bad-params.rs:23:19 + --> $DIR/typed-uris-bad-params.rs:21:19 | -23 | uri!(has_one: "Hello", 23, ); //~ ERROR expects 1 parameter but 2 +21 | uri!(has_one: "Hello", 23, ); | ^^^^^^^ error: `has_one` route uri expects 1 parameter but 2 were supplied --- note: expected parameter: id: i32 - --> $DIR/typed-uris-bad-params.rs:22:19 + --> $DIR/typed-uris-bad-params.rs:20:19 | -22 | uri!(has_one: 1, 23); //~ ERROR expects 1 parameter but 2 +20 | uri!(has_one: 1, 23); | ^ error: `has_one` route uri expects 1 parameter but 0 were supplied --- note: expected parameter: id: i32 - --> $DIR/typed-uris-bad-params.rs:20:10 + --> $DIR/typed-uris-bad-params.rs:18:10 | -20 | uri!(has_one); //~ ERROR expects 1 parameter but 0 +18 | uri!(has_one); | ^^^^^^^ - -warning: unused import: `std::fmt` - --> $DIR/typed-uris-bad-params.rs:3:5 - | -3 | use std::fmt; - | ^^^^^^^^ - | - = note: `#[warn(unused_imports)]` on by default diff --git a/core/codegen/tests/ui-fail-stable/typed-uris-invalid-syntax.stderr b/core/codegen/tests/ui-fail-stable/typed-uris-invalid-syntax.stderr index 699c156b..a024d086 100644 --- a/core/codegen/tests/ui-fail-stable/typed-uris-invalid-syntax.stderr +++ b/core/codegen/tests/ui-fail-stable/typed-uris-invalid-syntax.stderr @@ -1,37 +1,37 @@ error: named and unnamed parameters cannot be mixed --> $DIR/typed-uris-invalid-syntax.rs:7:18 | -7 | uri!(simple: id = 100, "Hello"); //~ ERROR named and unnamed +7 | uri!(simple: id = 100, "Hello"); | ^^ error: named and unnamed parameters cannot be mixed --> $DIR/typed-uris-invalid-syntax.rs:8:18 | -8 | uri!(simple: "Hello", id = 100); //~ ERROR named and unnamed +8 | uri!(simple: "Hello", id = 100); | ^^^^^^^ error: expected `:` --> $DIR/typed-uris-invalid-syntax.rs:9:16 | -9 | uri!(simple,); //~ ERROR expected `:` +9 | uri!(simple,); | ^ error: expected argument list after `:` --> $DIR/typed-uris-invalid-syntax.rs:10:16 | -10 | uri!(simple:); //~ ERROR argument list +10 | uri!(simple:); | ^ error: unexpected end of input: expected ',' followed by route path --> $DIR/typed-uris-invalid-syntax.rs:11:10 | -11 | uri!("/mount"); //~ ERROR route path +11 | uri!("/mount"); | ^^^^^^^^ error: unexpected end of input, expected identifier --> $DIR/typed-uris-invalid-syntax.rs:12:5 | -12 | uri!("/mount",); //~ ERROR expected identifier +12 | uri!("/mount",); | ^^^^^^^^^^^^^^^^ | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) @@ -39,19 +39,19 @@ error: unexpected end of input, expected identifier error: invalid mount point; mount points must be static, absolute URIs: `/example` --> $DIR/typed-uris-invalid-syntax.rs:13:10 | -13 | uri!("mount", simple); //~ invalid mount point +13 | uri!("mount", simple); | ^^^^^^^ error: invalid mount point; mount points must be static, absolute URIs: `/example` --> $DIR/typed-uris-invalid-syntax.rs:14:10 | -14 | uri!("/mount/", simple); //~ invalid mount point +14 | uri!("/mount/", simple); | ^^^^^^^^^^^^^ error: unexpected end of input, call to `uri!` cannot be empty --> $DIR/typed-uris-invalid-syntax.rs:15:5 | -15 | uri!(); //~ unexpected end of input +15 | uri!(); | ^^^^^^^ | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) @@ -59,7 +59,7 @@ error: unexpected end of input, call to `uri!` cannot be empty error: unexpected end of input, expected expression --> $DIR/typed-uris-invalid-syntax.rs:16:5 | -16 | uri!(simple: id = ); //~ expected expression +16 | uri!(simple: id = ); | ^^^^^^^^^^^^^^^^^^^^ | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/core/codegen/tests/ui-fail-stable/uri_display.stderr b/core/codegen/tests/ui-fail-stable/uri_display.stderr index 2bb20691..b0730b4d 100644 --- a/core/codegen/tests/ui-fail-stable/uri_display.stderr +++ b/core/codegen/tests/ui-fail-stable/uri_display.stderr @@ -1,22 +1,50 @@ error: fieldless structs or variants are not supported - --> $DIR/uri_display.rs:9:1 + --> $DIR/uri_display.rs:4:8 | -9 | struct Foo1; - | ^^^^^^ +4 | struct Foo1; + | ^^^^ error: [note] error occurred while deriving `UriDisplay` - --> $DIR/uri_display.rs:5:10 + --> $DIR/uri_display.rs:3:10 | -5 | #[derive(UriDisplayQuery)] +3 | #[derive(UriDisplayQuery)] | ^^^^^^^^^^^^^^^ | = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: fieldless structs or variants are not supported - --> $DIR/uri_display.rs:16:1 + --> $DIR/uri_display.rs:7:8 + | +7 | struct Foo2(); + | ^^^^ + +error: [note] error occurred while deriving `UriDisplay` + --> $DIR/uri_display.rs:6:10 + | +6 | #[derive(UriDisplayQuery)] + | ^^^^^^^^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: empty enums are not supported + --> $DIR/uri_display.rs:10:11 | -16 | struct Foo2(); - | ^^^^^^ +10 | enum Foo3 { } + | ^^^ + +error: [note] error occurred while deriving `UriDisplay` + --> $DIR/uri_display.rs:9:10 + | +9 | #[derive(UriDisplayQuery)] + | ^^^^^^^^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: fieldless structs or variants are not supported + --> $DIR/uri_display.rs:14:5 + | +14 | Variant, + | ^^^^^^^ error: [note] error occurred while deriving `UriDisplay` --> $DIR/uri_display.rs:12:10 @@ -26,468 +54,86 @@ error: [note] error occurred while deriving `UriDisplay` | = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) -error: empty enums are not supported - --> $DIR/uri_display.rs:23:1 - | -23 | enum Foo3 { } - | ^^^^ - -error: [note] error occurred while deriving `UriDisplay` - --> $DIR/uri_display.rs:19:10 - | -19 | #[derive(UriDisplayQuery)] - | ^^^^^^^^^^^^^^^ - | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error: fieldless structs or variants are not supported - --> $DIR/uri_display.rs:31:5 - | -31 | Variant, - | ^^^^^^^ - -error: [note] error occurred while deriving `UriDisplay` - --> $DIR/uri_display.rs:26:10 - | -26 | #[derive(UriDisplayQuery)] - | ^^^^^^^^^^^^^^^ - | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - error: tuple structs or variants must have exactly one field - --> $DIR/uri_display.rs:39:13 + --> $DIR/uri_display.rs:18:12 | -39 | struct Foo5(String, String); - | ^^^^^^ +18 | struct Foo5(String, String); + | ^^^^^^^^^^^^^^^^ error: [note] error occurred while deriving `UriDisplay` - --> $DIR/uri_display.rs:35:10 + --> $DIR/uri_display.rs:17:10 | -35 | #[derive(UriDisplayQuery)] +17 | #[derive(UriDisplayQuery)] | ^^^^^^^^^^^^^^^ | = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: invalid value: expected string literal - --> $DIR/uri_display.rs:47:20 + --> $DIR/uri_display.rs:22:20 | -47 | #[form(field = 123)] +22 | #[form(field = 123)] | ^^^ error: [note] error occurred while deriving `UriDisplay` - --> $DIR/uri_display.rs:42:10 + --> $DIR/uri_display.rs:20:10 | -42 | #[derive(UriDisplayQuery)] +20 | #[derive(UriDisplayQuery)] | ^^^^^^^^^^^^^^^ | = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: struct must have exactly one field - --> $DIR/uri_display.rs:55:13 + --> $DIR/uri_display.rs:27:12 | -55 | struct Foo7(String, usize); - | ^^^^^^ +27 | struct Foo7(String, usize); + | ^^^^^^^^^^^^^^^ error: [note] error occurred while deriving `UriDisplay` - --> $DIR/uri_display.rs:52:10 + --> $DIR/uri_display.rs:26:10 | -52 | #[derive(UriDisplayPath)] +26 | #[derive(UriDisplayPath)] | ^^^^^^^^^^^^^^ | = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: struct must have exactly one field - --> $DIR/uri_display.rs:61:1 + --> $DIR/uri_display.rs:30:8 | -61 | struct Foo8; - | ^^^^^^ +30 | struct Foo8; + | ^^^^ error: [note] error occurred while deriving `UriDisplay` - --> $DIR/uri_display.rs:58:10 + --> $DIR/uri_display.rs:29:10 | -58 | #[derive(UriDisplayPath)] +29 | #[derive(UriDisplayPath)] | ^^^^^^^^^^^^^^ | = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: enums are not supported - --> $DIR/uri_display.rs:67:1 + --> $DIR/uri_display.rs:33:1 | -67 | enum Foo9 { } +33 | enum Foo9 { } | ^^^^ error: [note] error occurred while deriving `UriDisplay` - --> $DIR/uri_display.rs:64:10 + --> $DIR/uri_display.rs:32:10 | -64 | #[derive(UriDisplayPath)] +32 | #[derive(UriDisplayPath)] | ^^^^^^^^^^^^^^ | = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: named structs are not supported - --> $DIR/uri_display.rs:73:1 + --> $DIR/uri_display.rs:36:1 | -73 | struct Foo10 { +36 | struct Foo10 { | ^^^^^^ error: [note] error occurred while deriving `UriDisplay` - --> $DIR/uri_display.rs:70:10 + --> $DIR/uri_display.rs:35:10 | -70 | #[derive(UriDisplayPath)] +35 | #[derive(UriDisplayPath)] | ^^^^^^^^^^^^^^ | = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo1: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:5:10 - | -5 | #[derive(UriDisplayQuery)] - | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo1` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo1: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:5:10 - | -5 | #[derive(UriDisplayQuery)] - | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo1` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&Foo1` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo1: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:5:10 - | -5 | #[derive(UriDisplayQuery)] - | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo1` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&mut Foo1` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo2: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:12:10 - | -12 | #[derive(UriDisplayQuery)] - | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo2` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo2: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:12:10 - | -12 | #[derive(UriDisplayQuery)] - | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo2` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&Foo2` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo2: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:12:10 - | -12 | #[derive(UriDisplayQuery)] - | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo2` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&mut Foo2` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo3: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:19:10 - | -19 | #[derive(UriDisplayQuery)] - | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo3` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo3: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:19:10 - | -19 | #[derive(UriDisplayQuery)] - | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo3` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&Foo3` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo3: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:19:10 - | -19 | #[derive(UriDisplayQuery)] - | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo3` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&mut Foo3` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo4: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:26:10 - | -26 | #[derive(UriDisplayQuery)] - | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo4` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo4: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:26:10 - | -26 | #[derive(UriDisplayQuery)] - | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo4` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&Foo4` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo4: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:26:10 - | -26 | #[derive(UriDisplayQuery)] - | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo4` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&mut Foo4` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo5: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:35:10 - | -35 | #[derive(UriDisplayQuery)] - | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo5` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo5: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:35:10 - | -35 | #[derive(UriDisplayQuery)] - | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo5` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&Foo5` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo5: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:35:10 - | -35 | #[derive(UriDisplayQuery)] - | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo5` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&mut Foo5` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo6: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:42:10 - | -42 | #[derive(UriDisplayQuery)] - | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo6` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo6: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:42:10 - | -42 | #[derive(UriDisplayQuery)] - | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo6` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&Foo6` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo6: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:42:10 - | -42 | #[derive(UriDisplayQuery)] - | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo6` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&mut Foo6` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo7: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:52:10 - | -52 | #[derive(UriDisplayPath)] - | ^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo7` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo7: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:52:10 - | -52 | #[derive(UriDisplayPath)] - | ^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo7` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&Foo7` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo8: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:58:10 - | -58 | #[derive(UriDisplayPath)] - | ^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo8` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo8: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:58:10 - | -58 | #[derive(UriDisplayPath)] - | ^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo8` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&Foo8` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo9: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:64:10 - | -64 | #[derive(UriDisplayPath)] - | ^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo9` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo9: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:64:10 - | -64 | #[derive(UriDisplayPath)] - | ^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo9` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&Foo9` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo10: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:70:10 - | -70 | #[derive(UriDisplayPath)] - | ^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo10` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `Foo10: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display.rs:70:10 - | -70 | #[derive(UriDisplayPath)] - | ^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo10` - | - ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 - | -195 | type Target: UriDisplay

; - | ------------- required by this bound in `rocket::http::uri::FromUriParam` - | - = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&Foo10` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/core/codegen/tests/ui-fail-stable/uri_display_type_errors.stderr b/core/codegen/tests/ui-fail-stable/uri_display_type_errors.stderr index 2029cdda..51885761 100644 --- a/core/codegen/tests/ui-fail-stable/uri_display_type_errors.stderr +++ b/core/codegen/tests/ui-fail-stable/uri_display_type_errors.stderr @@ -7,52 +7,52 @@ error[E0277]: the trait bound `BadType: rocket::http::uri::UriDisplay` for `&BadType` error[E0277]: the trait bound `BadType: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display_type_errors.rs:11:5 + --> $DIR/uri_display_type_errors.rs:10:5 | -11 | field: BadType, +10 | field: BadType, | ^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `BadType` | = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&BadType` error[E0277]: the trait bound `BadType: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display_type_errors.rs:18:5 + --> $DIR/uri_display_type_errors.rs:16:5 | -18 | bad: BadType, +16 | bad: BadType, | ^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `BadType` | = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&BadType` error[E0277]: the trait bound `BadType: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display_type_errors.rs:24:11 + --> $DIR/uri_display_type_errors.rs:21:11 | -24 | Inner(BadType), +21 | Inner(BadType), | ^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `BadType` | = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&BadType` = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&&BadType` error[E0277]: the trait bound `BadType: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display_type_errors.rs:31:9 + --> $DIR/uri_display_type_errors.rs:27:9 | -31 | field: BadType, +27 | field: BadType, | ^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `BadType` | = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&BadType` = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&&BadType` error[E0277]: the trait bound `BadType: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display_type_errors.rs:40:9 + --> $DIR/uri_display_type_errors.rs:35:9 | -40 | other: BadType, +35 | other: BadType, | ^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `BadType` | = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&BadType` = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&&BadType` error[E0277]: the trait bound `BadType: rocket::http::uri::UriDisplay` is not satisfied - --> $DIR/uri_display_type_errors.rs:46:12 + --> $DIR/uri_display_type_errors.rs:40:12 | -46 | struct Baz(BadType); +40 | struct Baz(BadType); | ^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `BadType` | = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&BadType` diff --git a/core/codegen/tests/ui-fail/async-entry.rs b/core/codegen/tests/ui-fail/async-entry.rs index 8f6de514..40e39362 100644 --- a/core/codegen/tests/ui-fail/async-entry.rs +++ b/core/codegen/tests/ui-fail/async-entry.rs @@ -5,19 +5,18 @@ mod main_a { #[rocket::main] fn foo() { } - //~^^ ERROR `async` + } mod main_b { #[rocket::main] async fn foo() { } - //~^^ WARNING `main` + } mod main_d { #[rocket::main] fn main() { - //~^^ ERROR `async` let _ = rocket::ignite().launch().await; } } @@ -25,7 +24,7 @@ mod main_d { mod main_f { #[rocket::main] async fn main() { - //~^ ERROR mismatched types + rocket::ignite() } } @@ -35,10 +34,9 @@ mod main_f { mod launch_a { #[rocket::launch] async fn rocket() -> String { - //~^ ERROR mismatched types let _ = rocket::ignite().launch().await; rocket::ignite() - //~^ ERROR mismatched types + } } @@ -47,14 +45,12 @@ mod launch_b { async fn rocket() -> rocket::Rocket { let _ = rocket::ignite().launch().await; "hi".to_string() - //~^ ERROR mismatched types } } mod launch_c { #[rocket::launch] fn main() -> rocket::Rocket { - //~^^ ERROR `main` rocket::ignite() } } @@ -62,7 +58,6 @@ mod launch_c { mod launch_d { #[rocket::launch] async fn rocket() { - //~^^ ERROR functions that return let _ = rocket::ignite().launch().await; rocket::ignite() } @@ -71,7 +66,6 @@ mod launch_d { mod launch_e { #[rocket::launch] fn rocket() { - //~^^ ERROR functions that return rocket::ignite() } } @@ -80,7 +74,6 @@ mod launch_f { #[rocket::launch] fn rocket() -> rocket::Rocket { let _ = rocket::ignite().launch().await; - //~^ ERROR only allowed inside `async` rocket::ignite() } } @@ -88,7 +81,6 @@ mod launch_f { mod launch_g { #[rocket::launch] fn main() -> &'static str { - //~^^ ERROR `main` let _ = rocket::ignite().launch().await; "hi" } @@ -97,13 +89,11 @@ mod launch_g { mod launch_h { #[rocket::launch] async fn main() -> rocket::Rocket { - //~^^ ERROR `main` rocket::ignite() } } #[rocket::main] async fn main() -> rocket::Rocket { - //~^ ERROR invalid return type rocket::ignite() } diff --git a/core/codegen/tests/ui-fail/catch.rs b/core/codegen/tests/ui-fail/catch.rs index 61664c73..e4a38d19 100644 --- a/core/codegen/tests/ui-fail/catch.rs +++ b/core/codegen/tests/ui-fail/catch.rs @@ -4,42 +4,29 @@ use rocket::Request; #[catch(404)] struct Catcher(String); -//~^ ERROR expected `fn` -//~^^ HELP on functions #[catch(404)] const CATCH: &str = "Catcher"; -//~^ ERROR expected `fn` -//~^^ HELP on functions -#[catch("404")] //~ ERROR expected unsigned integer literal -//~^ HELP #[catch(404)] +#[catch("404")] fn e1(_request: &Request) { } -#[catch(code = "404")] //~ ERROR unexpected keyed parameter -//~^ HELP #[catch(404)] +#[catch(code = "404")] fn e2(_request: &Request) { } -#[catch(code = 404)] //~ ERROR unexpected keyed parameter -//~^ HELP #[catch(404)] +#[catch(code = 404)] fn e3(_request: &Request) { } -#[catch(99)] //~ ERROR in range [100, 599] -//~^ HELP #[catch(404)] +#[catch(99)] fn e4(_request: &Request) { } -#[catch(600)] //~ ERROR in range [100, 599] -//~^ HELP #[catch(404)] +#[catch(600)] fn e5(_request: &Request) { } -#[catch(400, message = "foo")] //~ ERROR unexpected attribute parameter: `message` -//~^ HELP #[catch(404)] +#[catch(400, message = "foo")] fn e5(_request: &Request) { } #[catch(404)] -fn f3(_request: &Request, other: bool) { - //~^ ERROR invalid number of arguments - //~^^ HELP optionally take an argument -} +fn f3(_request: &Request, other: bool) { } fn main() { } diff --git a/core/codegen/tests/ui-fail/catch_type_errors.rs b/core/codegen/tests/ui-fail/catch_type_errors.rs index b6c9a3e6..978adb43 100644 --- a/core/codegen/tests/ui-fail/catch_type_errors.rs +++ b/core/codegen/tests/ui-fail/catch_type_errors.rs @@ -4,26 +4,21 @@ use rocket::Request; #[catch(404)] fn f1(_request: &Request) -> usize { - //~^ ERROR usize: rocket::response::Responder 10 } #[catch(404)] fn f2(_request: &Request) -> bool { - //~^ ERROR bool: rocket::response::Responder false } #[catch(404)] fn f3(_request: bool) -> usize { - //~^ ERROR usize: rocket::response::Responder - //~^^ ERROR mismatched types 10 } #[catch(404)] fn f4() -> usize { - //~^ ERROR usize: rocket::response::Responder 10 } diff --git a/core/codegen/tests/ui-fail/catchers.rs b/core/codegen/tests/ui-fail/catchers.rs index f747ffb3..464f4535 100644 --- a/core/codegen/tests/ui-fail/catchers.rs +++ b/core/codegen/tests/ui-fail/catchers.rs @@ -1,8 +1,8 @@ #[macro_use] extern crate rocket; fn main() { - let _ = catchers![a b]; //~ ERROR expected + let _ = catchers![a b]; let _ = catchers![]; - let _ = catchers![a::, ]; //~ ERROR expected identifier - let _ = catchers![a::]; //~ ERROR expected identifier + let _ = catchers![a::, ]; + let _ = catchers![a::]; } diff --git a/core/codegen/tests/ui-fail/from_form.rs b/core/codegen/tests/ui-fail/from_form.rs index 86500355..007be45c 100644 --- a/core/codegen/tests/ui-fail/from_form.rs +++ b/core/codegen/tests/ui-fail/from_form.rs @@ -4,23 +4,18 @@ use rocket::http::RawStr; #[derive(FromForm)] enum Thing { } -//~^ ERROR not supported #[derive(FromForm)] struct Foo1; -//~^ ERROR not supported #[derive(FromForm)] struct Foo2 { } -//~^ ERROR one field is required #[derive(FromForm)] struct Foo3(usize); -//~^ ERROR not supported #[derive(FromForm)] struct NextTodoTask<'f, 'a> { -//~^ ERROR only one lifetime description: String, raw_description: &'f RawStr, other: &'a RawStr, @@ -30,7 +25,6 @@ struct NextTodoTask<'f, 'a> { #[derive(FromForm)] struct BadName1 { #[form(field = "isindex")] - //~^ ERROR invalid form field name field: String, } @@ -39,7 +33,6 @@ struct Demo2 { #[form(field = "foo")] field: String, foo: usize, - //~^ ERROR duplicate field } #[derive(FromForm)] @@ -47,7 +40,6 @@ struct MyForm9 { #[form(field = "hello")] first: String, #[form(field = "hello")] - //~^ ERROR duplicate field other: String, } @@ -55,42 +47,36 @@ struct MyForm9 { struct MyForm10 { first: String, #[form(field = "first")] - //~^ ERROR duplicate field other: String, } #[derive(FromForm)] struct MyForm { #[form(field = "blah", field = "bloo")] - //~^ ERROR duplicate my_field: String, } #[derive(FromForm)] struct MyForm1 { #[form] - //~^ ERROR malformed attribute my_field: String, } #[derive(FromForm)] struct MyForm2 { #[form("blah")] - //~^ ERROR expected key/value my_field: String, } #[derive(FromForm)] struct MyForm3 { #[form(123)] - //~^ ERROR expected key/value my_field: String, } #[derive(FromForm)] struct MyForm4 { #[form(beep = "bop")] - //~^ ERROR unexpected attribute parameter my_field: String, } @@ -98,70 +84,60 @@ struct MyForm4 { struct MyForm5 { #[form(field = "blah")] #[form(field = "bleh")] - //~^ ERROR duplicate my_field: String, } #[derive(FromForm)] struct MyForm6 { #[form(field = true)] - //~^ ERROR invalid value: expected string my_field: String, } #[derive(FromForm)] struct MyForm7 { #[form(field)] - //~^ ERROR expected literal or key/value my_field: String, } #[derive(FromForm)] struct MyForm8 { #[form(field = 123)] - //~^ ERROR invalid value: expected string my_field: String, } #[derive(FromForm)] struct MyForm11 { #[form(field = "hello&world")] - //~^ ERROR invalid form field name first: String, } #[derive(FromForm)] struct MyForm12 { #[form(field = "!@#$%^&*()_")] - //~^ ERROR invalid form field name first: String, } #[derive(FromForm)] struct MyForm13 { #[form(field = "?")] - //~^ ERROR invalid form field name first: String, } #[derive(FromForm)] struct MyForm14 { #[form(field = "")] - //~^ ERROR invalid form field name first: String, } #[derive(FromForm)] struct BadName2 { #[form(field = "a&b")] - //~^ ERROR invalid form field name field: String, } #[derive(FromForm)] struct BadName3 { #[form(field = "a=")] - //~^ ERROR invalid form field name field: String, } diff --git a/core/codegen/tests/ui-fail/from_form_type_errors.rs b/core/codegen/tests/ui-fail/from_form_type_errors.rs index cec7ee92..b4520cc5 100644 --- a/core/codegen/tests/ui-fail/from_form_type_errors.rs +++ b/core/codegen/tests/ui-fail/from_form_type_errors.rs @@ -5,7 +5,6 @@ struct Unknown; #[derive(FromForm)] struct BadType3 { field: Unknown, - //~^ rocket::request::FromFormValue } struct Foo(T); @@ -13,7 +12,6 @@ struct Foo(T); #[derive(FromForm)] struct Other { field: Foo, - //~^ rocket::request::FromFormValue } fn main() { } diff --git a/core/codegen/tests/ui-fail/from_form_value.rs b/core/codegen/tests/ui-fail/from_form_value.rs index ebc131df..a24f1f7a 100644 --- a/core/codegen/tests/ui-fail/from_form_value.rs +++ b/core/codegen/tests/ui-fail/from_form_value.rs @@ -2,45 +2,37 @@ #[derive(FromFormValue)] struct Foo1; -//~^ ERROR not supported #[derive(FromFormValue)] struct Foo2(usize); -//~^ ERROR not supported #[derive(FromFormValue)] struct Foo3 { -//~^ ERROR not supported foo: usize, } #[derive(FromFormValue)] enum Foo4 { A(usize), - //~^ ERROR cannot have fields } #[derive(FromFormValue)] enum Foo5 { } -//~^ ERROR at least one field #[derive(FromFormValue)] enum Foo6 { -//~^ ERROR type generics are not supported A(T), } #[derive(FromFormValue)] enum Bar1 { #[form(value = 123)] - //~^ ERROR invalid value: expected string A, } #[derive(FromFormValue)] enum Bar2 { #[form(value)] - //~^ ERROR expected literal or key/value A, } diff --git a/core/codegen/tests/ui-fail/responder-types.rs b/core/codegen/tests/ui-fail/responder-types.rs index cb75f27a..f98ec9d4 100644 --- a/core/codegen/tests/ui-fail/responder-types.rs +++ b/core/codegen/tests/ui-fail/responder-types.rs @@ -1,28 +1,20 @@ -// normalize-stderr-test: "<(.*) as (.*)>" -> "$1 as $$TRAIT" -// normalize-stderr-test: "and \d+ others" -> "and $$N others" -// normalize-stderr-test: "::: (.*)/core/lib" -> "::: $$ROCKET/core/lib" - #[macro_use] extern crate rocket; #[derive(Responder)] struct Thing1 { thing: u8, - //~^ ERROR Responder } #[derive(Responder)] struct Thing2 { thing: String, other: u8, - //~^ ERROR Header } #[derive(Responder)] struct Thing3 { thing: u8, - //~^ ERROR Responder other: u8, - //~^ ERROR Header } #[derive(Responder)] @@ -30,11 +22,9 @@ struct Thing4 { thing: String, other: rocket::http::ContentType, then: String, - //~^ ERROR Header } #[get("/")] fn foo() -> usize { 0 } -//~^ ERROR Responder fn main() { } diff --git a/core/codegen/tests/ui-fail/route-attribute-general-syntax.rs b/core/codegen/tests/ui-fail/route-attribute-general-syntax.rs index cd44c9d8..16fbdbb8 100644 --- a/core/codegen/tests/ui-fail/route-attribute-general-syntax.rs +++ b/core/codegen/tests/ui-fail/route-attribute-general-syntax.rs @@ -1,128 +1,110 @@ #[macro_use] extern crate rocket; // Check a path is supplied, at least. - -#[get()] //~ ERROR missing expected parameter +#[get()] fn a0() {} // Check that it only works on functions. - #[get("/")] struct S; -//~^ ERROR expected `fn` -//~^^ HELP on functions #[get("/")] enum A { } -//~^ ERROR expected `fn` -//~^^ HELP on functions #[get("/")] trait Foo { } -//~^ ERROR expected `fn` -//~^^ HELP on functions #[get("/")] impl S { } -//~^ ERROR expected `fn` -//~^^ HELP on functions // Check that additional parameter weirdness is caught. - -#[get("/", 123)] //~ ERROR expected +#[get("/", 123)] fn b0() {} -#[get("/", "/")] //~ ERROR expected +#[get("/", "/")] fn b1() {} -#[get(data = "", "/")] //~ ERROR unexpected keyed parameter +#[get(data = "", "/")] fn b2(foo: usize) {} -#[get("/", unknown = "foo")] //~ ERROR unexpected +#[get("/", unknown = "foo")] fn b3() {} -#[get("/", ...)] //~ ERROR malformed -//~^ HELP expected syntax +#[get("/", ...)] fn b4() {} // Check that all identifiers are named #[get("/")] -fn c1(_: usize) {} //~ ERROR cannot be ignored -//~^ HELP must be of the form +fn c1(_: usize) {} // Check that the path is a string, rank is an integer. -#[get(100)] //~ ERROR expected string +#[get(100)] fn d0() {} -#[get('/')] //~ ERROR expected string +#[get('/')] fn d1() {} -#[get("/", rank = "1")] //~ ERROR expected integer +#[get("/", rank = "1")] fn d2() {} -#[get("/", rank = '1')] //~ ERROR expected integer +#[get("/", rank = '1')] fn d3() {} // Check that formats are valid media-type strings. -#[get("/", format = "applicationx-custom")] //~ ERROR invalid or unknown media type +#[get("/", format = "applicationx-custom")] fn e0() {} -#[get("/", format = "")] //~ ERROR invalid or unknown media type +#[get("/", format = "")] fn e1() {} -#[get("/", format = "//")] //~ ERROR invalid or unknown media type +#[get("/", format = "//")] fn e2() {} -#[get("/", format = "/")] //~ ERROR invalid or unknown media type +#[get("/", format = "/")] fn e3() {} -#[get("/", format = "a/")] //~ ERROR invalid or unknown media type +#[get("/", format = "a/")] fn e4() {} -#[get("/", format = "/a")] //~ ERROR invalid or unknown media type +#[get("/", format = "/a")] fn e5() {} -#[get("/", format = "/a/")] //~ ERROR invalid or unknown media type +#[get("/", format = "/a/")] fn e6() {} -#[get("/", format = "a/b/")] //~ ERROR invalid or unknown media type +#[get("/", format = "a/b/")] fn e7() {} -#[get("/", format = "unknown")] //~ ERROR unknown media type +#[get("/", format = "unknown")] fn e8() {} -#[get("/", format = 12)] //~ ERROR expected string +#[get("/", format = 12)] fn e9() {} -#[get("/", format = 'j')] //~ ERROR expected string +#[get("/", format = 'j')] fn e10() {} -#[get("/", format = "text//foo")] //~ ERROR invalid or unknown media type +#[get("/", format = "text//foo")] fn e12() {} // Check that route methods are validated properly. -#[route(CONNECT, "/")] //~ ERROR invalid HTTP method for route -//~^ HELP method must be one of +#[route(CONNECT, "/")] fn f0() {} -#[route(FIX, "/")] //~ ERROR invalid HTTP method -//~^ HELP method must be one of +#[route(FIX, "/")] fn f1() {} -#[route("hi", "/")] //~ ERROR expected identifier -//~^ HELP method must be one of +#[route("hi", "/")] fn f2() {} -#[route("GET", "/")] //~ ERROR expected identifier -//~^ HELP method must be one of +#[route("GET", "/")] fn f3() {} -#[route(120, "/")] //~ ERROR expected identifier -//~^ HELP method must be one of +#[route(120, "/")] fn f4() {} fn main() {} diff --git a/core/codegen/tests/ui-fail/route-path-bad-syntax.rs b/core/codegen/tests/ui-fail/route-path-bad-syntax.rs index 819b5a0d..eb7b02e5 100644 --- a/core/codegen/tests/ui-fail/route-path-bad-syntax.rs +++ b/core/codegen/tests/ui-fail/route-path-bad-syntax.rs @@ -2,131 +2,104 @@ // Check that route paths are absolute and normalized. -#[get("a")] //~ ERROR invalid path URI -//~^ HELP expected +#[get("a")] fn f0() {} -#[get("")] //~ ERROR invalid path URI -//~^ HELP expected +#[get("")] fn f1() {} -#[get("a/b/c")] //~ ERROR invalid path URI -//~^ HELP expected +#[get("a/b/c")] fn f2() {} -#[get("/a///b")] //~ ERROR empty segments -//~^ NOTE expected +#[get("/a///b")] fn f3() {} -#[get("/?bat&&")] //~ ERROR empty segments +#[get("/?bat&&")] fn f4() {} -#[get("/?bat&&")] //~ ERROR empty segments +#[get("/?bat&&")] fn f5() {} -#[get("/a/b//")] //~ ERROR empty segments -//~^ NOTE expected +#[get("/a/b//")] fn f6() {} // Check that paths contain only valid URI characters -#[get("/!@#$%^&*()")] //~ ERROR invalid path URI -//~^ HELP origin form +#[get("/!@#$%^&*()")] fn g1() {} -#[get("/a%20b")] //~ ERROR invalid URI characters -//~^ NOTE cannot contain reserved -//~^^ HELP reserved characters include +#[get("/a%20b")] fn g2() {} -#[get("/a?a%20b")] //~ ERROR invalid URI characters -//~^ NOTE cannot contain reserved -//~^^ HELP reserved characters include +#[get("/a?a%20b")] fn g3() {} -#[get("/a?a+b")] //~ ERROR invalid URI characters -//~^ NOTE cannot contain reserved -//~^^ HELP reserved characters include +#[get("/a?a+b")] fn g4() {} // Check that all declared parameters are accounted for -#[get("/")] //~ ERROR unused dynamic parameter -fn h0(_name: usize) {} //~ NOTE expected argument named `name` here +#[get("/")] +fn h0(_name: usize) {} -#[get("/a?")] //~ ERROR unused dynamic parameter -fn h1() {} //~ NOTE expected argument named `r` here +#[get("/a?")] +fn h1() {} -#[post("/a", data = "")] //~ ERROR unused dynamic parameter -fn h2() {} //~ NOTE expected argument named `test` here +#[post("/a", data = "")] +fn h2() {} -#[get("/<_r>")] //~ ERROR unused dynamic parameter -fn h3() {} //~ NOTE expected argument named `_r` here +#[get("/<_r>")] +fn h3() {} + +#[get("/<_r>/")] +fn h4() {} -#[get("/<_r>/")] //~ ERROR unused dynamic parameter -//~^ ERROR unused dynamic parameter -fn h4() {} //~ NOTE expected argument named `_r` here -//~^ NOTE expected argument named `b` here // Check dynamic parameters are valid idents -#[get("/")] //~ ERROR `foo_.` is not a valid identifier -//~^ HELP must be valid +#[get("/")] fn i0() {} -#[get("/")] //~ ERROR `foo*` is not a valid identifier -//~^ HELP must be valid +#[get("/")] fn i1() {} -#[get("/")] //~ ERROR `!` is not a valid identifier -//~^ HELP must be valid +#[get("/")] fn i2() {} -#[get("/:")] //~ ERROR `name>::")] fn i3() {} // Check that a data parameter is exactly `` -#[get("/", data = "foo")] //~ ERROR malformed parameter -//~^ HELP must be of the form +#[get("/", data = "foo")] fn j0() {} -#[get("/", data = "")] //~ ERROR malformed parameter -//~^ HELP must be of the form +#[get("/", data = "")] fn j1() {} -#[get("/", data = "")] //~ ERROR must be named -fn k0(_: usize) {} //~^ HELP use a name such as +#[get("/<_>")] +fn k0(_: usize) {} // Check that strange dynamic syntax is caught. -#[get("/<>")] //~ ERROR cannot be empty +#[get("/<>")] fn m0() {} -#[get("/<")] //~ ERROR malformed parameter -//~^ HELP must be of the form -//~^^ HELP identifiers cannot contain +#[get("/<")] fn m1() {} -#[get("/<<<<")] //~ ERROR malformed parameter -//~^ HELP must be of the form -//~^^ HELP identifiers cannot contain +#[get("/<<<<")] fn m2() {} -#[get("/<>name><")] //~ ERROR malformed parameter -//~^ HELP must be of the form -//~^^ HELP identifiers cannot contain +#[get("/<>name><")] fn m3() {} fn main() { } diff --git a/core/codegen/tests/ui-fail/route-type-errors.rs b/core/codegen/tests/ui-fail/route-type-errors.rs index f1758cc5..17991aa7 100644 --- a/core/codegen/tests/ui-fail/route-type-errors.rs +++ b/core/codegen/tests/ui-fail/route-type-errors.rs @@ -3,29 +3,24 @@ struct Q; #[get("/")] -fn f0(foo: Q) {} //~ ERROR FromParam +fn f0(foo: Q) {} #[get("/")] -fn f1(foo: Q) {} //~ ERROR FromSegments +fn f1(foo: Q) {} #[get("/?")] -fn f2(foo: Q) {} //~ ERROR FromFormValue +fn f2(foo: Q) {} #[get("/?")] -fn f3(foo: Q) {} //~ ERROR FromQuery +fn f3(foo: Q) {} #[post("/", data = "")] -fn f4(foo: Q) {} //~ ERROR FromData +fn f4(foo: Q) {} #[get("/")] fn f5(a: Q, foo: Q) {} -//~^ ERROR FromParam -//~^^ ERROR FromRequest #[get("//other///okay")] fn f6(a: Q, foo: Q, good: usize, bar: Q) {} -//~^ ERROR FromParam -//~^^ ERROR FromParam -//~^^^ ERROR FromRequest fn main() { } diff --git a/core/codegen/tests/ui-fail/route-warnings.rs b/core/codegen/tests/ui-fail/route-warnings.rs index 4f90976b..3be14d75 100644 --- a/core/codegen/tests/ui-fail/route-warnings.rs +++ b/core/codegen/tests/ui-fail/route-warnings.rs @@ -4,21 +4,21 @@ // Check for unknown media types. -#[get("/", format = "application/x-custom")] //~ WARNING not a known media type +#[get("/", format = "application/x-custom")] fn f0() {} -#[get("/", format = "x-custom/plain")] //~ WARNING not a known media type +#[get("/", format = "x-custom/plain")] fn f1() {} -#[get("/", format = "x-custom/x-custom")] //~ WARNING not a known media type +#[get("/", format = "x-custom/x-custom")] fn f2() {} // Check if a data argument is used with a usually non-payload bearing method. -#[get("/", data = "<_foo>")] //~ WARNING used with non-payload-supporting method +#[get("/", data = "<_foo>")] fn g0(_foo: rocket::Data) {} -#[head("/", data = "<_foo>")] //~ WARNING used with non-payload-supporting method +#[head("/", data = "<_foo>")] fn g1(_foo: rocket::Data) {} fn main() { diff --git a/core/codegen/tests/ui-fail/routes.rs b/core/codegen/tests/ui-fail/routes.rs index b6f91e9b..91f5af63 100644 --- a/core/codegen/tests/ui-fail/routes.rs +++ b/core/codegen/tests/ui-fail/routes.rs @@ -1,8 +1,8 @@ #[macro_use] extern crate rocket; fn main() { - let _ = routes![a b]; //~ ERROR expected `,` + let _ = routes![a b]; let _ = routes![]; - let _ = routes![a::, ]; //~ ERROR expected identifier - let _ = routes![a::]; //~ ERROR expected identifier + let _ = routes![a::, ]; + let _ = routes![a::]; } diff --git a/core/codegen/tests/ui-fail/typed-uri-bad-type.rs b/core/codegen/tests/ui-fail/typed-uri-bad-type.rs index 0452bc09..ce348284 100644 --- a/core/codegen/tests/ui-fail/typed-uri-bad-type.rs +++ b/core/codegen/tests/ui-fail/typed-uri-bad-type.rs @@ -1,7 +1,3 @@ -// normalize-stderr-test: "<(.*) as (.*)>" -> "$1 as $$TRAIT" -// normalize-stderr-test: "and \d+ others" -> "and $$N others" -// normalize-stderr-test: "::: (.*)/core/http" -> "::: $$ROCKET/core/http" - #[macro_use] extern crate rocket; use rocket::http::RawStr; @@ -38,48 +34,35 @@ fn simple_q(id: isize) { } #[post("/?&")] fn other_q(id: usize, rest: S) { } -//~^ ERROR S: rocket::http::uri::Ignorable -//~^^ ERROR usize: rocket::http::uri::Ignorable #[post("/?&")] fn optionals_q(id: Option, name: Result) { } fn main() { uri!(simple: id = "hi"); - //~^ ERROR usize: rocket::http::uri::FromUriParam uri!(simple: "hello"); - //~^ ERROR usize: rocket::http::uri::FromUriParam uri!(simple: id = 239239i64); - //~^ ERROR usize: rocket::http::uri::FromUriParam uri!(not_uri_display: 10, S); - //~^ ERROR S: rocket::http::uri::FromUriParam // This one is okay. In paths, a value _must_ be supplied. uri!(optionals: id = 10, name = "bob".to_string()); uri!(optionals: id = Some(10), name = Ok("bob".into())); - //~^ ERROR i32: rocket::http::uri::FromUriParam> - //~^^ ERROR String: rocket::http::uri::FromUriParam> uri!(simple_q: "hi"); - //~^ ERROR isize: rocket::http::uri::FromUriParam uri!(simple_q: id = "hi"); - //~^ ERROR isize: rocket::http::uri::FromUriParam uri!(other_q: 100, S); - //~^ ERROR S: rocket::http::uri::FromUriParam uri!(other_q: rest = S, id = 100); - //~^ ERROR S: rocket::http::uri::FromUriParam uri!(other_q: rest = _, id = 100); uri!(other_q: rest = S, id = _); - //~^ ERROR S: rocket::http::uri::FromUriParam // These are all okay. uri!(optionals_q: _, _); diff --git a/core/codegen/tests/ui-fail/typed-uris-bad-params.rs b/core/codegen/tests/ui-fail/typed-uris-bad-params.rs index 3dae1b9b..58ff7b82 100644 --- a/core/codegen/tests/ui-fail/typed-uris-bad-params.rs +++ b/core/codegen/tests/ui-fail/typed-uris-bad-params.rs @@ -1,7 +1,5 @@ #[macro_use] extern crate rocket; -use std::fmt; - use rocket::http::{Cookies, RawStr}; #[post("/")] @@ -17,63 +15,42 @@ fn has_two(cookies: Cookies, id: i32, name: String) { } fn optionals(id: Option, name: Result) { } fn main() { - uri!(has_one); //~ ERROR expects 1 parameter but 0 + uri!(has_one); - uri!(has_one: 1, 23); //~ ERROR expects 1 parameter but 2 - uri!(has_one: "Hello", 23, ); //~ ERROR expects 1 parameter but 2 - uri!(has_one_guarded: "hi", 100); //~ ERROR expects 1 parameter but 2 + uri!(has_one: 1, 23); + uri!(has_one: "Hello", 23, ); + uri!(has_one_guarded: "hi", 100); - uri!(has_two: 10, "hi", "there"); //~ ERROR expects 2 parameters but 3 - uri!(has_two: 10); //~ ERROR expects 2 parameters but 1 + uri!(has_two: 10, "hi", "there"); + uri!(has_two: 10); - uri!(has_one: id = 100, name = "hi"); //~ ERROR invalid parameters - //~^ HELP unknown parameter: `name` + uri!(has_one: id = 100, name = "hi"); - uri!(has_one: name = 100, id = 100); //~ ERROR invalid parameters - //~^ HELP unknown parameter: `name` + uri!(has_one: name = 100, id = 100); - uri!(has_one: name = 100, age = 50, id = 100); //~ ERROR invalid parameters - //~^ HELP unknown parameters: `name`, `age` + uri!(has_one: name = 100, age = 50, id = 100); - uri!(has_one: name = 100, age = 50, id = 100, id = 50); //~ ERROR invalid parameters - //~^ HELP unknown parameters: `name`, `age` - //~^^ HELP duplicate parameter: `id` + uri!(has_one: name = 100, age = 50, id = 100, id = 50); - uri!(has_one: id = 100, id = 100); //~ ERROR invalid parameters - //~^ HELP duplicate parameter: `id` + uri!(has_one: id = 100, id = 100); - uri!(has_one: id = 100, id = 100, ); //~ ERROR invalid parameters - //~^ HELP duplicate parameter: `id` + uri!(has_one: id = 100, id = 100, ); - uri!(has_one: name = "hi"); //~ ERROR invalid parameters - //~^ HELP unknown parameter: `name` - //~^^ HELP missing parameter: `id` + uri!(has_one: name = "hi"); - uri!(has_one_guarded: cookies = "hi", id = 100); //~ ERROR invalid parameters - //~^ HELP unknown parameter: `cookies` + uri!(has_one_guarded: cookies = "hi", id = 100); - uri!(has_one_guarded: id = 100, cookies = "hi"); //~ ERROR invalid parameters - //~^ HELP unknown parameter: `cookies` + uri!(has_one_guarded: id = 100, cookies = "hi"); - uri!(has_two: id = 100, id = 100, ); //~ ERROR invalid parameters - //~^ HELP duplicate parameter: `id` - //~^^ HELP missing parameter: `name` + uri!(has_two: id = 100, id = 100, ); - uri!(has_two: name = "hi"); //~ ERROR invalid parameters - //~^ HELP missing parameter: `id` + uri!(has_two: name = "hi"); - uri!(has_two: cookies = "hi", id = 100, id = 10, id = 10); //~ ERROR invalid parameters - //~^ HELP duplicate parameter: `id` - //~^^ HELP missing parameter: `name` - //~^^^ HELP unknown parameter: `cookies` + uri!(has_two: cookies = "hi", id = 100, id = 10, id = 10); - uri!(has_two: id = 100, cookies = "hi"); //~ ERROR invalid parameters - //~^ HELP missing parameter: `name` - //~^^ HELP unknown parameter: `cookies` + uri!(has_two: id = 100, cookies = "hi"); uri!(optionals: id = _, name = "bob".into()); - //~^ ERROR cannot be ignored uri!(optionals: id = 10, name = _); - //~^ ERROR cannot be ignored } diff --git a/core/codegen/tests/ui-fail/typed-uris-invalid-syntax.rs b/core/codegen/tests/ui-fail/typed-uris-invalid-syntax.rs index efee8948..fe8384ba 100644 --- a/core/codegen/tests/ui-fail/typed-uris-invalid-syntax.rs +++ b/core/codegen/tests/ui-fail/typed-uris-invalid-syntax.rs @@ -4,14 +4,14 @@ fn simple(id: i32, name: String) -> &'static str { "" } fn main() { - uri!(simple: id = 100, "Hello"); //~ ERROR named and unnamed - uri!(simple: "Hello", id = 100); //~ ERROR named and unnamed - uri!(simple,); //~ ERROR expected `:` - uri!(simple:); //~ ERROR argument list - uri!("/mount"); //~ ERROR route path - uri!("/mount",); //~ ERROR expected identifier - uri!("mount", simple); //~ invalid mount point - uri!("/mount/", simple); //~ invalid mount point - uri!(); //~ unexpected end of input - uri!(simple: id = ); //~ expected expression + uri!(simple: id = 100, "Hello"); + uri!(simple: "Hello", id = 100); + uri!(simple,); + uri!(simple:); + uri!("/mount"); + uri!("/mount",); + uri!("mount", simple); + uri!("/mount/", simple); + uri!(); + uri!(simple: id = ); } diff --git a/core/codegen/tests/ui-fail/uri_display.rs b/core/codegen/tests/ui-fail/uri_display.rs index d76635dc..42cc6db3 100644 --- a/core/codegen/tests/ui-fail/uri_display.rs +++ b/core/codegen/tests/ui-fail/uri_display.rs @@ -1,77 +1,39 @@ -// normalize-stderr-test: "::: (.*)/core/http" -> "::: $$ROCKET/core/http" - #[macro_use] extern crate rocket; #[derive(UriDisplayQuery)] -//~^ ERROR Foo1: rocket::http::uri::UriDisplay -//~| ERROR Foo1: rocket::http::uri::UriDisplay -//~| ERROR Foo1: rocket::http::uri::UriDisplay struct Foo1; -//~^ ERROR not supported #[derive(UriDisplayQuery)] -//~^ ERROR Foo2: rocket::http::uri::UriDisplay -//~| ERROR Foo2: rocket::http::uri::UriDisplay -//~| ERROR Foo2: rocket::http::uri::UriDisplay struct Foo2(); -//~^ ERROR not supported #[derive(UriDisplayQuery)] -//~^ ERROR Foo3: rocket::http::uri::UriDisplay -//~| ERROR Foo3: rocket::http::uri::UriDisplay -//~| ERROR Foo3: rocket::http::uri::UriDisplay enum Foo3 { } -//~^ ERROR not supported #[derive(UriDisplayQuery)] -//~^ ERROR Foo4: rocket::http::uri::UriDisplay -//~| ERROR Foo4: rocket::http::uri::UriDisplay -//~| ERROR Foo4: rocket::http::uri::UriDisplay enum Foo4 { Variant, - //~^ ERROR not supported } #[derive(UriDisplayQuery)] -//~^ ERROR Foo5: rocket::http::uri::UriDisplay -//~| ERROR Foo5: rocket::http::uri::UriDisplay -//~| ERROR Foo5: rocket::http::uri::UriDisplay struct Foo5(String, String); -//~^ ERROR exactly one #[derive(UriDisplayQuery)] -//~^ ERROR Foo6: rocket::http::uri::UriDisplay -//~| ERROR Foo6: rocket::http::uri::UriDisplay -//~| ERROR Foo6: rocket::http::uri::UriDisplay struct Foo6 { #[form(field = 123)] - //~^ ERROR invalid value: expected string field: String, } #[derive(UriDisplayPath)] -//~^ ERROR Foo7: rocket::http::uri::UriDisplay -//~| ERROR Foo7: rocket::http::uri::UriDisplay struct Foo7(String, usize); -//~^ ERROR exactly one #[derive(UriDisplayPath)] -//~^ ERROR Foo8: rocket::http::uri::UriDisplay -//~| ERROR Foo8: rocket::http::uri::UriDisplay struct Foo8; -//~^ ERROR exactly one #[derive(UriDisplayPath)] -//~^ ERROR Foo9: rocket::http::uri::UriDisplay -//~| ERROR Foo9: rocket::http::uri::UriDisplay enum Foo9 { } -//~^ ERROR not supported #[derive(UriDisplayPath)] -//~^ ERROR Foo10: rocket::http::uri::UriDisplay -//~| ERROR Foo10: rocket::http::uri::UriDisplay struct Foo10 { -//~^ ERROR not supported named: usize } diff --git a/core/codegen/tests/ui-fail/uri_display_type_errors.rs b/core/codegen/tests/ui-fail/uri_display_type_errors.rs index 6097c845..f9b9c469 100644 --- a/core/codegen/tests/ui-fail/uri_display_type_errors.rs +++ b/core/codegen/tests/ui-fail/uri_display_type_errors.rs @@ -4,32 +4,27 @@ struct BadType; #[derive(UriDisplayQuery)] struct Bar1(BadType); -//~^ ERROR UriDisplay #[derive(UriDisplayQuery)] struct Bar2 { field: BadType, - //~^ ERROR UriDisplay } #[derive(UriDisplayQuery)] struct Bar3 { field: String, bad: BadType, - //~^ ERROR UriDisplay } #[derive(UriDisplayQuery)] enum Bar4 { Inner(BadType), - //~^ ERROR UriDisplay } #[derive(UriDisplayQuery)] enum Bar5 { Inner { field: BadType, - //~^ ERROR UriDisplay }, } @@ -38,12 +33,10 @@ enum Bar6 { Inner { field: String, other: BadType, - //~^ ERROR UriDisplay }, } #[derive(UriDisplayPath)] struct Baz(BadType); -//~^ ERROR UriDisplay fn main() { } diff --git a/core/http/Cargo.toml b/core/http/Cargo.toml index 9f21d381..d71e78a1 100644 --- a/core/http/Cargo.toml +++ b/core/http/Cargo.toml @@ -37,7 +37,7 @@ ref-cast = "1.0" [dependencies.pear] git = "https://github.com/SergioBenitez/Pear.git" -rev = "faee7c7e" +rev = "4b68055" [dev-dependencies] rocket = { version = "0.5.0-dev", path = "../lib" } diff --git a/core/lib/Cargo.toml b/core/lib/Cargo.toml index 0b194eaf..65d1fa57 100644 --- a/core/lib/Cargo.toml +++ b/core/lib/Cargo.toml @@ -42,7 +42,7 @@ atomic = "0.4" [dependencies.pear] git = "https://github.com/SergioBenitez/Pear.git" -rev = "faee7c7e" +rev = "4b68055" [dependencies.tokio] version = "0.2.9"