Fix panic when a reference has unspecified lifetime
This will fail later in compilation anyway, but serde_derive needs to not crash before then. #[derive(Deserialize)] struct A { field: &str, } error[E0106]: missing lifetime specifier --> src/main.rs | | field: &str, | ^ expected lifetime parameter
This commit is contained in:
parent
5bc805329e
commit
56b2e39dda
@ -936,7 +936,7 @@ impl Field {
|
||||
} else if is_rptr(&field.ty, is_str) || is_rptr(&field.ty, is_slice_u8) {
|
||||
// Types &str and &[u8] are always implicitly borrowed. No need for
|
||||
// a #[serde(borrow)].
|
||||
borrowed_lifetimes = borrowable_lifetimes(cx, &ident, &field.ty).unwrap();
|
||||
collect_lifetimes(&field.ty, &mut borrowed_lifetimes);
|
||||
}
|
||||
|
||||
let ser_name = ser_name.get();
|
||||
|
Loading…
x
Reference in New Issue
Block a user