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 program both compiles and runs just fine. I thought that this should be an error, though. In the Foo::foo method, the field n is cast to an immutable borrowed pointer for the duration of the iteration, and it then yields a pointer to inside itself to fun. There are no restrictions on fun, however, so if fun does something like insert into n, it might invalidate the pointer due to something like resizing.
Should this actually be allowed or disallowed? I was hoping it would be disallowed because it seems like a bug to me. I also don't want to see pure come back though...
The text was updated successfully, but these errors were encountered:
For something like this program:
The program both compiles and runs just fine. I thought that this should be an error, though. In the
Foo::foo
method, the fieldn
is cast to an immutable borrowed pointer for the duration of the iteration, and it then yields a pointer to inside itself tofun
. There are no restrictions onfun
, however, so iffun
does something like insert inton
, it might invalidate the pointer due to something like resizing.Should this actually be allowed or disallowed? I was hoping it would be disallowed because it seems like a bug to me. I also don't want to see
pure
come back though...The text was updated successfully, but these errors were encountered: