GithubHelp home page GithubHelp logo

const-evaluation about lang-team HOT 21 OPEN

rust-lang avatar rust-lang commented on June 5, 2024 1
const-evaluation

from lang-team.

Comments (21)

RalfJung avatar RalfJung commented on June 5, 2024 1

Status update

From my perspective, the main thing happening here that is relevant for t-lang is rust-lang/rfcs#3016. This will unblock stabilizing some unsafe operations in const fn.

There's also a bunch of work going on under the hood on the implementation side (moving towards valtrees), but at least for now these should not have any visible effects. Longer-term I think this will be a great foundation for cleaning up our "structural equality" story around consts in patterns.

from lang-team.

RalfJung avatar RalfJung commented on June 5, 2024 1

I am particularly happy about the last point. :D We are almost done with the multi-year effort of cleaning up the story around promotion. There is one last thread left to discuss, see rust-lang/rust#80619 for details.

from lang-team.

nikomatsakis avatar nikomatsakis commented on June 5, 2024
  • Oli working on skill-tree to help plan next steps for const-eval
    • loop and while (not for) is the next candidate for stabilization.
      • Main blocker was questions around qualification à la if and match.
      • Having if and match w/o loop and while will push people to use recursion for loops in a const context (I believe this happened with C++’s constexpr).
      • Having no for loops, which would require const trdait methods, is painful though.
  • Inline const { … } expressions (and patterns)
    • rust-lang/rfcs#2920
    • Do we allow code inside a const { … } to depend on generic parameters?
    • Does unsafe { const { … } } allow unsafe operations inside the inline const?
    • Do we allow const { … } in fallible patterns?

from lang-team.

nikomatsakis avatar nikomatsakis commented on June 5, 2024

from lang-team.

nikomatsakis avatar nikomatsakis commented on June 5, 2024

from lang-team.

nikomatsakis avatar nikomatsakis commented on June 5, 2024
  • #71824, Check for live drops in constants after drop elaboration
    • This is enabled by moving const-checking after drop elaboration
      • Additional precision in what is availible
      • Concern: This makes drop elaboration more of the public facing languge/”spec”
    • Drop elaboration removes most frivolous Drop terminators. It seems silly to duplicate this work during const-checking.
    • Allows Option::unwrap to become (unstably) const: rust-lang/rust#66753
    • Does this want its own feature gate, or wrap into above? (nominated below)

from lang-team.

nikomatsakis avatar nikomatsakis commented on June 5, 2024

Update from meeting:

from lang-team.

nikomatsakis avatar nikomatsakis commented on June 5, 2024

2020-06-22:

  • Have the #18 design meeting this week about the skill tree and unsafe and so forth.

from lang-team.

ecstatic-morse avatar ecstatic-morse commented on June 5, 2024

const_if_match and const_loop stabilization PR merged (rust-lang/rust#72437). On track for stabilization in 1.46.

from lang-team.

nikomatsakis avatar nikomatsakis commented on June 5, 2024

2020-07-06:

  • No updates we are aware of :)

from lang-team.

nikomatsakis avatar nikomatsakis commented on June 5, 2024

2020-08-3:

  • No updates

from lang-team.

joshtriplett avatar joshtriplett commented on June 5, 2024

2020-08-10:

  • No updates

from lang-team.

nikomatsakis avatar nikomatsakis commented on June 5, 2024

2020-08-31:

No updates.

from lang-team.

nikomatsakis avatar nikomatsakis commented on June 5, 2024

2020-09-21:

We have entered the "const evaluatable" check that allows you to have array sizes beyond [u8; N] (e.g., [u8; N+1]), but still lots of work before that would be considered possible on stable.

from lang-team.

nikomatsakis avatar nikomatsakis commented on June 5, 2024

@RalfJung opened rust-lang/rfcs#3016 with the following summary:

Define how UB during const evaluation is treated: some kinds of UB must be detected, the rest leads to an unspecified result for the affected CTFE query (but does not otherwise "taint" the compilation process).

from lang-team.

oli-obk avatar oli-obk commented on June 5, 2024

The blog post (in the skill-tree meeting it was discussed that basically all that is missing is a blog post referencing the current status of the skill tree that the lang team will sign off on) is now also ready: rust-lang/blog.rust-lang.org#719

from lang-team.

oli-obk avatar oli-obk commented on June 5, 2024

rust-lang/rfcs#3016 has been merged, we can now start stabilization requests to the lang team for individual unsafe things like transmute or raw pointer derefs.

valtrees are on ice until July and look promising except for some perf things that need to be figured out

there's some discussion going on around panics with user defined messages during CTFE

explicit promotion is being removed from the compiler (rust-lang/rust#85110). It was only used for SIMD intrinsic array lengths. Instead one now needs to specify a constant item and reference that in the length argument. There's work going on to replace all of these "magic arguments that must be constant" with const generics. This should simplify the compiler further and avoid having multiple schemes that do the same thing in slightly different ways.

from lang-team.

RalfJung avatar RalfJung commented on June 5, 2024

Status update

rust-lang/rust#85769 has been proposed for FCP, as our first foray into wildly unsafe things inside const fn. The tricky part is that this breaks the property that const fn will be deterministic even when invoked at runtime. (However, if ptr-to-int transmutes are indeed UB at runtime, then this issue would not come up. Though one could say then we have a bigger problem. ;)

There's been some setback with panic! inside consts due to edition 2021 issues (the old hacks we used to only evaluate argumentless format strings don't work any more), but just today a new proposal to solve this was made: rust-lang/rust#86830.

There was some more talk about floats and in particular NaNs during CTFE, but again it is unknown how to avoid introducing const fn that are non-deterministic at runtime.

There might be more things, honestly I am not entirely sure.^^

from lang-team.

RalfJung avatar RalfJung commented on June 5, 2024

Ah, I guess there's also inline consts. No progress, to my knowledge, but it would be really good to figure out what it would take to make progress here. :)

from lang-team.

joshtriplett avatar joshtriplett commented on June 5, 2024

@RalfJung It'd be helpful to make forward progress on inline consts for the benefit of inline assembly. cc @Amanieu.

from lang-team.

RalfJung avatar RalfJung commented on June 5, 2024

Yeah, that's one reason why I brought it up.

I don't really have any free cycles to work on this though, so I am not sure how much I can do.

from lang-team.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.