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

Parse block expr as verbatim in non-full mode #1478

Merged
merged 1 commit into from Jul 2, 2023
Merged

Conversation

dtolnay
Copy link
Owner

@dtolnay dtolnay commented Jul 2, 2023

This commonly comes up in array sizes, when working with const generic parameters computed from a type parameter.

#![feature(generic_const_exprs)]

struct Foo<T: strum::EnumCount>
where
    [(); { T::COUNT }]:,
{
    foo: heapless::Vec<u8, { T::COUNT }>,
}

We can't parse them as Expr::Block because that data structure contains a field of type Vec<Stmt>, and Stmt is "full"-only.

But parsing as Expr::Verbatim will at least allow this where-clause to round trip.

@dtolnay dtolnay merged commit e9a3846 into master Jul 2, 2023
28 checks passed
@dtolnay dtolnay deleted the nonfullblock branch July 2, 2023 19:39
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.

None yet

1 participant