mirror of https://github.com/rwf2/Rocket.git
parent
07fe79796f
commit
260e671d43
|
@ -10,6 +10,7 @@ use crate::proc_macro_ext::StringLit;
|
|||
use crate::syn_ext::{IdentExt, TypeExt as _};
|
||||
use crate::http_codegen::{Method, Optional};
|
||||
use crate::attribute::param::Guard;
|
||||
use crate::exports::mixed;
|
||||
|
||||
use self::parse::{Route, Attribute, MethodAttribute};
|
||||
|
||||
|
@ -242,7 +243,7 @@ fn responder_outcome_expr(route: &Route) -> TokenStream {
|
|||
.map(|a| quote_spanned!(a.span() => .await));
|
||||
|
||||
define_spanned_export!(ret_span => __req, _route);
|
||||
quote_spanned! { Span::mixed_site().located_at(ret_span) =>
|
||||
quote_spanned! { mixed(ret_span) =>
|
||||
let ___responder = #user_handler_fn_name(#(#parameter_names),*) #_await;
|
||||
#_route::Outcome::from(#__req, ___responder)
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ fn add_binding<P: fmt::Part>(to: &mut Vec<TokenStream>, ident: &Ident, ty: &Type
|
|||
let tmp_ident = ident.clone().with_span(expr.span());
|
||||
let let_stmt = quote_spanned!(span => let #tmp_ident = #expr);
|
||||
|
||||
to.push(quote_spanned!(span =>
|
||||
to.push(quote_spanned!(mixed(span) =>
|
||||
#[allow(non_snake_case)] #let_stmt;
|
||||
let #ident = <#ty as #_fmt::FromUriParam<#part, _>>::from_uri_param(#tmp_ident);
|
||||
));
|
||||
|
|
|
@ -106,3 +106,9 @@ define_exported_paths! {
|
|||
macro_rules! define_spanned_export {
|
||||
($span:expr => $($name:ident),*) => ($(define!($span => $name $name);)*)
|
||||
}
|
||||
|
||||
/// Convenience: returns a "mixed site" span located at `span`.
|
||||
#[inline(always)]
|
||||
pub fn mixed(span: Span) -> Span {
|
||||
Span::mixed_site().located_at(span)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue