Closed
Description
Because a &T
type is copyable, it is currently possible to close over them using an fn@()
(and, eventually, iface@
). This is clearly wrong. We need a new kind---perhaps heap
or gc
?---indicating data which is not only copyable but also copyable into a shared closure. This goes in between copy/send, I think.
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
graydon commentedon Apr 20, 2012
Shared or unique, same problem.
I don't think this is a kinding problem, I think it's a region problem. You should not be able to write a region pointer into any region other than one of its own subregions. Forming a heap closure is such a write, and should be prohibited just as forming a heap record full of stack region pointers would be.
nikomatsakis commentedon Apr 20, 2012
A heap record is totally allowed.
nikomatsakis commentedon Apr 20, 2012
To clarify, it is legal to do this:
that poses no particular problem. I could see it being useful if you have a long-running computation with some context that is passed by region ptr, but the internal data used by the computation might be garbage-collected.
Naturally all of those heap-allocated records will not be accessible after the computation finishes.
graydon commentedon Apr 20, 2012
Wow, I totally thought (and think) that should not be legal. We'll have to discuss once I'm at an irc window :)
nikomatsakis commentedon Jul 17, 2012
this is done for closures in commit 0e42004
pnkfelix commentedon Jun 13, 2013
related to #5723
Aatch commentedon Aug 13, 2013
I think that has been fixed by the work @bblum did on trait and closure bounds.
Closing, re-open if I'm wrong.
bblum commentedon Aug 13, 2013
I didn't solve region-related issues; we still lack the capability to write
~Trait:'a
or somesuch. @nikomatsakis can confirm.catamorphism commentedon Sep 26, 2013
Marked as clarifying - @nikomatsakis will investigate.
pcwalton commentedon Nov 22, 2013
Nominating because I believe this is fixed.
pnkfelix commentedon Dec 19, 2013
@nikomatsakis still needs to investigate, he is not certain it is fixed, and if it isn't, it still is on plate for 1.0
aturon commentedon Sep 18, 2014
Nominating. I believe this issue has been resolved with #16453
pnkfelix commentedon Sep 18, 2014
closing as fixed
Auto merge of rust-lang#2203 - RalfJung:deprecate, r=oli-obk
Merge pull request rust-lang#2203 from camelid/ci-fix