Add a system for explicitly marking const fns as promotable#51500
Hidden character warning
Add a system for explicitly marking const fns as promotable#51500oli-obk wants to merge 7 commits intorust-lang:masterfrom
Conversation
4333d6e to
bb88df8
Compare
|
As mentioned on the I don't know where the right place to document this is, but I think it should be explained somewhere (and maybe the libs team should be pinged here as well), since |
|
The idea is that you do not need to mark anything as promotable. We just needed an opt-in for preventing the automatic promotion of any const fn call due to #50814 . Without that opt in, further stabilization of const fns is not something we want to do. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
b5bd6a1 to
116df85
Compare
This comment has been minimized.
This comment has been minimized.
| } | ||
| // we can always mark intrinsics as promotable as they are inherently | ||
| // unstable | ||
| promotable = true; |
There was a problem hiding this comment.
let's extend the "promotable" whitelist to intrinsics too
nikomatsakis
left a comment
There was a problem hiding this comment.
I approve of the general approach — but I agree that we should document. I was gonna say the same thing. @oli-obk and I talked and agreed we'd put it in the unstable reference.
|
cc @eddyb — do you want to take a look at this PR? (Not strictly necessary, I don't think) It adds a separate attribute to mark const fns as promotable. @gnzlbg as I wrote above, I agree we need docs — but I think the short version is that we would only very rarely (if ever) want to add this attribute, and only after consulting with @oli-obk and/or myself. Basically we want to be conservative about what we will automatically promote to static lifetime (that is, you write |
|
cc @eddyb |
This comment has been minimized.
This comment has been minimized.
b91bcc0 to
a810d95
Compare
|
I'm not sure we should mark any |
|
Ping from triage @nikomatsakis! This PR needs your review. |
|
closing in favour of #51570 |
r? @nikomatsakis
addresses the last point of https://gist.github.com/nikomatsakis/eee212d7c4a49ae75e19765c1e06bf49