Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(insert sig lifetime): key and value should have different lifetimes #659

Merged
merged 1 commit into from
Aug 20, 2023
Merged

fix(insert sig lifetime): key and value should have different lifetimes #659

merged 1 commit into from
Aug 20, 2023

Conversation

zjp-CN
Copy link
Contributor

@zjp-CN zjp-CN commented Aug 18, 2023

also add generic_signature_lifetimes test for it


For the latest version, the write_key_generic function won't compile:

error[E0597]: `buf` does not live long enough
  --> src/main.rs:27:31
   |
20 |         key: K::SelfType<'_>,
   |         --- has type `<K as RedbValue>::SelfType<'1>`
...
23 |         let buf = [1, 2, 3];
   |             --- binding `buf` declared here
...
27 |             table.insert(key, buf.as_slice()).unwrap();
   |             ------------------^^^^^^^^^^^^^^-
   |             |                 |
   |             |                 borrowed value does not live long enough
   |             argument requires that `buf` is borrowed for `'1`
...
30 |     }
   |     - `buf` dropped here while still borrowed

also add `generic_signature_lifetimes` test for it
Copy link
Owner

@cberner cberner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, except one minor thing

src/multimap_table.rs Show resolved Hide resolved
@cberner cberner merged commit f729669 into cberner:master Aug 20, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants