-
-
Notifications
You must be signed in to change notification settings - Fork 791
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
overflow evaluating the requirement test_ser::Outer: test_annotations::serde::Serialize
#441
Comments
This is due to your mutually recursive structure. It should probably be documented in a better way. Sorry about the breaking in a minor version, but everything else was worse for the common case.
|
I can confirm having the same issue with this case: https://gist.github.com/mitsuhiko/f0e5984755403cf785db389569b12043 |
I would propose yanking the release an making a new release with a higher version number if this is not going to be changed. From what I can tell this broke all my projects using JSON types. |
actually the change I was thinking about happened in https://github.com/serde-rs/serde/releases/tag/v0.7.8 ... 0.7.12 was a pure syntex bump, meaning only nightly stuff should break. |
@oli-obk cool, thanks for looking into this. I've decided to write a custom |
This broke some stuff in our crate as well (rusoto/rusoto#302), though adding the Seeing the commit above https://github.com/serde-rs/serde/pull/416/files that removes the generic type check is kind of confusing. Is the expectation now that crates that depend on serde will re-implement the logic that was pulled out? We read a schema (botocore) and generate serde-annotated Rust code based on it, which is then passed through |
I guess maybe to rephrase - due to the way bounds were implemented before the change in #416, recursively defined types didn't cause explosions and they now do. Is it now expected that we'll annotate places where recursion occurs? If this were hand-written code it'd be a little less painful, but since it's generated from a schema, to solve the generic case I'll need to put in some checks for type loops in case the schema changes under me. |
No, #416 is only tangentially related. Assume struct S {
r: Recursive
}
struct S<T> {
r: Recursive<T>
}
The filtering that was removed in #416 affects only the first case, but the second case requires a The second case is interesting because neither bound is uniformly better. If the impl for Recursive looks like Basically in 0.7 we learned that recursive types are more common than bounds that behave like |
To clarify why I say that #416 is only tangentially related: from the first example in my previous comment, it looks like the solution is to revert #416 and put the filtering back in. But as you can see from the second example, that is not right. #416 is related only to the extent that it affects bounds generation. |
I have noticed an issue in one of my projects, that I have been able to reduce to the following example:
This fails to compile with:
These examples compiled in 0.7.11 and earlier, but has failed in 0.7.12 and all versions since.
The text was updated successfully, but these errors were encountered: