-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
rustc error message prose style in "recursive type T
has infinite size"
#31683
Comments
I would not recommend adding:
but it's not like I can stop you. |
The cycle can also contain enums - in which case an OTOH, I see the point of adding the relevant field (and variant) to the backtrace of structural traits/default traits/OIBITs, as ADTs can get quite large. |
A possible example:
or for more complicated cases
|
I quite like this error. At least keeping around the spirit of the message would be nice. When I was building my compiler, I saw this error and it made me stop for a second and smile :) |
OK, this is clearly not something worth changing. |
Sorry for commenting on this but I think this is currently broken: #32417 |
Stable (1.6):
Nightly (1.8):
Proposed:
In the indirect case, it could say
field
fooof struct
Tcan't contain a nested value of type
T(
t.foo.bar.t)
.My objection to the version in Nightly is that "infinite size" (a) feels a little jargony, (b) attributes to the user (i.e. me) (or at least my code) the ridiculous motive of wanting infinitely large, infinitely nested values.
I guess I would leave the "help" to the detailed explanation. Nightly suggests using
Box
orRc
or&
, which would fix one problem but create others, right? Without also adding anOption
, you'd have to use unsafe code to create values of such types.The text was updated successfully, but these errors were encountered: