Repository navigation
Closed
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)B-RFC-approvedBlocker: Approved by a merged RFC but not yet implemented.Blocker: Approved by a merged RFC but not yet implemented.B-RFC-implementedBlocker: Approved by a merged RFC and implemented but not stabilized.Blocker: Approved by a merged RFC and implemented but not stabilized.B-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-langRelevant to the language teamRelevant to the language team
Description
#57563 | new meta tracking issue
Old content
Tracking issue for rust-lang/rfcs#911.
This issue has been closed in favor of more targeted issues:
Locals, assignments, destructuring: Tracking issue for RFC 2341, Allow locals and destructuring in const fn #48821- Integration with patterns: Tracking issue for
const fnintegration with pattern matching #57240 - Floating points: Tracking issue for
#![feature(const_fn_floating_point_arithmetic)]#57241 - Panics: Tracking issue for RFC 2345, "Allow panicking in constants" (const_panic) #51999
- Loops: Tracking issue for RFC 2344, "Allow
loopin constant evaluation" #52000 - Control flow: Tracking issue for RFC 2342, "Allow
ifandmatchin constants" #49146 - Comparing raw pointers: Tracking issue for comparing raw pointers in constants #53020
- Dereferencing raw pointers: [tracking issue] dereferencing raw pointers inside constants (const_raw_ptr_deref) #51911
- Raw pointer to
usizecasts: [tracking issue] raw ptr to usize cast inside constants #51910 - Union field accesses: [tracking issue]
unionfield access insideconst fn#51909 - Warnings on long running evaluations: [tracking issue] warnings on long running constant evaluations #49980
- Constant propagation not causing errors: Tracking issue for constant prop not causing add'l errors (RFC #1229) #28238
&mut Treferences and borrows: Tracking issue for&mut Tin const contexts (const_mut_refs) #57349
Things to be done before stabilizing:
- Reach final decision :P
-
const unsafe fndeclaration order unsafe const fn declaration order #29107 - write docs
CTFE = https://en.wikipedia.org/wiki/Compile_time_function_execution
Reacted by Corey Farwell, Andréy Lesnikóv, Brian Smith, Zverev Konstantin, Brad Campbell, Łukasz Neumann, Powersource, Elahn Ientile, Oleh Devua, chpio and 48 more
Reacted by Luis Enrique Muñoz Martín and Felipe S. S. Schneider
Metadata
Metadata
Assignees
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)B-RFC-approvedBlocker: Approved by a merged RFC but not yet implemented.Blocker: Approved by a merged RFC but not yet implemented.B-RFC-implementedBlocker: Approved by a merged RFC and implemented but not stabilized.Blocker: Approved by a merged RFC and implemented but not stabilized.B-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-langRelevant to the language teamRelevant to the language team
Activity
Munksgaard commentedon Jun 20, 2015
Is this closed by #25609?
abonander commentedon Jul 2, 2015
@Munksgaard That just adds support to the compiler AFAIK. There's a lot of functions in the stdlib that need to be changed to
const fnand tested for breakage. I don't know what the progress is on that.nodakai commentedon Aug 2, 2015
I'm hoping this to be implemented on
std::ptr::null()andnull_mut()so that we can use them to initializestatic mut *MyTypeWithDropwithout resorting to0usize as *mut _rohel01 commentedon Aug 14, 2015
glaebhoerl commentedon Aug 15, 2015
To be clear, the question here is not primarily about the usefulness of the feature but rather regarding the best way to formulate it (or the best framework to formulate it in). See the RFC discussion.
Rollup merge of rust-lang#28507 - Manishearth:const-stable, r=alexcri…
aturon commentedon Nov 5, 2015
This is now the tracking issue for eventual stabilization.
briansmith commentedon Jan 12, 2016
#29107 has been closed.
I disagree that "Integration with patterns", or any changes to the standard library should block this. This is very useful even without those changes, and those changes can be done later. In particular, I would like to start using
const fnin my own code soon.Accordingly, could the stabilization status of this be re-evaluated?
glaebhoerl commentedon Jan 15, 2016
I don't doubt that
const fneven in its current limited form would be useful functionality to have, but what I would really like, ideally before going further along this path, would be for those in favor of "theconst fnapproach" to think about and articulate their preferred endgame. If we just keep on incrementally adding useful-seeming functionality in the most obvious way, it seems very likely to me that we'll eventually end up copying more or less the entirety of C++'sconstexprdesign. Is that something we are comfortable with? Even if we say yes, I would much rather that we choose that path in a clear-eyed way, instead of backing into it with small steps over time, as the path of least resistance, until it has become inevitable.(Given that the semantics of safe Rust code should be fully definable, it seems likely that eventually at least every function which doesn't (transitively) depend on
unsafeshould be able to be marked asconst. And given thatunsafeis supposed to be an implementation detail, I bet people will push for somehow loosening that restriction as well. I would much rather we looked abroad and tried to find a more cohesive, capable, and well-integrated story for staging and type-level computation.)278 remaining items
SimonSapin commentedon Jan 2, 2019
Related: #57261
phansch commentedon Jan 9, 2019
Does someone know what happened to the
const_string_newfeature? Is there a tracking issue for it? The unstable book just links here.Centril commentedon Jan 9, 2019
@phansch That's because all
rustc_const_unstablepoint here. (cc @oli-obk can we fix that?)durka commentedon Jan 9, 2019
ErichDonGubler commentedon Jan 9, 2019
@durka: There's always going to be a possible window where something is closed in nightly and the resolution still hasn't landed in stable. How is that insulting?
nixpulvis commentedon Jan 9, 2019
I've been resisting commenting here, and maybe we should move this conversation to a thread on internals (is there one already?) but...
The decision to close this makes no sense to me. It's a tracking issue, because it shows up in error messages from the compiler, and it's not alone, see this post for some more examples: https://internals.rust-lang.org/t/psa-tracking-for-gated-language-features/2887. Closing this issue to me implies stability, which is obviously not yet the case.
I frankly can't see an argument for closing this... I'm glad more targeted issue now exist, so implementation can move forward, with hopefully new discussion and focus, but I don't see a clear way to associate the compiler messages with those.
Again, if this needs (or already has) a thread on internals maybe let's move this conversation there?
EDIT: Or is the issue just that the book is outdated? Trying the example from the RFC (it's missing a couple
#[derive(...)]s) seems to work without errors on Rust rustc 1.31.1. Are there still compiler error message pointing here? It would be nice to have a place to link errors like:If we want to have them linked to the specific issues that would be an improvement possibly.
nixpulvis commentedon Jan 9, 2019
Ok, so here should be some strong evidence for this issue remaining open. As far as I can tell this:
rust/src/libsyntax/feature_gate.rs
Line 194 in 6ecad33
is the only
activefeature that points to a closed issue.In an ideal world I believe these kinda of discussions should really be automated, since as we've discovered, people have varying opinions and ideas about how things should work. But that's really not a conversation for this thread...
shepmaster commentedon Jan 9, 2019
Yes, this is the correct solution, and what @Centril already suggested.
The initial comment has also been edited to redirect people to the specific issues who arrive here in the "window" that @ErichDonGubler mentions.
varkor commentedon Jan 13, 2019
#57563 has now been opened to track the remaining unstable const features.
Rollup merge of rust-lang#57564 - varkor:update-const_fn-tracking-iss…
glaebhoerl commentedon Jan 13, 2019
Someone could edit the issue body here to prominently link to #57563 then?
Centril commentedon Jan 13, 2019
@glaebhoerl done :)
jtakalai commentedon Mar 22, 2019
Hi, I got here because I got
error[E0658]: const fn is unstable (see issue #24111)when compiling ncurses-rs. What should I do? Upgrade rust? I've gotEDIT: did
brew uninstall rustand followed rustup install instructions, nowrustc --versionisrustc 1.33.0 (2aa4c46cf 2019-02-28)and that error went away.oli-obk commentedon Mar 22, 2019
Yes, in order to be able to use
const fnon stable, you'll need to update your compiler.theoparis commentedon Nov 30, 2023
I am coming from Zig where you can use iterators and functions like sin at compile time. However, attempting to do this in rust gives the following errors. Are these planned to be added to the language at some point? I haven't found an issue mentioning these so I figured I'd post here.