diff options
author | Florian Klink <flokli@flokli.de> | 2024-04-07T20·40+0300 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2024-04-07T21·21+0000 |
commit | d00c75ea9cd2d31d6e0f02fa678678519317182c (patch) | |
tree | c5959f320619f2993d59d2eebe17310a2fc6dfac /tvix/nix-compat/src/wire | |
parent | efd8ab5e0b595648acad8a96d0b4f0d49fddee8f (diff) |
fix(nix-compat/store_path): fix Deserialize with borrow r/7869
We were wrongly using `'de` as a lifetime for both `Deserializer` and `StorePathRef`. This prevented Deserializing into a struct containing `StorePathRef`. See https://serde.rs/lifetimes.html#the-deserializede-lifetime, the last part of the paragraph: The 'de lifetime should not appear in the type to which the Deserialize impl applies. - // Do not do this. Sooner or later you will be sad. - impl<'de> Deserialize<'de> for Q<'de> { + // Do this instead. + impl<'de: 'a, 'a> Deserialize<'de> for Q<'a> { This fixes it, and adds a test, deserializing into a `Container` struct. It also fixes the existing test cases, deserialize_ref was actually deserialize_owned, and deserialize_owned didn't exist yet - but they alone are not enough to provoke the lifetime issues. Change-Id: Iaed2832998cae5f192eafe7fd5243e82ff6e051e Reviewed-on: https://cl.tvl.fyi/c/depot/+/11372 Tested-by: BuildkiteCI Autosubmit: flokli <flokli@flokli.de> Reviewed-by: picnoir picnoir <picnoir@alternativebit.fr>
Diffstat (limited to 'tvix/nix-compat/src/wire')
0 files changed, 0 insertions, 0 deletions