Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upFunction pointer lifetimes #252
Conversation
This comment has been minimized.
This comment has been minimized.
|
I think no lifetime should behave just like an reference does. I imagine that there are few if any use cases that need the function pointer to escape. |
This comment has been minimized.
This comment has been minimized.
|
@cmr I checked and virtually every use of non- |
This comment has been minimized.
This comment has been minimized.
|
+1, this is the first step to enabling safe dynamic code loading. |
This comment has been minimized.
This comment has been minimized.
I think that alternative is the way to go. It doesn't commit us to adding more features today, but unlike the status quo and other proposals, it seems way more forwards compatible. C confuses arrays with pointers, and functions with function pointers. Rust fixed the former, it's high time it addressed the latter. |
This comment has been minimized.
This comment has been minimized.
|
@Ericson2314 The big issue with that though is that they are not and cannot be DSTs because they do not support dynamic queries of size and alignment. |
This comment has been minimized.
This comment has been minimized.
|
@eddyb Would adding length and alignment words before the code ptr work (i.e. [size, align, code....])? If not, won't there be some duplication either way as the RFC as written means a lot of borrowed pointer logic must be duplication? |
This comment has been minimized.
This comment has been minimized.
|
@Ericson2314 No, that would not work for, e.g |
nrc
assigned
nikomatsakis
Sep 25, 2014
alexcrichton
force-pushed the
rust-lang:master
branch
from
b9e2b8c
to
5020131
Oct 29, 2014
huonw
referenced this pull request
Feb 26, 2015
Closed
Make function pointer types look like borrowed pointer types for forwards compatability #883
This comment has been minimized.
This comment has been minimized.
|
This RFC has gotten quite old by now, and there are newer RFCs that offer more comprehensive solutions. I'm closing this RFC as postponed under #1037. Thanks very much for the suggestion! |
Tobba commentedSep 20, 2014
Rendered
(looks like I accidently removed the template by using the github quick commit, be careful)