cds-astro / cds-healpix-rust

The CDS HEALPix library in Rust (WebAssembly, Python, ...)
Apache License 2.0
16 stars 5 forks source link

Errors in tests #1

Closed cdeil closed 4 years ago

cdeil commented 5 years ago

@fxpineau - If I try to run the tests I get these errors:

(gammapy-dev) hfm-1804a:cds-healpix-rust deil$ cargo test
warning: unused manifest key: package.edition
    Updating registry `https://github.com/rust-lang/crates.io-index`
   Compiling katex-doc v0.1.0                                                   
   Compiling cdshealpix v0.2.0 (file:///Users/deil/work/code/cds-healpix-rust)
error[E0433]: failed to resolve. Use of undeclared type or module `std`
   --> src/nested/bmoc.rs:908:35
    |
908 |   pub fn to_ranges(&self) -> Box<[std::ops::Range<u64>]> {
    |                                   ^^^ Use of undeclared type or module `std`

error[E0433]: failed to resolve. Use of undeclared type or module `std`
   --> src/nested/bmoc.rs:909:25
    |
909 |     let mut ranges: Vec<std::ops::Range<u64>> = Vec::with_capacity(self.entries.len());
    |                         ^^^ Use of undeclared type or module `std`

error[E0658]: `crate` in paths is experimental (see issue #45477)
 --> src/external_edge.rs:5:5
  |
5 | use crate::compass_point::{Cardinal, Ordinal};
  |     ^^^^^

error[E0658]: `crate` in paths is experimental (see issue #45477)
    --> src/lib.rs:1340:5
     |
1340 | use crate::compass_point::{MainWind};
     |     ^^^^^

error[E0658]: `crate` in paths is experimental (see issue #45477)
    --> src/lib.rs:1341:5
     |
1341 | use crate::compass_point::MainWind::*;
     |     ^^^^^

error: aborting due to 5 previous errors

Some errors occurred: E0433, E0658.
For more information about an error, try `rustc --explain E0433`.
error: Could not compile `cdshealpix`.
warning: build failed, waiting for other jobs to finish...
error[E0433]: failed to resolve. Use of undeclared type or module `std`
   --> src/nested/bmoc.rs:908:35
    |
908 |   pub fn to_ranges(&self) -> Box<[std::ops::Range<u64>]> {
    |                                   ^^^ Use of undeclared type or module `std`

error[E0433]: failed to resolve. Use of undeclared type or module `std`
   --> src/nested/bmoc.rs:909:25
    |
909 |     let mut ranges: Vec<std::ops::Range<u64>> = Vec::with_capacity(self.entries.len());
    |                         ^^^ Use of undeclared type or module `std`

error[E0554]: #![feature] may not be used on the stable release channel
 --> src/lib.rs:9:19
  |
9 | #![cfg_attr(test, feature(test))]
  |                   ^^^^^^^^^^^^^^

error[E0658]: `crate` in paths is experimental (see issue #45477)
 --> src/external_edge.rs:5:5
  |
5 | use crate::compass_point::{Cardinal, Ordinal};
  |     ^^^^^

error[E0658]: `crate` in paths is experimental (see issue #45477)
    --> src/lib.rs:1340:5
     |
1340 | use crate::compass_point::{MainWind};
     |     ^^^^^

error[E0658]: `crate` in paths is experimental (see issue #45477)
    --> src/lib.rs:1341:5
     |
1341 | use crate::compass_point::MainWind::*;
     |     ^^^^^

error: aborting due to 6 previous errors

Some errors occurred: E0433, E0554, E0658.
For more information about an error, try `rustc --explain E0433`.
error: Could not compile `cdshealpix`.

To learn more, run the command again with --verbose.

This is on macOS with rust installed via Homebrew. This is what I have:

(gammapy-dev) hfm-1804a:cds-healpix-rust deil$ rustc --version
rustc 1.27.0
(gammapy-dev) hfm-1804a:cds-healpix-rust deil$ cargo --version
cargo 1.26.0

Can you reproduce? Do I need a newer version of rust?

fxpineau commented 5 years ago

You have to update with rustup update

cdeil commented 5 years ago

Looks like I have to uninstall rust from Homebrew first to be able to isntall rustup.

I'll do that, but could you please clarify min version needed in the README?

cdeil commented 5 years ago

Now I get this error:

(gammapy-dev) hfm-1804a:cds-healpix-rust deil$ cargo test
    Updating crates.io index
   Compiling katex-doc v0.1.0
   Compiling cdshealpix v0.2.0 (/Users/deil/work/code/cds-healpix-rust)
error[E0554]: #![feature] may not be used on the stable release channel
 --> src/lib.rs:9:19
  |
9 | #![cfg_attr(test, feature(test))]
  |                   ^^^^^^^^^^^^^

warning: unused import: `super::*`
    --> src/nested/bmoc.rs:1333:7
     |
1333 |   use super::*;
     |       ^^^^^^^^
     |
     = note: #[warn(unused_imports)] on by default

warning: unused variable: `inner_direction`
    --> src/lib.rs:1451:38
     |
1451 | fn eqr_edge_direction_from_neighbour(inner_direction: &MainWind, neighbour_direction: &MainWind) -> MainWind {
     |                                      ^^^^^^^^^^^^^^^ help: consider prefixing with an underscore: `_inner_direction`
     |
     = note: #[warn(unused_variables)] on by default

warning: unused variable: `depth`
  --> src/nested/mod.rs:83:22
   |
83 | pub fn internal_edge(depth: u8, hash: u64, delta_depth: u8) -> Box<[u64]> {
   |                      ^^^^^ help: consider prefixing with an underscore: `_depth`

warning: unused variable: `depth`
  --> src/nested/mod.rs:90:29
   |
90 | pub fn internal_edge_sorted(depth: u8, hash: u64, delta_depth: u8) -> Box<[u64]> {
   |                             ^^^^^ help: consider prefixing with an underscore: `_depth`

warning: value assigned to `cell` is never read
   --> src/nested/bmoc.rs:656:13
    |
656 |     let mut cell = None;
    |             ^^^^
    |
    = note: #[warn(unused_assignments)] on by default
    = help: maybe it is overwritten before being read?

warning: constant item is never used: `SQRT2`
  --> src/lib.rs:17:1
   |
17 | const SQRT2: f64 = 1.41421356237309504880_f64;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: #[warn(dead_code)] on by default

warning: function is never used: `haversine_dist`
   --> src/lib.rs:294:1
    |
294 | fn haversine_dist(p1_lon: f64, p1_lat: f64, p2_lon: f64, p2_lat: f64) -> f64 {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: method is never used: `times_nside`
   --> src/nested/mod.rs:348:3
    |
348 |   fn times_nside(&self, i: u8) -> f64 {
    |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: method is never used: `ncell_in_cone_upper_bound`
    --> src/nested/mod.rs:1241:3
     |
1241 |   fn ncell_in_cone_upper_bound(&self, cone_radius: f64) -> usize {
     |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: method is never used: `hashs`
    --> src/nested/mod.rs:1557:3
     |
1557 |   fn hashs<T: LonLatT>(&self, poly_vertices: &[T]) -> Box<[u64]> {
     |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: method is never used: `allsky_bmoc`
    --> src/nested/mod.rs:1567:3
     |
1567 |   fn allsky_bmoc(&self) -> BMOC {
     |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: method is never used: `from_cor_matrix`
  --> src/xy_geom/ellipse.rs:39:3
   |
39 |   pub fn from_cor_matrix(sig_x: f64, sig_y: f64, rho: f64) -> Ellipse {
   |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: method is never used: `to_a_b_theta`
  --> src/xy_geom/ellipse.rs:62:3
   |
62 |   pub fn to_a_b_theta(&self) -> (f64, f64, f64) {
   |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: method is never used: `extended_stat_by_circle`
  --> src/xy_geom/ellipse.rs:71:3
   |
71 |   fn extended_stat_by_circle(&self, sig: f64) -> Ellipse {
   |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: method is never used: `extended_stat`
  --> src/xy_geom/ellipse.rs:79:3
   |
79 |   fn extended_stat(&self, other: &Ellipse) -> Ellipse {
   |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: method is never used: `extended_geom_by_circle`
  --> src/xy_geom/ellipse.rs:87:3
   |
87 |   fn extended_geom_by_circle(&self, sig: f64) -> Ellipse {
   |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: method is never used: `path_along_edge`
   --> src/xy_geom/ellipse.rs:122:3
    |
122 |   pub fn path_along_edge(a: f64, b: f64, theta: f64, half_num_points: usize) -> Box<[(f64, f64)]> {
    |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: function is never used: `rotate`
   --> src/xy_geom/ellipse.rs:141:1
    |
141 | fn rotate(x: f64, y: f64, cost: f64, sint: f64) -> (f64, f64) {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: method is never used: `path_along_edge`
   --> src/sph_geom/elliptical_cone.rs:150:3
    |
150 |   pub fn path_along_edge(lon: f64, lat: f64, a: f64, b: f64, theta: f64, half_num_points: usize) -> Box<[(f64, f64)]> {
    |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: variant is never constructed: `TRUE`
  --> src/sph_geom/mod.rs:70:3
   |
70 |   TRUE,
   |   ^^^^

warning: variant is never constructed: `FALSE`
  --> src/sph_geom/mod.rs:71:3
   |
71 |   FALSE,
   |   ^^^^^

warning: function is never used: `cone_special_point_in_eqr`
   --> src/special_points_finder.rs:126:1
    |
126 | / pub fn cone_special_point_in_eqr(mut z: f64, z0: f64, eucl_cone_radius: f64, north_point: bool,
127 | |   z_eps_max: f64, n_iter_max: u8) -> Option<f64> {
128 | |   // Compute constants
129 | |   let cte = if north_point { // negative slope
...   |
151 | |   }
152 | | }
    | |_^

warning: function is never used: `cone_special_point_in_pc`
   --> src/special_points_finder.rs:285:1
    |
285 | / pub fn cone_special_point_in_pc(mut z: f64, cone_center_lon_mod_half_pi: f64,
286 | |   mut z0: f64, eucl_cone_radius: f64, east_value: bool, mut north_value: bool,
287 | |   z_eps_max: f64, n_iter_max: u8) -> Option<f64> {
288 | |   let spc =  z < 0.0; // south polar cap
...   |
313 | |   }
314 | | }
    | |_^

warning: comparison is useless due to type limits
   --> src/nested/mod.rs:713:53
    |
713 |       tmp -= x;           debug_assert!((x < lim && tmp <  0) || (x == lim && tmp == 0));
    |                                                     ^^^^^^^^
    |
    = note: #[warn(unused_comparisons)] on by default

error: aborting due to previous error

For more information about this error, try `rustc --explain E0554`.
error: Could not compile `cdshealpix`.
warning: build failed, waiting for other jobs to finish...
error: build failed
(gammapy-dev) hfm-1804a:cds-healpix-rust deil$ rustc --version
rustc 1.34.2 (6c2484dc3 2019-05-13)
(gammapy-dev) hfm-1804a:cds-healpix-rust deil$ cargo --version
cargo 1.34.0 (6789d8a0a 2019-04-01)
fxpineau commented 5 years ago

You can try:

cargo update cargo clean cargo test

Or install the nightly version (but you are supposed to need it only for bench)

rustup install nightly cargo test +nightly

fxpineau commented 4 years ago

I removed the need for the nightly compiler.