-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Tracking issue for calling standard library const fn
s
#46038
Comments
Feature gates are:
|
Kicking off stabilization discussion for the const-ness of these functions in @rfcbot fcp merge |
Team member @aturon has proposed to merge this. The next step is review by the rest of the tagged teams: No concerns currently listed. Once these reviewers reach consensus, this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
How to about mark std::time::Duration::{from_millis, new, from_secs, from_micros} as const_fn? |
new can panic so it can't be const. |
@sfackler sure it can, the same way an indexing expression can be const (panic turns into |
@durka How? #![feature(const_fn)]
const fn foo(a: i32) {
if a > 10 {
panic!();
}
}
fn main() {}
#![feature(const_fn)]
const fn foo(a: i32) {
panic!();
}
fn main() {}
|
I think this is "what is allowed right now" vs "what we could allow" (i.e. miri evaluates panics just fine). |
Yeah sorry, I just meant that *in theory* we could translate panics to
compile errors.
…On Nov 17, 2017 7:37 PM, "Eduard-Mihai Burtescu" ***@***.***> wrote:
I think this is "what is allowed right now" vs "what we could allow" (i.e.
miri evaluates panics just fine).
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#46038 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAC3n43M19qfGrHiLnHUOfS_2uTSttq9ks5s3ibbgaJpZM4QgrK5>
.
|
There are many more |
The final comment period is now complete. |
I’ve submitted #46287 |
Stabilize const-calling existing const-fns in std Fixes rust-lang#46038
The functions below in the standard library are
const fn
with individual feature gates for calling them in constant expressions. This issue is tracking the stabilization of such calls.CC #24111, the super-set feature which also includes defining new
const fn
items.std::sync::Once::new
core::cell::Cell::new
core::cell::RefCell::new
core::cell::UnsafeCell::new
core::sync::AtomicBool::new
core::sync::AtomicPtr::new
core::sync::Atomic$IntegerType::new
core::mem::size_of
core::mem::align_of
core::ptr::null
core::ptr::null_mut
<$IntegerType>::max_value
<$IntegerType>::min_value
Items in
core::
are also re-exported instd::
.The text was updated successfully, but these errors were encountered: