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

struct_iterable doesn't work if struct contains lifetimes #1

Open
arifd opened this issue Aug 5, 2023 · 1 comment
Open

struct_iterable doesn't work if struct contains lifetimes #1

arifd opened this issue Aug 5, 2023 · 1 comment

Comments

@arifd
Copy link

arifd commented Aug 5, 2023

Hi! Perfect little crate! But unfortunately this won't work:

use struct_iterable::Iterable;

#[derive(Iterable)]
struct Foo<'a> {
    s: &'a str
}

fn main() {
    let s = "hello";
    let foo = Foo { s };
    for (k, _) in foo.iter() {
        println!("{k}");
    }
}
error[E0726]: implicit elided lifetime not allowed here
 --> src/lib.rs:4:8
  |
4 | struct Foo<'a> {
  |        ^^^ expected lifetime parameter
  |
help: indicate the anonymous lifetime
  |
4 | struct Foo<'_><'a> {
  |           ++++

For more information about this error, try `rustc --explain E0726`.
error: could not compile `arif` (lib) due to previous error
@decomoraes
Copy link
Owner

Hi Arif! Thank you so much, I'll check the issue, sorry for the late.

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

No branches or pull requests

2 participants