-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Add a system for explicitly marking const fns as promotable #51500
The head ref may contain hidden characters: "2const_or_\u00AC2const"
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.
@@ -929,10 +935,18 @@ This does not pose a problem by itself because they can't be accessed directly." | |||
|
|||
_ => {} | |||
} | |||
// we can always mark intrinsics as promotable as they are inherently | |||
// unstable | |||
promotable = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's extend the "promotable" whitelist to intrinsics too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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