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

Context cannot contain a reference #319

Open
space-elephant opened this issue Feb 1, 2023 · 1 comment
Open

Context cannot contain a reference #319

space-elephant opened this issue Feb 1, 2023 · 1 comment
Labels
question Further information is requested

Comments

@space-elephant
Copy link

When I use a reference in the context, it doesn't have the right lifetime.

error[E0106]: missing lifetime specifier
   --> src/main.rs:371:10
    |
371 | #[derive(DekuRead, DekuWrite)]
    |          ^^^^^^^^ expected named lifetime parameter
    |
    = help: this function's return type contains a borrowed value, but the signature does not say which one of `__deku_input_bits`'s 2 lifetimes it is borrowed from
    = note: this error originates in the derive macro `DekuRead` (in Nightly builds, run with -Z macro-backtrace for more info)

Could this be fixed by not using lifetime elision in deku_read? Something like this?

            fn read<'a>(__deku_input_bits: &'a #lifetime ::#crate_::bitvec::BitSlice<u8, ::#crate_::bitvec::Msb0>, #ctx_arg) -> Result<(&'a #lifetime ::#crate_::bitvec::BitSlice<u8, ::#crate_::bitvec::Msb0>, Self), ::#crate_::DekuError> {

@sharksforarms
Copy link
Owner

Can you provide a failing example?

@sharksforarms sharksforarms added the question Further information is requested label Feb 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants