mobiusklein / mzdata

Apache License 2.0
21 stars 4 forks source link

Compilation issues #11

Closed douweschulte closed 3 weeks ago

douweschulte commented 3 weeks ago

I updated to mzdata 0.31 in rustyms and it fails during compilation (see below). I am running rust 1.81 (latest stable). What am I doing wrong, as mzdata 0.31 obviously built successfully for it to be uploaded to crates.io. For annotator I had the feeling I had to pick a pair of mzdata and mzpeaks that worked together but here I only have mzdata.

Full compilation error

``` Checking mzdata v0.31.0 error[E0277]: the trait bound `impl Iterator: FusedIterator` is not satisfied --> C:\Users\5803969\.cargo\registry\src\index.crates.io-6f17d22bba15001f\mzdata-0.31.0\src\spectrum\spectrum_types.rs:626:23 | 626 | fn iter(&self) -> impl Iterator | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `FusedIterator` is not implemented for `impl Iterator` | note: required by a bound in `mzpeaks::PeakCollection::{synthetic#0}` --> C:\Users\5803969\.cargo\registry\src\index.crates.io-6f17d22bba15001f\mzpeaks-0.21.0\src\peak_set.rs:66:50 | 66 | fn iter(&self) -> impl Iterator + FusedIterator + ExactSizeIterator | ^^^^^^^^^^^^^ required by this bound in `PeakCollection::{synthetic#0}` error[E0277]: the trait bound `impl Iterator: ExactSizeIterator` is not satisfied --> C:\Users\5803969\.cargo\registry\src\index.crates.io-6f17d22bba15001f\mzdata-0.31.0\src\spectrum\spectrum_types.rs:626:23 | 626 | fn iter(&self) -> impl Iterator | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `ExactSizeIterator` is not implemented for `impl Iterator` | = help: the following other types implement trait `ExactSizeIterator`: &mut I Args ArgsOs ArrayChunksMut<'_, T, N> ArrayWindows<'_, T, N> BetweenIter<'a, C, T, P> Box Chunks<'_, T> and 182 others note: required by a bound in `mzpeaks::PeakCollection::{synthetic#0}` --> C:\Users\5803969\.cargo\registry\src\index.crates.io-6f17d22bba15001f\mzpeaks-0.21.0\src\peak_set.rs:66:66 | 66 | fn iter(&self) -> impl Iterator + FusedIterator + ExactSizeIterator | ^^^^^^^^^^^^^^^^^ required by this bound in `PeakCollection::{synthetic#0}` error[E0277]: the trait bound `impl Iterator: FusedIterator` is not satisfied --> C:\Users\5803969\.cargo\registry\src\index.crates.io-6f17d22bba15001f\mzdata-0.31.0\src\spectrum\spectrum_types.rs:737:23 | 737 | fn iter(&self) -> impl Iterator | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `FusedIterator` is not implemented for `impl Iterator` | note: required by a bound in `mzpeaks::PeakCollection::{synthetic#0}` --> C:\Users\5803969\.cargo\registry\src\index.crates.io-6f17d22bba15001f\mzpeaks-0.21.0\src\peak_set.rs:66:50 | 66 | fn iter(&self) -> impl Iterator + FusedIterator + ExactSizeIterator | ^^^^^^^^^^^^^ required by this bound in `PeakCollection::{synthetic#0}` error[E0277]: the trait bound `impl Iterator: ExactSizeIterator` is not satisfied --> C:\Users\5803969\.cargo\registry\src\index.crates.io-6f17d22bba15001f\mzdata-0.31.0\src\spectrum\spectrum_types.rs:737:23 | 737 | fn iter(&self) -> impl Iterator | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `ExactSizeIterator` is not implemented for `impl Iterator` | = help: the following other types implement trait `ExactSizeIterator`: &mut I Args ArgsOs ArrayChunksMut<'_, T, N> ArrayWindows<'_, T, N> BetweenIter<'a, C, T, P> Box Chunks<'_, T> and 182 others note: required by a bound in `mzpeaks::PeakCollection::{synthetic#0}` --> C:\Users\5803969\.cargo\registry\src\index.crates.io-6f17d22bba15001f\mzpeaks-0.21.0\src\peak_set.rs:66:66 | 66 | fn iter(&self) -> impl Iterator + FusedIterator + ExactSizeIterator | ^^^^^^^^^^^^^^^^^ required by this bound in `PeakCollection::{synthetic#0}` error[E0034]: multiple applicable items in scope --> C:\Users\5803969\.cargo\registry\src\index.crates.io-6f17d22bba15001f\mzdata-0.31.0\src\spectrum\peaks.rs:323:44 | 323 | Self::Centroid(peaks) => peaks.base_peak(), | ^^^^^^^^^ multiple `base_peak` found | note: candidate #1 is defined in an impl of the trait `SummaryOps` for the type `PeakSetVec` --> C:\Users\5803969\.cargo\registry\src\index.crates.io-6f17d22bba15001f\mzdata-0.31.0\src\spectrum\peaks.rs:135:5 | 135 | fn base_peak(&self) -> CentroidPeak { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: candidate #2 is defined in an impl of the trait `mzpeaks::PeakCollection` for the type `PeakSetVec` help: disambiguate the method for candidate #1 | 323 | Self::Centroid(peaks) => SummaryOps::base_peak(&peaks), | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ help: disambiguate the method for candidate #2 | 323 | Self::Centroid(peaks) => mzpeaks::PeakCollection::base_peak(&peaks), | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0034]: multiple applicable items in scope --> C:\Users\5803969\.cargo\registry\src\index.crates.io-6f17d22bba15001f\mzdata-0.31.0\src\spectrum\peaks.rs:324:48 | 324 | Self::Deconvoluted(peaks) => peaks.base_peak(), | ^^^^^^^^^ multiple `base_peak` found | note: candidate #1 is defined in an impl of the trait `SummaryOps` for the type `PeakSetVec` --> C:\Users\5803969\.cargo\registry\src\index.crates.io-6f17d22bba15001f\mzdata-0.31.0\src\spectrum\peaks.rs:204:5 | 204 | fn base_peak(&self) -> CentroidPeak { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: candidate #2 is defined in an impl of the trait `mzpeaks::PeakCollection` for the type `PeakSetVec` help: disambiguate the method for candidate #1 | 324 | Self::Deconvoluted(peaks) => SummaryOps::base_peak(&peaks), | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ help: disambiguate the method for candidate #2 | 324 | Self::Deconvoluted(peaks) => mzpeaks::PeakCollection::base_peak(&peaks), | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0034]: multiple applicable items in scope --> C:\Users\5803969\.cargo\registry\src\index.crates.io-6f17d22bba15001f\mzdata-0.31.0\src\spectrum\peaks.rs:585:56 | 585 | RefPeakDataLevel::Centroid(peaks) => peaks.base_peak(), | ^^^^^^^^^ multiple `base_peak` found | note: candidate #1 is defined in an impl of the trait `SummaryOps` for the type `PeakSetVec` --> C:\Users\5803969\.cargo\registry\src\index.crates.io-6f17d22bba15001f\mzdata-0.31.0\src\spectrum\peaks.rs:135:5 | 135 | fn base_peak(&self) -> CentroidPeak { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: candidate #2 is defined in an impl of the trait `mzpeaks::PeakCollection` for the type `PeakSetVec` help: disambiguate the method for candidate #1 | 585 | RefPeakDataLevel::Centroid(peaks) => SummaryOps::base_peak(&peaks), | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ help: disambiguate the method for candidate #2 | 585 | RefPeakDataLevel::Centroid(peaks) => mzpeaks::PeakCollection::base_peak(&peaks), | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0034]: multiple applicable items in scope --> C:\Users\5803969\.cargo\registry\src\index.crates.io-6f17d22bba15001f\mzdata-0.31.0\src\spectrum\peaks.rs:586:60 | 586 | RefPeakDataLevel::Deconvoluted(peaks) => peaks.base_peak(), | ^^^^^^^^^ multiple `base_peak` found | note: candidate #1 is defined in an impl of the trait `SummaryOps` for the type `PeakSetVec` --> C:\Users\5803969\.cargo\registry\src\index.crates.io-6f17d22bba15001f\mzdata-0.31.0\src\spectrum\peaks.rs:204:5 | 204 | fn base_peak(&self) -> CentroidPeak { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: candidate #2 is defined in an impl of the trait `mzpeaks::PeakCollection` for the type `PeakSetVec` help: disambiguate the method for candidate #1 | 586 | RefPeakDataLevel::Deconvoluted(peaks) => SummaryOps::base_peak(&peaks), | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ help: disambiguate the method for candidate #2 | 586 | RefPeakDataLevel::Deconvoluted(peaks) => mzpeaks::PeakCollection::base_peak(&peaks), | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Some errors have detailed explanations: E0034, E0277. For more information about an error, try `rustc --explain E0034`. error: could not compile `mzdata` (lib) due to 8 previous errors ```

Cargo tree output (only mzdata part)

``` ├── mzdata v0.31.0 │ ├── base16ct v0.2.0 │ ├── base64-simd v0.8.0 │ │ ├── outref v0.5.1 │ │ └── vsimd v0.8.0 │ ├── bitflags v2.6.0 │ ├── bytemuck v1.19.0 │ ├── chrono v0.4.38 │ │ ├── num-traits v0.2.19 │ │ │ [build-dependencies] │ │ │ └── autocfg v1.4.0 │ │ └── windows-targets v0.52.6 │ │ └── windows_x86_64_msvc v0.52.6 │ ├── flate2 v1.0.34 (*) │ ├── indexmap v2.6.0 │ │ ├── equivalent v1.0.1 │ │ ├── hashbrown v0.15.0 │ │ └── serde v1.0.210 (*) │ ├── lazy_static v1.5.0 │ ├── log v0.4.22 │ ├── md5 v0.7.0 │ ├── mzpeaks v0.21.0 │ │ └── num-traits v0.2.19 (*) │ ├── num-traits v0.2.19 (*) │ ├── quick-xml v0.30.0 │ │ ├── memchr v2.7.4 │ │ └── serde v1.0.210 (*) │ ├── regex v1.11.0 │ │ ├── aho-corasick v1.1.3 │ │ │ └── memchr v2.7.4 │ │ ├── memchr v2.7.4 │ │ ├── regex-automata v0.4.8 │ │ │ ├── aho-corasick v1.1.3 (*) │ │ │ ├── memchr v2.7.4 │ │ │ └── regex-syntax v0.8.5 │ │ └── regex-syntax v0.8.5 ```

Note: I tried 0.28..=0.31 and all gave the same error.

mobiusklein commented 3 weeks ago

This is because I released a new version of mzpeaks v0.21 last night that added those bounds to the PeakCollection::iter method, thinking they would help the compiler. I reverted the change and released v0.22 which should fix the problem.

douweschulte commented 3 weeks ago

Thanks for the fast response, the iterator errors are gone indeed now. The double method errors are still there though. I have checked that cargo now indeed selects mzpeaks 0.22 when compiling mzdata 0.31.

All errors when compiling mzdata 0.31 with mzpeaks 0.22

``` error[E0034]: multiple applicable items in scope --> C:\Users\5803969\.cargo\registry\src\index.crates.io-6f17d22bba15001f\mzdata-0.31.0\src\spectrum\peaks.rs:323:44 | 323 | Self::Centroid(peaks) => peaks.base_peak(), | ^^^^^^^^^ multiple `base_peak` found | note: candidate #1 is defined in an impl of the trait `SummaryOps` for the type `PeakSetVec` --> C:\Users\5803969\.cargo\registry\src\index.crates.io-6f17d22bba15001f\mzdata-0.31.0\src\spectrum\peaks.rs:135:5 | 135 | fn base_peak(&self) -> CentroidPeak { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: candidate #2 is defined in an impl of the trait `mzpeaks::PeakCollection` for the type `PeakSetVec` help: disambiguate the method for candidate #1 | 323 | Self::Centroid(peaks) => SummaryOps::base_peak(&peaks), | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ help: disambiguate the method for candidate #2 | 323 | Self::Centroid(peaks) => mzpeaks::PeakCollection::base_peak(&peaks), | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0034]: multiple applicable items in scope --> C:\Users\5803969\.cargo\registry\src\index.crates.io-6f17d22bba15001f\mzdata-0.31.0\src\spectrum\peaks.rs:324:48 | 324 | Self::Deconvoluted(peaks) => peaks.base_peak(), | ^^^^^^^^^ multiple `base_peak` found | note: candidate #1 is defined in an impl of the trait `SummaryOps` for the type `PeakSetVec` --> C:\Users\5803969\.cargo\registry\src\index.crates.io-6f17d22bba15001f\mzdata-0.31.0\src\spectrum\peaks.rs:204:5 | 204 | fn base_peak(&self) -> CentroidPeak { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: candidate #2 is defined in an impl of the trait `mzpeaks::PeakCollection` for the type `PeakSetVec` help: disambiguate the method for candidate #1 | 324 | Self::Deconvoluted(peaks) => SummaryOps::base_peak(&peaks), | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ help: disambiguate the method for candidate #2 | 324 | Self::Deconvoluted(peaks) => mzpeaks::PeakCollection::base_peak(&peaks), | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0034]: multiple applicable items in scope --> C:\Users\5803969\.cargo\registry\src\index.crates.io-6f17d22bba15001f\mzdata-0.31.0\src\spectrum\peaks.rs:585:56 | 585 | RefPeakDataLevel::Centroid(peaks) => peaks.base_peak(), | ^^^^^^^^^ multiple `base_peak` found | note: candidate #1 is defined in an impl of the trait `SummaryOps` for the type `PeakSetVec` --> C:\Users\5803969\.cargo\registry\src\index.crates.io-6f17d22bba15001f\mzdata-0.31.0\src\spectrum\peaks.rs:135:5 | 135 | fn base_peak(&self) -> CentroidPeak { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: candidate #2 is defined in an impl of the trait `mzpeaks::PeakCollection` for the type `PeakSetVec` help: disambiguate the method for candidate #1 | 585 | RefPeakDataLevel::Centroid(peaks) => SummaryOps::base_peak(&peaks), | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ help: disambiguate the method for candidate #2 | 585 | RefPeakDataLevel::Centroid(peaks) => mzpeaks::PeakCollection::base_peak(&peaks), | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0034]: multiple applicable items in scope --> C:\Users\5803969\.cargo\registry\src\index.crates.io-6f17d22bba15001f\mzdata-0.31.0\src\spectrum\peaks.rs:586:60 | 586 | RefPeakDataLevel::Deconvoluted(peaks) => peaks.base_peak(), | ^^^^^^^^^ multiple `base_peak` found | note: candidate #1 is defined in an impl of the trait `SummaryOps` for the type `PeakSetVec` --> C:\Users\5803969\.cargo\registry\src\index.crates.io-6f17d22bba15001f\mzdata-0.31.0\src\spectrum\peaks.rs:204:5 | 204 | fn base_peak(&self) -> CentroidPeak { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: candidate #2 is defined in an impl of the trait `mzpeaks::PeakCollection` for the type `PeakSetVec` help: disambiguate the method for candidate #1 | 586 | RefPeakDataLevel::Deconvoluted(peaks) => SummaryOps::base_peak(&peaks), | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ help: disambiguate the method for candidate #2 | 586 | RefPeakDataLevel::Deconvoluted(peaks) => mzpeaks::PeakCollection::base_peak(&peaks), | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ For more information about this error, try `rustc --explain E0034`. error: could not compile `mzdata` (lib) due to 4 previous errors ```

Interestingly enough this error always pops up for 0.31/30/29/28 even though version 0.29 worked before updating, so I assume some other recent change in mzpeaks is the root cause of this error.

mobiusklein commented 3 weeks ago

Thank you for bearing with me as I fix this. I've released mzdata v0.32.0 that should fix that problem and something else related to an unnecessary re-organization of symbols from mzsignal.

douweschulte commented 3 weeks ago

Thanks so much for the quick fix! I am very happy to help being on the other end of the line in helping you figure this out. Just so you know if you really think some old version is not supposed to be used anymore you might want to look into 'yanking' those versions.