Skip to content
This repository was archived by the owner on Mar 7, 2021. It is now read-only.
This repository was archived by the owner on Mar 7, 2021. It is now read-only.

Use stable Rust (tracking ticket for unstable features we use) #41

Open

Description

@geofft

More ambitious than #37, and won't be possible for a long while yet. Here's what we use currently:

Activity

  1. bjorn3 commented on Apr 30, 2019

    @bjorn3

    #![feature(alloc)] has been stabilized in rust-lang/rust#59675.

  2. joshtriplett commented on Aug 28, 2020

    @joshtriplett

    Do we still need const_fn, or do we have enough support in stable that it should work?

  3. alex commented on Aug 28, 2020

    @alex
    Member

    @joshtriplett is there a change in "error[E0723]: trait bounds other than Sized on const fn parameters are unstable" since June?

  4. joshtriplett commented on Aug 28, 2020

    @joshtriplett

    @alex Ah. No. Could we link to a more specific issue, if there is one, or file one if there isn't?

  5. alex commented on Aug 28, 2020

    @alex
    Member

    I don't see an existing one.

  6. geofft commented on Aug 29, 2020

    @geofft
    CollaboratorAuthor

    I filed rust-lang/const-eval#56 asking about this. If you dig into the hidden comments in 57563, you see this:

    The RFC doesn't have to talk about associated consts, because as you correctly inferred, associated consts are completely unproblematic. We could totally add trait bounds and allow you to use associated consts. The problem is that adding trait bounds would also give you access to associated functions, and then the question comes up whether you are allowed to call them. The RFC answers this question. Adding trait bounds to const fns needs to answer all questions about the items on the traits at once, we can't separate these out.

    No, but once we allow trait bounds on the generic parameters of a function, and we allow you to call that without having a const impl for the trait, we lock in into that system and can't ever go back.

    We want this for function pointers, which I think is basically equivalent to associated consts.

    "The RFC" there is rust-lang/rfcs#2632, which is open but apparently being provisionally implemented to see how it goes. It seems the proposal is to add a <T: ?const Trait> syntax, which means "I'm not calling any functions from T." It's not totally obvious to me whether you can get to function pointers / associated consts of a ?const type parameter, but if you can, that would resolve what we need.

  7. geofft commented on Aug 29, 2020

    @geofft
    CollaboratorAuthor

    Oh hey, tock/tock#1654 looks very similar to this issue except they've got a whole kernel going. I think it's promising that they're almost stable, and const fn is one of their biggest open questions (I think they need the same thing that we do.)

    cc @ojeda since we were talking about what unstable features we might need - this seems promising that we could get to stable pretty quickly!

  8. ojeda commented on Aug 30, 2020

    @ojeda

    Indeed, the discussion is similar and it is promising. Getting Rust into the kernel can be a strong argument for Rust to stabilize whatever is missing and, conversely, getting Rust into mainline and iterating over there will make us know what bits we may end up really needing and which ones we could circumvent if needed, like it seems to have happened with the Tock project as well.

  9. geofft commented on Aug 30, 2020

    @geofft
    CollaboratorAuthor

    Discussion in the issue I filed implies that the current syntax we're using is quite possibly not on the path to stabilization, so it might be worth figuring out how to avoid it.

    After thinking too hard about this, I came up with a weird solution that avoids #[feature(const_fn)] - see the last paragraph of my comment rust-lang/const-eval#56 (comment).

    We'd probably want to wrap that up inside a macro to make it a little less ugly to use.

    EDIT: Made some tweaks to the proposed solution based on @alex's suggestions. The playground link in the most recent version of my comment seems sufficiently less ugly that even without a macro it's an improvement over the builder setup we have now.

  10. alex commented on Aug 30, 2020

    @alex
    Member

    const_fn is no longer required. Down to 3 features (+ -Z build-std)

  11. ojeda commented on Aug 30, 2020

    @ojeda

    the current syntax we're using is quite possibly not on the path to stabilization

    Yeah, that is the kind of thing I was trying to point out in the LPC hackroom... In this kind of things there is always a chance that, in practice, we may not get something for one reason or another (which is fine!).

    On the other hand, if we believe a much better alternative will end up being stabilized soon (e.g. within a year), then I wouldn't worry much to avoid it for the moment.

    seems sufficiently less ugly that even without a macro it's an improvement over the builder setup we have now

    Seems quite clean to me! The kernel has seen way worse, to be honest.

  12. alex commented on Sep 6, 2020

    @alex
    Member

    abc9791 has further reduced the need for nightly -- at this point the only things we need are for the allocator API and -Zbuild-std.

    Strictly speaking if one were motivated, I think they could make this work without those.

  13. suhr commented on Sep 25, 2020

    @suhr

    Strictly speaking if one were motivated, I think they could make this work without those.

    Could you describe a way to get rid of -Zbuild-std?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    upstream-rustWork that needs to happen in Rust itself

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions