You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The example for syn::parse_str even shows itself parsing an Expr successfully, which further confused me until I read the code. I guess it can't be a compiler error since it seems intentional that some expressions are allowed to be parsed even when full is disabled (and it's a trait method anyway). Is there a way to make the feature requirement more obvious, like in the doc comment of parse_str or the error message?
The text was updated successfully, but these errors were encountered:
Another code that breaks from moving 0.11 -> 0.12 (0.12.7 as of writing) looks like:
enum Foo {
A = (1 + 2) + 3,
}
due to ExprParen only available with "full" feature.
Though this is not something users of proc_macro_derive type of crates likely write, I think it is useful to document corner cases which break from 0.11 -> 0.12 migration to smooth the transition of the whole syn-related ecosystem.
This is kind of a usability regression from v0.11. That version only exposed
syn::parse_expr
iffull
feature was enabled:which meant the user obviously knew to enable the feature if they wanted to be able to parse expressions.
Now that
parse_*
have been replaced bysyn::parse_str
, the user can write this code that only fails at runtime with a somewhat unclear message:... until the user reads the source of
syn
and realizes that thefull
feature is (still) necessary:The example for
syn::parse_str
even shows itself parsing anExpr
successfully, which further confused me until I read the code. I guess it can't be a compiler error since it seems intentional that some expressions are allowed to be parsed even whenfull
is disabled (and it's a trait method anyway). Is there a way to make the feature requirement more obvious, like in the doc comment ofparse_str
or the error message?The text was updated successfully, but these errors were encountered: