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

import macros from alloc #944

Merged
merged 1 commit into from Jul 11, 2021
Merged

import macros from alloc #944

merged 1 commit into from Jul 11, 2021

Conversation

vadixidav
Copy link
Contributor

This solves several issues encountered when trying to build with the alloc feature.

For one, the alloc feature is stable, and has been since Rust 1.36.0:

warning: the feature `alloc` has been stable since 1.36.0 and no longer requires
 an attribute to enable
  --> src/lib.rs:90:67
   |
90 | #![cfg_attr(all(feature = "alloc", not(feature = "std")), feature(alloc))]
   |                                                                   ^^^^^
   |
   = note: `#[warn(stable_features)]` on by default

warning: 1 warning emitted

Secondly, this breaks the build on stable:

 ~/g/r/cv   compilable  cv-optimize  cargo check
    Checking nalgebra v0.27.1
error[E0554]: `#![feature]` may not be used on the stable release channel
  --> /home/matthieu/.cargo/registry/src/github.com-1ecc6299db9ec823/nalgebra-0.27.1/src/lib.rs:89:59
   |
89 | #![cfg_attr(all(feature = "alloc", not(feature = "std")), feature(alloc))]
   |                                                           ^^^^^^^^^^^^^^

It also fails to build on nightly with the feature configuration we have in Rust CV:

error: cannot find macro `format` in this scope
  --> C:\Users\vadix\.cargo\registry\src\github.com-1ecc6299db9ec823\nalgebra-0.27.1\src\base\vec_storage.rs:70:43
   |
70 |             return Err(Des::Error::custom(format!(
   |                                           ^^^^^^
   |
   = note: consider importing one of these items:
           alloc::format
           std::format

All of these issues are solved by this PR.

We may also want to add a follow up to test alloc feature on stable in CI. Currently, the tests aren't even ran, and it only builds with nightly.

@sebcrozet
Copy link
Member

Thank you for this PR!

We may also want to add a follow up to test alloc feature on stable in CI. Currently, the tests aren't even ran, and it only builds with nightly.

I agree, we should add this in another PR.

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 this pull request may close these issues.

None yet

2 participants