Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ use syn::parse::{ParseStream, Parser};
use syn::visit::{self, Visit};
use syn::{
braced, punctuated, token, Attribute, Data, DeriveInput, Error, Expr, Field, Fields,
FieldsNamed, FieldsUnnamed, GenericParam, Generics, Ident, PredicateType, Result, Token,
TraitBound, Type, TypeMacro, TypeParamBound, TypePath, WhereClause, WherePredicate,
FieldsNamed, FieldsUnnamed, GenericParam, Generics, Ident, Lifetime, PredicateType, Result,
Token, TraitBound, Type, TypeMacro, TypeParamBound, TypePath, WhereClause, WherePredicate,
};

use quote::{format_ident, quote_spanned, ToTokens};
Expand Down Expand Up @@ -476,6 +476,16 @@ fn get_ty_params(field: &Field, generics: &Generics) -> Vec<bool> {
}
}

fn visit_lifetime(&mut self, id: &'a Lifetime) {
for (idx, i) in self.generics.params.iter().enumerate() {
if let GenericParam::Lifetime(lparam) = i {
if lparam.lifetime == *id {
self.result[idx] = true;
}
}
}
}

fn visit_type_macro(&mut self, x: &'a TypeMacro) {
// If we see a type_mac declaration, then we can't know what type parameters
// it might be binding, so we presume it binds all of them.
Expand Down