GATs are stable
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
fd686e7795
commit
cdac2a88f8
@ -267,13 +267,6 @@ impl TryFrom<Field> for ResponseField {
|
|||||||
type Error = syn::Error;
|
type Error = syn::Error;
|
||||||
|
|
||||||
fn try_from(mut field: Field) -> syn::Result<Self> {
|
fn try_from(mut field: Field) -> syn::Result<Self> {
|
||||||
if has_lifetime(&field.ty) {
|
|
||||||
return Err(syn::Error::new_spanned(
|
|
||||||
field.ident,
|
|
||||||
"Lifetimes on Response fields cannot be supported until GAT are stable",
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
let (mut api_attrs, attrs) =
|
let (mut api_attrs, attrs) =
|
||||||
field.attrs.into_iter().partition::<Vec<_>, _>(|attr| attr.path().is_ident("ruma_api"));
|
field.attrs.into_iter().partition::<Vec<_>, _>(|attr| attr.path().is_ident("ruma_api"));
|
||||||
field.attrs = attrs;
|
field.attrs = attrs;
|
||||||
@ -305,6 +298,7 @@ impl ToTokens for ResponseField {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
fn has_lifetime(ty: &Type) -> bool {
|
fn has_lifetime(ty: &Type) -> bool {
|
||||||
struct Visitor {
|
struct Visitor {
|
||||||
found_lifetime: bool,
|
found_lifetime: bool,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user