-
-
Notifications
You must be signed in to change notification settings - Fork 43
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
Array as map key #657
Comments
The problem is this line:
Within a method call chain, temporary values that aren't moved are dropped at the end of the chain. In this case the To better understand this, the line in question is essentially the same as this:
What you want to do instead here is something like this:
However, in doing so you'll most likely run into the bug outlined in #636. You can however work around that by adding an explicit type annotation to Looking at the documentation, I realized I didn't document how drops work for method call chains. In fact, the only documentation on method calls is the syntax guide, which isn't great. I'll create an issue for that. |
The issue in question is #658. |
Since this isn't an actual bug but rather the result of lacking documentation, I'll close this in favour of #658 |
Thanks for the guidance. I guess this can be closed since it's expected behavior.. |
@yorickpeterse take a look if you have the time: jinyus/related_post_gen#440 |
Please describe the bug
Is this possible with a mutable array? somehow it's not detecting that the new array shouldn't be dropped.
Sample repo: https://github.com/jinyus/inko_demo
Code:
Error:
ps: I'm trying to add inko to my benchmark: https://github.com/jinyus/related_post_gen
Please list the exact steps necessary to reproduce the bug
git clone https://github.com/jinyus/inko_demo.git
cd inko_demo
inko run demo.inko
Operating system
Linux (6.6.1-arch1-1)
Inko version
0.13.1
Rust version
1.73.0 (cc66ad468 2023-10-03)
The text was updated successfully, but these errors were encountered: