Ignore skipped fields when looking for borrowed lifetimes

This commit is contained in:
David Tolnay committed 2017-11-03 10:08:02 -07:00
1 parent 2a557a1e36
commit d5e5c520ac
2 files changed
+11 -1

No files matched your search

+3 -1
View File
@@ -203,7 +203,9 @@ impl BorrowedLifetimes {
fn borrowed_lifetimes(cont: &Container) -> BorrowedLifetimes {
let mut lifetimes = BTreeSet::new();
for field in cont.body.all_fields() {
lifetimes.extend(field.attrs.borrowed_lifetimes().iter().cloned());
if !field.attrs.skip_deserializing() {
lifetimes.extend(field.attrs.borrowed_lifetimes().iter().cloned());
}
}
if lifetimes.iter().any(|b| b.ident == "'static") {
BorrowedLifetimes::Static