dimforge / simba

Set of mathematical traits to facilitate the use of SIMD-based AoSoA (Array of Struct of Array) storage pattern.
Apache License 2.0
293 stars 29 forks source link

regression: "no method named `floor` found for type `f32` in the current scope" #14

Closed astraw closed 4 years ago

astraw commented 4 years ago

Hi, when upgrading from 0.2.0 to 0.2.1 (via "cargo update", for example), the new auto_simd_impl module fails to compile. simba is a transitive dependency of adskalman-rs. The simba requirement is brought in through nalgebra 0.22 with default features disabled and the libm feature enabled.

Here is the relevant part of Cargo.toml:

[dependencies]
nalgebra = {version="0.22", default-features=false, features=["libm"]}

You can look at an example build failure here https://github.com/strawlab/adskalman-rs/runs/1273243793 . Here is the relevant excerpt:

2020-10-19T04:58:42.2753561Z ##[group]Run cargo build
2020-10-19T04:58:42.2754019Z cargo build
2020-10-19T04:58:42.2794948Z shell: /bin/bash -e {0}
2020-10-19T04:58:42.2795288Z ##[endgroup]
2020-10-19T04:58:49.3160390Z     Updating crates.io index
2020-10-19T04:59:04.5300477Z     Updating git repository `https://github.com/strawlab/nalgebra-rand-mvn`
2020-10-19T04:59:04.7407493Z  Downloading crates ...
2020-10-19T04:59:04.8873833Z   Downloaded libm v0.2.1
2020-10-19T04:59:04.8991012Z   Downloaded paste-impl v0.1.18
2020-10-19T04:59:04.9004006Z   Downloaded num-traits v0.2.12
2020-10-19T04:59:04.9031778Z   Downloaded typenum v1.12.0
2020-10-19T04:59:04.9058033Z   Downloaded num-integer v0.1.43
2020-10-19T04:59:04.9076730Z   Downloaded simba v0.2.1
2020-10-19T04:59:04.9110998Z   Downloaded rand_chacha v0.2.2
2020-10-19T04:59:04.9122747Z   Downloaded rand_core v0.5.1
2020-10-19T04:59:04.9140039Z   Downloaded rand v0.7.3
2020-10-19T04:59:04.9195341Z   Downloaded autocfg v1.0.1
2020-10-19T04:59:04.9209759Z   Downloaded approx v0.3.2
2020-10-19T04:59:04.9225894Z   Downloaded proc-macro-hack v0.5.18
2020-10-19T04:59:04.9243806Z   Downloaded ppv-lite86 v0.2.9
2020-10-19T04:59:04.9256085Z   Downloaded paste v0.1.18
2020-10-19T04:59:04.9281813Z   Downloaded itertools v0.9.0
2020-10-19T04:59:04.9341314Z   Downloaded num-complex v0.2.4
2020-10-19T04:59:04.9356049Z   Downloaded log v0.4.11
2020-10-19T04:59:04.9382372Z   Downloaded either v1.6.1
2020-10-19T04:59:04.9394714Z   Downloaded cfg-if v0.1.10
2020-10-19T04:59:04.9405834Z   Downloaded num-rational v0.2.4
2020-10-19T04:59:04.9421917Z   Downloaded nalgebra v0.22.1
2020-10-19T04:59:04.9605885Z   Downloaded generic-array v0.13.2
2020-10-19T04:59:04.9660030Z    Compiling autocfg v1.0.1
2020-10-19T04:59:04.9662083Z    Compiling libm v0.2.1
2020-10-19T04:59:13.0282185Z    Compiling proc-macro-hack v0.5.18
2020-10-19T04:59:14.3810280Z    Compiling typenum v1.12.0
2020-10-19T04:59:14.9738980Z    Compiling rand_core v0.5.1
2020-10-19T04:59:15.2548227Z    Compiling ppv-lite86 v0.2.9
2020-10-19T04:59:15.4731143Z    Compiling log v0.4.11
2020-10-19T04:59:15.7339117Z    Compiling either v1.6.1
2020-10-19T04:59:15.8889314Z    Compiling cfg-if v0.1.10
2020-10-19T04:59:15.9216382Z    Compiling num-traits v0.2.12
2020-10-19T04:59:15.9986437Z    Compiling num-complex v0.2.4
2020-10-19T04:59:16.1825564Z    Compiling num-integer v0.1.43
2020-10-19T04:59:16.2599663Z    Compiling num-rational v0.2.4
2020-10-19T04:59:16.4607012Z    Compiling paste-impl v0.1.18
2020-10-19T04:59:16.6719174Z    Compiling itertools v0.9.0
2020-10-19T04:59:17.4802590Z    Compiling rand_chacha v0.2.2
2020-10-19T04:59:18.7762096Z    Compiling paste v0.1.18
2020-10-19T04:59:18.8147552Z    Compiling rand v0.7.3
2020-10-19T04:59:19.6569617Z    Compiling generic-array v0.13.2
2020-10-19T04:59:20.0426133Z    Compiling approx v0.3.2
2020-10-19T04:59:20.6779437Z    Compiling simba v0.2.1
2020-10-19T04:59:24.0738517Z error[E0599]: no method named `floor` found for type `f32` in the current scope
2020-10-19T04:59:24.0741232Z     --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/simba-0.2.1/src/simd/auto_simd_impl.rs:822:32
2020-10-19T04:59:24.0742499Z      |
2020-10-19T04:59:24.0743108Z 822  |                   self.map(|e| e.floor())
2020-10-19T04:59:24.0743834Z      |                                  ^^^^^ method not found in `f32`
2020-10-19T04:59:24.0744443Z ...
2020-10-19T04:59:24.0745150Z 1435 | / impl_float_simd!(
2020-10-19T04:59:24.0745882Z 1436 | |     [f32; 2], f32, 2, [i32; 2], AutoBoolx2, _0, _1;
2020-10-19T04:59:24.0746550Z 1437 | |     [f32; 4], f32, 4, [i32; 4], AutoBoolx4, _0, _1, _2, _3;
2020-10-19T04:59:24.0747254Z 1438 | |     [f32; 8], f32, 8, [i32; 8], AutoBoolx8, _0, _1, _2, _3, _4, _5, _6, _7;
2020-10-19T04:59:24.0747816Z ...    |
2020-10-19T04:59:24.0748368Z 1442 | |     [f64; 8], f64, 8, [i64; 8], AutoBoolx8, _0, _1, _2, _3, _4, _5, _6, _7;
2020-10-19T04:59:24.0748927Z 1443 | | );
2020-10-19T04:59:24.0749795Z      | |__- in this macro invocation
2020-10-19T04:59:24.0750326Z      |
2020-10-19T04:59:24.0751320Z      = help: items from traits can only be used if the trait is in scope
2020-10-19T04:59:24.0752509Z      = note: the following traits are implemented but not in scope; perhaps add a `use` for one of them:
2020-10-19T04:59:24.0754922Z              candidate #1: `use crate::scalar::complex::ComplexField;`
2020-10-19T04:59:24.0756063Z              candidate #2: `use crate::num::float::FloatCore;`
2020-10-19T04:59:24.0756902Z              candidate #3: `use crate::num::Float;`
2020-10-19T04:59:24.0757680Z              candidate #4: `use crate::num::real::Real;`
2020-10-19T04:59:24.0759342Z      = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
2020-10-19T04:59:24.0760231Z 
2020-10-19T04:59:24.0783529Z error[E0599]: no method named `floor` found for type `f64` in the current scope
2020-10-19T04:59:24.0784858Z     --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/simba-0.2.1/src/simd/auto_simd_impl.rs:822:32
2020-10-19T04:59:24.0785458Z      |
2020-10-19T04:59:24.0785700Z 822  |                   self.map(|e| e.floor())
2020-10-19T04:59:24.0785994Z      |                                  ^^^^^ method not found in `f64`
2020-10-19T04:59:24.0786234Z ...
2020-10-19T04:59:24.0786449Z 1435 | / impl_float_simd!(
2020-10-19T04:59:24.0786725Z 1436 | |     [f32; 2], f32, 2, [i32; 2], AutoBoolx2, _0, _1;
2020-10-19T04:59:24.0787048Z 1437 | |     [f32; 4], f32, 4, [i32; 4], AutoBoolx4, _0, _1, _2, _3;
2020-10-19T04:59:24.0787374Z 1438 | |     [f32; 8], f32, 8, [i32; 8], AutoBoolx8, _0, _1, _2, _3, _4, _5, _6, _7;
2020-10-19T04:59:24.0787632Z ...    |
2020-10-19T04:59:24.0787887Z 1442 | |     [f64; 8], f64, 8, [i64; 8], AutoBoolx8, _0, _1, _2, _3, _4, _5, _6, _7;
2020-10-19T04:59:24.0788142Z 1443 | | );
2020-10-19T04:59:24.0788524Z      | |__- in this macro invocation
2020-10-19T04:59:24.0788767Z      |
2020-10-19T04:59:24.0789069Z      = help: items from traits can only be used if the trait is in scope
2020-10-19T04:59:24.0789609Z      = note: the following traits are implemented but not in scope; perhaps add a `use` for one of them:
2020-10-19T04:59:24.0790313Z              candidate #1: `use crate::scalar::complex::ComplexField;`
2020-10-19T04:59:24.0790775Z              candidate #2: `use crate::num::float::FloatCore;`
2020-10-19T04:59:24.0791159Z              candidate #3: `use crate::num::Float;`
2020-10-19T04:59:24.0791514Z              candidate #4: `use crate::num::real::Real;`
2020-10-19T04:59:24.0792240Z      = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
2020-10-19T04:59:24.0792634Z 
2020-10-19T04:59:24.3187290Z error: aborting due to 2 previous errors
2020-10-19T04:59:24.3187861Z 
2020-10-19T04:59:24.3189441Z For more information about this error, try `rustc --explain E0599`.
2020-10-19T04:59:24.3316594Z error: could not compile `simba`.
2020-10-19T04:59:24.3316921Z 
2020-10-19T04:59:24.3317696Z To learn more, run the command again with --verbose.
sebcrozet commented 4 years ago

Thank you for noticing and reporting this. I published the version 0.2.2 with a fix, and yanked the version 0.2.1.

astraw commented 4 years ago

Thanks for your immediate action and for all your great work on simba and nalgebra etc. I confirm this solves the issue.