mirror of https://github.com/rwf2/Rocket.git
Remove dependence on 'decl_macro' in codegen.
The generated 'uri' helper macros are now re-exports of 'macro_rules' macros, made possible by the stable 'uniform_paths' feature.
This commit is contained in:
parent
34a741a26e
commit
2f458b5217
|
@ -1,3 +1,6 @@
|
||||||
|
use std::collections::hash_map::DefaultHasher;
|
||||||
|
use std::hash::{Hash, Hasher};
|
||||||
|
|
||||||
use proc_macro::{TokenStream, Span};
|
use proc_macro::{TokenStream, Span};
|
||||||
use crate::proc_macro2::TokenStream as TokenStream2;
|
use crate::proc_macro2::TokenStream as TokenStream2;
|
||||||
use devise::{syn, Spanned, SpanWrapped, Result, FromMeta, ext::TypeExt};
|
use devise::{syn, Spanned, SpanWrapped, Result, FromMeta, ext::TypeExt};
|
||||||
|
@ -325,15 +328,31 @@ fn generate_internal_uri_macro(route: &Route) -> TokenStream2 {
|
||||||
.map(|name| route.inputs.iter().find(|(ident, ..)| ident == name).unwrap())
|
.map(|name| route.inputs.iter().find(|(ident, ..)| ident == name).unwrap())
|
||||||
.map(|(ident, _, ty)| quote!(#ident: #ty));
|
.map(|(ident, _, ty)| quote!(#ident: #ty));
|
||||||
|
|
||||||
let generated_macro_name = route.function.ident.prepend(URI_MACRO_PREFIX);
|
let mut hasher = DefaultHasher::new();
|
||||||
|
let route_span = route.function.span();
|
||||||
|
route_span.source_file().path().hash(&mut hasher);
|
||||||
|
let line_column = route_span.start();
|
||||||
|
line_column.line.hash(&mut hasher);
|
||||||
|
line_column.column.hash(&mut hasher);
|
||||||
|
|
||||||
|
let mut generated_macro_name = route.function.ident.prepend(URI_MACRO_PREFIX);
|
||||||
|
generated_macro_name.set_span(Span::call_site().into());
|
||||||
|
let inner_generated_macro_name = generated_macro_name.append(&hasher.finish().to_string());
|
||||||
let route_uri = route.attribute.path.origin.0.to_string();
|
let route_uri = route.attribute.path.origin.0.to_string();
|
||||||
|
|
||||||
quote! {
|
quote! {
|
||||||
pub macro #generated_macro_name($($token:tt)*) {{
|
#[doc(hidden)]
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! #inner_generated_macro_name {
|
||||||
|
($($token:tt)*) => {{
|
||||||
extern crate std;
|
extern crate std;
|
||||||
extern crate rocket;
|
extern crate rocket;
|
||||||
rocket::rocket_internal_uri!(#route_uri, (#(#dynamic_args),*), $($token)*)
|
rocket::rocket_internal_uri!(#route_uri, (#(#dynamic_args),*), $($token)*)
|
||||||
}}
|
}};
|
||||||
|
}
|
||||||
|
|
||||||
|
#[doc(hidden)]
|
||||||
|
pub use #inner_generated_macro_name as #generated_macro_name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,12 +9,17 @@ pub fn syn_to_diag(error: syn::parse::Error) -> Diagnostic {
|
||||||
|
|
||||||
pub trait IdentExt {
|
pub trait IdentExt {
|
||||||
fn prepend(&self, string: &str) -> syn::Ident;
|
fn prepend(&self, string: &str) -> syn::Ident;
|
||||||
|
fn append(&self, string: &str) -> syn::Ident;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl IdentExt for syn::Ident {
|
impl IdentExt for syn::Ident {
|
||||||
fn prepend(&self, string: &str) -> syn::Ident {
|
fn prepend(&self, string: &str) -> syn::Ident {
|
||||||
syn::Ident::new(&format!("{}{}", string, self), self.span())
|
syn::Ident::new(&format!("{}{}", string, self), self.span())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn append(&self, string: &str) -> syn::Ident {
|
||||||
|
syn::Ident::new(&format!("{}{}", self, string), self.span())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait ReturnTypeExt {
|
pub trait ReturnTypeExt {
|
||||||
|
|
|
@ -1,196 +1,28 @@
|
||||||
error: `has_one` route uri expects 1 parameter but 0 were supplied
|
error: path parameters cannot be ignored
|
||||||
--> $DIR/typed-uris-bad-params.rs:22:10
|
--> $DIR/typed-uris-bad-params.rs:79:37
|
||||||
|
|
|
|
||||||
22 | uri!(has_one); //~ ERROR expects 1 parameter but 0
|
79 | uri!(optionals: id = 10, name = _);
|
||||||
| ^^^^^^^
|
| ^
|
||||||
|
|
|
||||||
= note: expected parameter: id: i32
|
|
||||||
|
|
||||||
error: `has_one` route uri expects 1 parameter but 2 were supplied
|
error: path parameters cannot be ignored
|
||||||
--> $DIR/typed-uris-bad-params.rs:24:19
|
--> $DIR/typed-uris-bad-params.rs:76:26
|
||||||
|
|
|
|
||||||
24 | uri!(has_one: 1, 23); //~ ERROR expects 1 parameter but 2
|
76 | uri!(optionals: id = _, name = "bob".into());
|
||||||
| ^^^^^
|
| ^
|
||||||
|
|
|
||||||
= note: expected parameter: id: i32
|
|
||||||
|
|
||||||
error: `has_one` route uri expects 1 parameter but 2 were supplied
|
|
||||||
--> $DIR/typed-uris-bad-params.rs:25:19
|
|
||||||
|
|
|
||||||
25 | uri!(has_one: "Hello", 23, ); //~ ERROR expects 1 parameter but 2
|
|
||||||
| ^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: expected parameter: id: i32
|
|
||||||
|
|
||||||
error: `has_one_guarded` route uri expects 1 parameter but 2 were supplied
|
|
||||||
--> $DIR/typed-uris-bad-params.rs:26:27
|
|
||||||
|
|
|
||||||
26 | uri!(has_one_guarded: "hi", 100); //~ ERROR expects 1 parameter but 2
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: expected parameter: id: i32
|
|
||||||
|
|
||||||
error: `has_two` route uri expects 2 parameters but 3 were supplied
|
|
||||||
--> $DIR/typed-uris-bad-params.rs:28:19
|
|
||||||
|
|
|
||||||
28 | uri!(has_two: 10, "hi", "there"); //~ ERROR expects 2 parameters but 3
|
|
||||||
| ^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: expected parameters: id: i32, name: String
|
|
||||||
|
|
||||||
error: `has_two` route uri expects 2 parameters but 1 was supplied
|
|
||||||
--> $DIR/typed-uris-bad-params.rs:29:19
|
|
||||||
|
|
|
||||||
29 | uri!(has_two: 10); //~ ERROR expects 2 parameters but 1
|
|
||||||
| ^^
|
|
||||||
|
|
|
||||||
= note: expected parameters: id: i32, name: String
|
|
||||||
|
|
||||||
error: invalid parameters for `has_one` route uri
|
|
||||||
--> $DIR/typed-uris-bad-params.rs:31:19
|
|
||||||
|
|
|
||||||
31 | uri!(has_one: id = 100, name = "hi"); //~ ERROR invalid parameters
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: uri parameters are: id: i32
|
|
||||||
help: unknown parameter: `name`
|
|
||||||
--> $DIR/typed-uris-bad-params.rs:31:29
|
|
||||||
|
|
|
||||||
31 | uri!(has_one: id = 100, name = "hi"); //~ ERROR invalid parameters
|
|
||||||
| ^^^^
|
|
||||||
|
|
||||||
error: invalid parameters for `has_one` route uri
|
|
||||||
--> $DIR/typed-uris-bad-params.rs:34:19
|
|
||||||
|
|
|
||||||
34 | 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:34:19
|
|
||||||
|
|
|
||||||
34 | uri!(has_one: name = 100, id = 100); //~ ERROR invalid parameters
|
|
||||||
| ^^^^
|
|
||||||
|
|
||||||
error: invalid parameters for `has_one` route uri
|
|
||||||
--> $DIR/typed-uris-bad-params.rs:37:19
|
|
||||||
|
|
|
||||||
37 | uri!(has_one: name = 100, age = 50, id = 100); //~ ERROR invalid parameters
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: uri parameters are: id: i32
|
|
||||||
help: unknown parameters: `name`, `age`
|
|
||||||
--> $DIR/typed-uris-bad-params.rs:37:19
|
|
||||||
|
|
|
||||||
37 | uri!(has_one: name = 100, age = 50, id = 100); //~ ERROR invalid parameters
|
|
||||||
| ^^^^ ^^^
|
|
||||||
|
|
||||||
error: invalid parameters for `has_one` route uri
|
|
||||||
--> $DIR/typed-uris-bad-params.rs:40:19
|
|
||||||
|
|
|
||||||
40 | uri!(has_one: name = 100, age = 50, id = 100, id = 50); //~ ERROR invalid parameters
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: uri parameters are: id: i32
|
|
||||||
help: unknown parameters: `name`, `age`
|
|
||||||
--> $DIR/typed-uris-bad-params.rs:40:19
|
|
||||||
|
|
|
||||||
40 | uri!(has_one: name = 100, age = 50, id = 100, id = 50); //~ ERROR invalid parameters
|
|
||||||
| ^^^^ ^^^
|
|
||||||
help: duplicate parameter: `id`
|
|
||||||
--> $DIR/typed-uris-bad-params.rs:40:51
|
|
||||||
|
|
|
||||||
40 | uri!(has_one: name = 100, age = 50, id = 100, id = 50); //~ ERROR invalid parameters
|
|
||||||
| ^^
|
|
||||||
|
|
||||||
error: invalid parameters for `has_one` route uri
|
|
||||||
--> $DIR/typed-uris-bad-params.rs:44:19
|
|
||||||
|
|
|
||||||
44 | uri!(has_one: id = 100, id = 100); //~ ERROR invalid parameters
|
|
||||||
| ^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: uri parameters are: id: i32
|
|
||||||
help: duplicate parameter: `id`
|
|
||||||
--> $DIR/typed-uris-bad-params.rs:44:29
|
|
||||||
|
|
|
||||||
44 | uri!(has_one: id = 100, id = 100); //~ ERROR invalid parameters
|
|
||||||
| ^^
|
|
||||||
|
|
||||||
error: invalid parameters for `has_one` route uri
|
|
||||||
--> $DIR/typed-uris-bad-params.rs:47:19
|
|
||||||
|
|
|
||||||
47 | uri!(has_one: id = 100, id = 100, ); //~ ERROR invalid parameters
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: uri parameters are: id: i32
|
|
||||||
help: duplicate parameter: `id`
|
|
||||||
--> $DIR/typed-uris-bad-params.rs:47:29
|
|
||||||
|
|
|
||||||
47 | uri!(has_one: id = 100, id = 100, ); //~ ERROR invalid parameters
|
|
||||||
| ^^
|
|
||||||
|
|
||||||
error: invalid parameters for `has_one` route uri
|
|
||||||
--> $DIR/typed-uris-bad-params.rs:50:19
|
|
||||||
|
|
|
||||||
50 | uri!(has_one: name = "hi"); //~ ERROR invalid parameters
|
|
||||||
| ^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: uri parameters are: id: i32
|
|
||||||
= help: missing parameter: `id`
|
|
||||||
help: unknown parameter: `name`
|
|
||||||
--> $DIR/typed-uris-bad-params.rs:50:19
|
|
||||||
|
|
|
||||||
50 | uri!(has_one: name = "hi"); //~ ERROR invalid parameters
|
|
||||||
| ^^^^
|
|
||||||
|
|
||||||
error: invalid parameters for `has_one_guarded` route uri
|
|
||||||
--> $DIR/typed-uris-bad-params.rs:54:27
|
|
||||||
|
|
|
||||||
54 | uri!(has_one_guarded: cookies = "hi", id = 100); //~ ERROR invalid parameters
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: uri parameters are: id: i32
|
|
||||||
help: unknown parameter: `cookies`
|
|
||||||
--> $DIR/typed-uris-bad-params.rs:54:27
|
|
||||||
|
|
|
||||||
54 | uri!(has_one_guarded: cookies = "hi", id = 100); //~ ERROR invalid parameters
|
|
||||||
| ^^^^^^^
|
|
||||||
|
|
||||||
error: invalid parameters for `has_one_guarded` route uri
|
|
||||||
--> $DIR/typed-uris-bad-params.rs:57:27
|
|
||||||
|
|
|
||||||
57 | uri!(has_one_guarded: id = 100, cookies = "hi"); //~ ERROR invalid parameters
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: uri parameters are: id: i32
|
|
||||||
help: unknown parameter: `cookies`
|
|
||||||
--> $DIR/typed-uris-bad-params.rs:57:37
|
|
||||||
|
|
|
||||||
57 | uri!(has_one_guarded: id = 100, cookies = "hi"); //~ ERROR invalid parameters
|
|
||||||
| ^^^^^^^
|
|
||||||
|
|
||||||
error: invalid parameters for `has_two` route uri
|
error: invalid parameters for `has_two` route uri
|
||||||
--> $DIR/typed-uris-bad-params.rs:60:19
|
--> $DIR/typed-uris-bad-params.rs:72:19
|
||||||
|
|
|
|
||||||
60 | uri!(has_two: id = 100, id = 100, ); //~ ERROR invalid parameters
|
72 | uri!(has_two: id = 100, cookies = "hi"); //~ ERROR invalid parameters
|
||||||
| ^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: uri parameters are: id: i32, name: String
|
= note: uri parameters are: id: i32, name: String
|
||||||
= help: missing parameter: `name`
|
= help: missing parameter: `name`
|
||||||
help: duplicate parameter: `id`
|
help: unknown parameter: `cookies`
|
||||||
--> $DIR/typed-uris-bad-params.rs:60:29
|
--> $DIR/typed-uris-bad-params.rs:72:29
|
||||||
|
|
|
|
||||||
60 | uri!(has_two: id = 100, id = 100, ); //~ ERROR invalid parameters
|
72 | uri!(has_two: id = 100, cookies = "hi"); //~ ERROR invalid parameters
|
||||||
| ^^
|
| ^^^^^^^
|
||||||
|
|
||||||
error: invalid parameters for `has_two` route uri
|
|
||||||
--> $DIR/typed-uris-bad-params.rs:64:19
|
|
||||||
|
|
|
||||||
64 | uri!(has_two: name = "hi"); //~ ERROR invalid parameters
|
|
||||||
| ^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: uri parameters are: id: i32, name: String
|
|
||||||
= help: missing parameter: `id`
|
|
||||||
|
|
||||||
error: invalid parameters for `has_two` route uri
|
error: invalid parameters for `has_two` route uri
|
||||||
--> $DIR/typed-uris-bad-params.rs:67:19
|
--> $DIR/typed-uris-bad-params.rs:67:19
|
||||||
|
@ -212,30 +44,198 @@ help: duplicate parameter: `id`
|
||||||
| ^^ ^^
|
| ^^ ^^
|
||||||
|
|
||||||
error: invalid parameters for `has_two` route uri
|
error: invalid parameters for `has_two` route uri
|
||||||
--> $DIR/typed-uris-bad-params.rs:72:19
|
--> $DIR/typed-uris-bad-params.rs:64:19
|
||||||
|
|
|
|
||||||
72 | uri!(has_two: id = 100, cookies = "hi"); //~ ERROR invalid parameters
|
64 | uri!(has_two: name = "hi"); //~ ERROR invalid parameters
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= 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:60:19
|
||||||
|
|
|
||||||
|
60 | uri!(has_two: id = 100, id = 100, ); //~ ERROR invalid parameters
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: uri parameters are: id: i32, name: String
|
= note: uri parameters are: id: i32, name: String
|
||||||
= help: missing parameter: `name`
|
= help: missing parameter: `name`
|
||||||
help: unknown parameter: `cookies`
|
help: duplicate parameter: `id`
|
||||||
--> $DIR/typed-uris-bad-params.rs:72:29
|
--> $DIR/typed-uris-bad-params.rs:60:29
|
||||||
|
|
|
|
||||||
72 | uri!(has_two: id = 100, cookies = "hi"); //~ ERROR invalid parameters
|
60 | uri!(has_two: id = 100, id = 100, ); //~ ERROR invalid parameters
|
||||||
|
| ^^
|
||||||
|
|
||||||
|
error: invalid parameters for `has_one_guarded` route uri
|
||||||
|
--> $DIR/typed-uris-bad-params.rs:57:27
|
||||||
|
|
|
||||||
|
57 | uri!(has_one_guarded: id = 100, cookies = "hi"); //~ ERROR invalid parameters
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: uri parameters are: id: i32
|
||||||
|
help: unknown parameter: `cookies`
|
||||||
|
--> $DIR/typed-uris-bad-params.rs:57:37
|
||||||
|
|
|
||||||
|
57 | uri!(has_one_guarded: id = 100, cookies = "hi"); //~ ERROR invalid parameters
|
||||||
| ^^^^^^^
|
| ^^^^^^^
|
||||||
|
|
||||||
error: path parameters cannot be ignored
|
error: invalid parameters for `has_one_guarded` route uri
|
||||||
--> $DIR/typed-uris-bad-params.rs:76:26
|
--> $DIR/typed-uris-bad-params.rs:54:27
|
||||||
|
|
|
|
||||||
76 | uri!(optionals: id = _, name = "bob".into());
|
54 | uri!(has_one_guarded: cookies = "hi", id = 100); //~ ERROR invalid parameters
|
||||||
| ^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: uri parameters are: id: i32
|
||||||
|
help: unknown parameter: `cookies`
|
||||||
|
--> $DIR/typed-uris-bad-params.rs:54:27
|
||||||
|
|
|
||||||
|
54 | uri!(has_one_guarded: cookies = "hi", id = 100); //~ ERROR invalid parameters
|
||||||
|
| ^^^^^^^
|
||||||
|
|
||||||
error: path parameters cannot be ignored
|
error: invalid parameters for `has_one` route uri
|
||||||
--> $DIR/typed-uris-bad-params.rs:79:37
|
--> $DIR/typed-uris-bad-params.rs:50:19
|
||||||
|
|
|
|
||||||
79 | uri!(optionals: id = 10, name = _);
|
50 | uri!(has_one: name = "hi"); //~ ERROR invalid parameters
|
||||||
| ^
|
| ^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: uri parameters are: id: i32
|
||||||
|
= help: missing parameter: `id`
|
||||||
|
help: unknown parameter: `name`
|
||||||
|
--> $DIR/typed-uris-bad-params.rs:50:19
|
||||||
|
|
|
||||||
|
50 | uri!(has_one: name = "hi"); //~ ERROR invalid parameters
|
||||||
|
| ^^^^
|
||||||
|
|
||||||
|
error: invalid parameters for `has_one` route uri
|
||||||
|
--> $DIR/typed-uris-bad-params.rs:47:19
|
||||||
|
|
|
||||||
|
47 | uri!(has_one: id = 100, id = 100, ); //~ ERROR invalid parameters
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: uri parameters are: id: i32
|
||||||
|
help: duplicate parameter: `id`
|
||||||
|
--> $DIR/typed-uris-bad-params.rs:47:29
|
||||||
|
|
|
||||||
|
47 | uri!(has_one: id = 100, id = 100, ); //~ ERROR invalid parameters
|
||||||
|
| ^^
|
||||||
|
|
||||||
|
error: invalid parameters for `has_one` route uri
|
||||||
|
--> $DIR/typed-uris-bad-params.rs:44:19
|
||||||
|
|
|
||||||
|
44 | uri!(has_one: id = 100, id = 100); //~ ERROR invalid parameters
|
||||||
|
| ^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: uri parameters are: id: i32
|
||||||
|
help: duplicate parameter: `id`
|
||||||
|
--> $DIR/typed-uris-bad-params.rs:44:29
|
||||||
|
|
|
||||||
|
44 | uri!(has_one: id = 100, id = 100); //~ ERROR invalid parameters
|
||||||
|
| ^^
|
||||||
|
|
||||||
|
error: invalid parameters for `has_one` route uri
|
||||||
|
--> $DIR/typed-uris-bad-params.rs:40:19
|
||||||
|
|
|
||||||
|
40 | uri!(has_one: name = 100, age = 50, id = 100, id = 50); //~ ERROR invalid parameters
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: uri parameters are: id: i32
|
||||||
|
help: unknown parameters: `name`, `age`
|
||||||
|
--> $DIR/typed-uris-bad-params.rs:40:19
|
||||||
|
|
|
||||||
|
40 | uri!(has_one: name = 100, age = 50, id = 100, id = 50); //~ ERROR invalid parameters
|
||||||
|
| ^^^^ ^^^
|
||||||
|
help: duplicate parameter: `id`
|
||||||
|
--> $DIR/typed-uris-bad-params.rs:40:51
|
||||||
|
|
|
||||||
|
40 | uri!(has_one: name = 100, age = 50, id = 100, id = 50); //~ ERROR invalid parameters
|
||||||
|
| ^^
|
||||||
|
|
||||||
|
error: invalid parameters for `has_one` route uri
|
||||||
|
--> $DIR/typed-uris-bad-params.rs:37:19
|
||||||
|
|
|
||||||
|
37 | uri!(has_one: name = 100, age = 50, id = 100); //~ ERROR invalid parameters
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: uri parameters are: id: i32
|
||||||
|
help: unknown parameters: `name`, `age`
|
||||||
|
--> $DIR/typed-uris-bad-params.rs:37:19
|
||||||
|
|
|
||||||
|
37 | uri!(has_one: name = 100, age = 50, id = 100); //~ ERROR invalid parameters
|
||||||
|
| ^^^^ ^^^
|
||||||
|
|
||||||
|
error: invalid parameters for `has_one` route uri
|
||||||
|
--> $DIR/typed-uris-bad-params.rs:34:19
|
||||||
|
|
|
||||||
|
34 | 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:34:19
|
||||||
|
|
|
||||||
|
34 | uri!(has_one: name = 100, id = 100); //~ ERROR invalid parameters
|
||||||
|
| ^^^^
|
||||||
|
|
||||||
|
error: invalid parameters for `has_one` route uri
|
||||||
|
--> $DIR/typed-uris-bad-params.rs:31:19
|
||||||
|
|
|
||||||
|
31 | uri!(has_one: id = 100, name = "hi"); //~ ERROR invalid parameters
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: uri parameters are: id: i32
|
||||||
|
help: unknown parameter: `name`
|
||||||
|
--> $DIR/typed-uris-bad-params.rs:31:29
|
||||||
|
|
|
||||||
|
31 | uri!(has_one: id = 100, name = "hi"); //~ ERROR invalid parameters
|
||||||
|
| ^^^^
|
||||||
|
|
||||||
|
error: `has_two` route uri expects 2 parameters but 1 was supplied
|
||||||
|
--> $DIR/typed-uris-bad-params.rs:29:19
|
||||||
|
|
|
||||||
|
29 | uri!(has_two: 10); //~ ERROR expects 2 parameters but 1
|
||||||
|
| ^^
|
||||||
|
|
|
||||||
|
= 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:28:19
|
||||||
|
|
|
||||||
|
28 | uri!(has_two: 10, "hi", "there"); //~ ERROR expects 2 parameters but 3
|
||||||
|
| ^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= 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:26:27
|
||||||
|
|
|
||||||
|
26 | uri!(has_one_guarded: "hi", 100); //~ ERROR expects 1 parameter but 2
|
||||||
|
| ^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: expected parameter: id: i32
|
||||||
|
|
||||||
|
error: `has_one` route uri expects 1 parameter but 2 were supplied
|
||||||
|
--> $DIR/typed-uris-bad-params.rs:25:19
|
||||||
|
|
|
||||||
|
25 | uri!(has_one: "Hello", 23, ); //~ ERROR expects 1 parameter but 2
|
||||||
|
| ^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: expected parameter: id: i32
|
||||||
|
|
||||||
|
error: `has_one` route uri expects 1 parameter but 2 were supplied
|
||||||
|
--> $DIR/typed-uris-bad-params.rs:24:19
|
||||||
|
|
|
||||||
|
24 | uri!(has_one: 1, 23); //~ ERROR expects 1 parameter but 2
|
||||||
|
| ^^^^^
|
||||||
|
|
|
||||||
|
= note: expected parameter: id: i32
|
||||||
|
|
||||||
|
error: `has_one` route uri expects 1 parameter but 0 were supplied
|
||||||
|
--> $DIR/typed-uris-bad-params.rs:22:10
|
||||||
|
|
|
||||||
|
22 | uri!(has_one); //~ ERROR expects 1 parameter but 0
|
||||||
|
| ^^^^^^^
|
||||||
|
|
|
||||||
|
= note: expected parameter: id: i32
|
||||||
|
|
||||||
error: aborting due to 21 previous errors
|
error: aborting due to 21 previous errors
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#![feature(proc_macro_hygiene, decl_macro)]
|
#![feature(proc_macro_hygiene)]
|
||||||
|
|
||||||
#[cfg(test)] mod tests;
|
#[cfg(test)] mod tests;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue