Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Error on nightly: Unions in const fn are unstable #53

Closed
MajorBreakfast opened this issue Aug 18, 2018 · 3 comments · Fixed by #55
Closed

Error on nightly: Unions in const fn are unstable #53

MajorBreakfast opened this issue Aug 18, 2018 · 3 comments · Fixed by #55

Comments

@MajorBreakfast
Copy link

I'm getting this error on recent nightlies:

error[E0658]: unions in const fn are unstable (see issue #51909)
  --> /Users/josef/.cargo/registry/src/github.heygears.com-1ecc6299db9ec823/heapless-0.3.6/src/__core.rs:43:9
   |
43 |         U { none: () }.some
   |         ^^^^^^^^^^^^^^^^^^^
   |
   = help: add #![feature(const_fn_union)] to the crate attributes to enable

error: aborting due to previous error
@MajorBreakfast MajorBreakfast changed the title unions in const fn are unstable Error on nightly: Unions in const fn are unstable Aug 18, 2018
@MajorBreakfast
Copy link
Author

#![cfg_attr(feature = "const-fn", feature(const_fn_union))] can be easily added to lib.rs, but I get another error after that. One of them is:

error[E0080]: this static likely exhibits undefined behavior
   --> src/linear_map.rs:456:9
    |
456 |         static mut _L: LinearMap<i32, i32, U8>= LinearMap::new();
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered undefined bytes at .buffer.buffer.value.data.parent1.parent1.parent1.data.0
    |
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior

@MajorBreakfast
Copy link
Author

I'm now using the master branch in my project which allows disabling the const-fn crate feature.

@MajorBreakfast
Copy link
Author

@japaric This is awesome! Thanks!

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

Successfully merging a pull request may close this issue.

1 participant