Skip to content
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

Rename "nightly" feature #22

Closed
danlehmann opened this issue May 23, 2023 · 8 comments · Fixed by #27
Closed

Rename "nightly" feature #22

danlehmann opened this issue May 23, 2023 · 8 comments · Fixed by #27

Comments

@danlehmann
Copy link
Owner

const_trait has been removed from upstream Rust, so on a new compiler nightly no longer builds (for example, From<> is no longer const). There is currently no alternative, so we just probably just remove this optional feature

@hecatia-elegua
Copy link
Collaborator

You know I'm using this functionality and probably also know that they've just temporarily removed it. Please don't.
If you must, put it in some far-off file or a more scary feature name?

@danlehmann
Copy link
Owner Author

Just to clarify why this is a problem: When using a current nightly compiler (I am testing nightly-2023-04-20), arbitrary-int using the "nightly" feature fails to build as it relies on:

error[E0635]: unknown feature `const_convert`
 --> /Users/daniel/.cargo/registry/src/index.crates.io-6f17d22bba15001f/arbitrary-int-1.2.5/src/lib.rs:2:42
  |
2 | #![cfg_attr(feature = "nightly", feature(const_convert, const_trait_impl))]
  |                                          ^^^^^^^^^^^^^

error: const `impl` for trait `From` which is not marked with `#[const_trait]`
   --> /Users/daniel/.cargo/registry/src/index.crates.io-6f17d22bba15001f/arbitrary-int-1.2.5/src/lib.rs:789:67
    |
789 |             impl<const BITS: usize, const BITS_FROM: usize> const From<UInt<$from, BITS_FROM>>
    |                                                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
865 | from_arbitrary_int_impl!(u8, [u16, u32, u64, u128]);
    | --------------------------------------------------- in this macro invocation
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change
    = note: this error originates in the macro `from_arbitrary_int_impl` (in Nightly builds, run with -Z macro-backtrace for more info)

@danlehmann
Copy link
Owner Author

Do you have a source for it being temporarily disabled? I was under the impression they are moving to keyword generics, which might be years out.

@hecatia-elegua
Copy link
Collaborator

@danlehmann
Copy link
Owner Author

Thanks! Let's rename the feature then? We can add a comment saying that this is requires an old compiler

@danlehmann
Copy link
Owner Author

Out of curiosity, which part of your code relies on this? In bitbybit, I completely side-stepped Number by entirely relying on .value() and the knowledge of how many bits e.g. a u5 is (by looking at the name). I assume in your case that wouldn't work bitenums?

@danlehmann danlehmann changed the title Remove const_trait nightly option Rename "nightly" feature May 23, 2023
@hecatia-elegua
Copy link
Collaborator

One example is <Self as arbitrary_int::Number>::MAX.value(). I also use new in const context, not sure where rn and I need some sleep

@danlehmann danlehmann linked a pull request May 26, 2023 that will close this issue
@danlehmann
Copy link
Owner Author

@hecatia-elegua please see #27. Does this work for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants