-
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
const fn tracking issue (RFC 911) #24111
Comments
Is this closed by #25609? |
@Munksgaard That just adds support to the compiler AFAIK. There's a lot of functions in the stdlib that need to be changed to |
I'm hoping this to be implemented on |
This comment has been minimized.
This comment has been minimized.
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. |
This is now the tracking issue for eventual stabilization. |
#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 Accordingly, could the stabilization status of this be re-evaluated? |
I don't doubt that (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 |
What I would personally like, even more than that, is that we have a fairly clear view on how we're going to implement it, and what portion of the language we are going to cover. That said, this is very closely related to support for associated constants or generics over integers in my mind. @eddyb and I did some sketching recently on a scheme which could enable constant evaluation of a very broad swath of code. Basically lowering all constants to MIR and intrepreting it (in some cases, However, while it seems like it would be fairly easy to support a very large fraction of the "builtin language", real code in practice hits up against the need to do memory allocation very quickly. In other words, you want to use That said, @glaebhoerl, I'd also love to hear you articulate your preferred alternative endgame. I think you sketched out some such thoughts in the |
The problem with allocation is having it escape into run-time. Alternatively, we could generate runtime code to allocate and fill in the values every time that barrier has to be passed, although I'm not sure what kind of usecases that has. Keep in mind that even with full-fledged |
@nikomatsakis If I had one I would have mentioned it. :) I mainly just see known unknowns. The whole thing with Of the main use cases for the Rust language, the ones that primarily need low-level control, like kernels, seem reasonably well-served already, but another area where Rust could have lots of potential is things that primarily need high performance, and in that space powerful support (in some form) for staged computation (which As for what would be inspiring and good enough... I haven't seen it yet, and I'm not familiar enough with the whole space to know, precisely, where to look. Of course, per the above, we might want to at least glance at Julia and Terra, even if they seem like quite different languages from Rust in many ways. I know Oleg Kiselyov has done a lot of interesting work in this area. Tiark Rompf's work on Lancet and Lightweight Modular Staging for Scala seems definitely worth looking at. I recall seeing a presentation by @kmcallister at some point about what a dependently typed Rust might look like (which might at least be more general than sticking (This was just a braindump and I've almost surely imperfectly characterized many things.) |
I disagree with that characterization of "real code in practice". I think there is big interest in Rust because it helps reduce the need for heap memory allocation. My code, in particular, makes a concrete effort to avoid heap allocation whenever possible. Being able to do more than that would be nice but being able to construct static instances of non-trivial types with compiler-enforced invariants is essential. The C++ |
@briansmith FWIW another approach which has a chance of solving the same use cases would be if macros had privacy hygiene, which I believe (hope) we're planning to make them have. |
I guess if you use the procedural macros then you can evaluate |
@glaebhoerl I wouldn't hold my breath for strict hygiene, it's quite possible we're going to have an escape mechanism (just like real LISPs), so you may not want it for any kind of safety purposes. |
@glaebhoerl there is also https://anydsl.github.io/, which even uses On Sat, Jan 16, 2016 at 6:29 PM, Eduard-Mihai Burtescu <
|
#29525 should be fixed before stabilization |
Just a thought: if we ever formally define Rust's memory model, then even I'm not sure where that leaves us with respect to So you'd still have |
@glaebhoerl Well, that is pretty much the model I described and which @tsion's miri is implementing. I think the FFI distinction is very important because of purity, which is required for coherence. I don't like the Just like |
I don’t have all the specifics in mind, but isn’t there a lot more that’s suppported by miri but not enabled yet in |
@SimonSapin Yeah, good catch. There are some more existing issues for that. I've updated the comment + issue description. If there's something not covered that you happen upon, make new issues please. |
I think it’s not appropriate to close a meta tracking issue when it’s not at all clear that what it covers is exhaustively covered by more specific issues. When I remove
(These However, neither traits nor function pointer types are mentioned in this issue’s description. I don’t mean we should have just two more specific issues for the above. I mean we should reopen this one until we somehow ensure that everything behind the |
This issue has the flavor of #34511 which is one of the biggest messes there are as far as tracking issues go. This issue has also been a free-for-all for some time so it doesn't act as a meta-issue right now. For such free-for-alls, please use http://internals.rust-lang.org/ instead.
That's exactly what I think should be done. From a T-Lang triage perspective, it is favorable to have targeted and actionable issues.
It's not even clear to me what |
That’s exactly why we shouldn’t close it until we figure that out, IMO.
Is it really everything, though? |
Related: #57261 |
Does someone know what happened to the |
The issue should be open then. It's just insulting as a user to be pointed
to a closed issue.
…On Wed, Jan 9, 2019, 04:05 Mazdak Farrokhzad ***@***.*** wrote:
@phansch <https://github.com/phansch> That's because all
rustc_const_unstable point here.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#24111 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAC3n7JhzsZZpizmWlp0Nww5bcfIqH2Vks5vBbC8gaJpZM4D66IA>
.
|
@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? |
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
If we want to have them linked to the specific issues that would be an improvement possibly. |
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 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... |
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. |
#57563 has now been opened to track the remaining unstable const features. |
…ue, r=Centril Update the const fn tracking issue to the new metabug The new `const fn` tracking issue is rust-lang#57563. We don't want to point to a closed issue in the diagnostics (or FIXMEs), so these have been updated (from the old issue, rust-lang#24111). r? @Centril
Someone could edit the issue body here to prominently link to #57563 then? |
@glaebhoerl done :) |
Hi, I got here because I got
EDIT: did |
Yes, in order to be able to use |
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.
|
#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 #48821const fn
integration with pattern matching #57240#![feature(const_fn_floating_point_arithmetic)]
#57241loop
in constant evaluation" #52000if
andmatch
in constants" #49146usize
casts: [tracking issue] raw ptr to usize cast inside constants #51910union
field access insideconst fn
#51909&mut T
references and borrows: Tracking issue for&mut T
in const contexts (const_mut_refs) #57349Things to be done before stabilizing:
const unsafe fn
declaration order unsafe const fn declaration order #29107CTFE = https://en.wikipedia.org/wiki/Compile_time_function_execution
The text was updated successfully, but these errors were encountered: