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

#[auto_enum] on non-statement expression does not work without unstable features #90

Closed
taiki-e opened this issue Apr 14, 2020 · 1 comment · Fixed by #97
Closed

#[auto_enum] on non-statement expression does not work without unstable features #90

taiki-e opened this issue Apr 14, 2020 · 1 comment · Fixed by #97
Assignees
Labels
A-auto_enum Area: #[auto_enum] C-bug Category: related to a bug.

Comments

@taiki-e
Copy link
Owner

taiki-e commented Apr 14, 2020

#[auto_enum]
fn match_(x: bool) -> Option<impl Iterator<Item = u8>> {
    Some(
        #[auto_enum(Iterator)]
        match x {
            true => std::iter::once(0),
            _ => std::iter::repeat(1),
        },
    )
}

#[auto_enum]
fn if_(x: bool) -> Option<impl Iterator<Item = u8>> {
    Some(
        #[auto_enum(Iterator)]
        if x { std::iter::once(0) } else { std::iter::repeat(1) },
    )
}

Related: #86

@taiki-e taiki-e added the C-bug Category: related to a bug. label Apr 14, 2020
@taiki-e
Copy link
Owner Author

taiki-e commented Apr 14, 2020

pin-project using the same logic should also have this problem: taiki-e/pin-project#189

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-auto_enum Area: #[auto_enum] C-bug Category: related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant