Potential overflow in the calculation of complex trait bounds involving tuples #126401
Labels
A-traits
Area: Trait system
C-bug
Category: This is a bug.
D-confusing
Diagnostics: Confusing error or lint that should be reworked.
T-types
Relevant to the types team, which will review and decide on the PR/issue.
When using a trait which is constrained by some bounds, and is implanted automatically for types satisfying those bounds (seen often as the equivalent of type alias in traits), the compiler can run into overflow evaluating bound requirement, which only happen with the helper trait (and not the full bound),
I tried this code:
playground link
I expected to see this happen: This code should compile, with both
test1
andtest2
(or at the very least not compile with either one).Instead, this happened: This code compiles with
test1
, but addingtest2
causes an overflow in the tuple implementation and prevents the code from compiling (even though the two functions are practically with the same bounds).Meta
This happens on all channels (as can be seen in the playground), but here is the local nightly compiler I tried debugging this with:
rustc --version --verbose
:For the curious, this structure of code arose from trying to work with serde's
DeserializeSeed
, which in this example I replaced with the traitHello
.The text was updated successfully, but these errors were encountered: