rust_mysql_common icon indicating copy to clipboard operation
rust_mysql_common copied to clipboard

cargo check --no-default-features fails

Open ch3pjw opened this issue 9 months ago • 2 comments

Running cargo check --no-default-features fails on the latest tag (v0.34.1) and on master (467b6c00b1139593e6c402f24453855c3af84141, 7 commits after the v0.34.1 tag).

My use case for --no-default-features is that I want to use just the mysql_common data types in a library to expose to other crates. Looking at Cargo.toml I don't think I can use --no-default-features and then enable flate2 manually to make this go away.

It looks like an issue with the flate dependency:

cargo check --no-default-features
  Downloaded thiserror v1.0.64
  Downloaded thiserror-impl v1.0.64
  Downloaded 2 crates (37.6 KB) in 0.13s
   Compiling thiserror v1.0.64
    Checking lazy_static v1.5.0
   Compiling jobserver v0.1.32
    Checking typenum v1.17.0
   Compiling num-traits v0.2.19
    Checking getrandom v0.2.15
   Compiling subprocess v0.2.9
    Checking regex-automata v0.4.8
    Checking flate2 v1.0.34
   Compiling quote v1.0.37
error: You need to choose a zlib backend
   --> /home/paul/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/flate2-1.0.34/src/lib.rs:100:1
    |
100 | compile_error!("You need to choose a zlib backend");
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0432]: unresolved imports `crate::ffi::Deflate`, `crate::ffi::ErrorMessage`, `crate::ffi::Inflate`
 --> /home/paul/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/flate2-1.0.34/src/mem.rs:5:33
  |
5 | use crate::ffi::{self, Backend, Deflate, DeflateBackend, ErrorMessage, Inflate, InflateBackend};
  |                                 ^^^^^^^                  ^^^^^^^^^^^^  ^^^^^^^ no `Inflate` in `ffi`
  |                                 |                        |
  |                                 |                        no `ErrorMessage` in `ffi`
  |                                 no `Deflate` in `ffi`

    Checking rand_core v0.6.4
error[E0412]: cannot find type `ErrorMessage` in this scope
  --> /home/paul/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/flate2-1.0.34/src/ffi/mod.rs:48:26
   |
48 | impl std::fmt::Debug for ErrorMessage {
   |                          ^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find value `MZ_NO_FLUSH` in module `ffi`
  --> /home/paul/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/flate2-1.0.34/src/mem.rs:50:17
   |
50 |     None = ffi::MZ_NO_FLUSH as isize,
   |                 ^^^^^^^^^^^ not found in `ffi`

error[E0425]: cannot find value `MZ_SYNC_FLUSH` in module `ffi`
  --> /home/paul/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/flate2-1.0.34/src/mem.rs:59:17
   |
59 |     Sync = ffi::MZ_SYNC_FLUSH as isize,
   |                 ^^^^^^^^^^^^^ not found in `ffi`

error[E0425]: cannot find value `MZ_PARTIAL_FLUSH` in module `ffi`
  --> /home/paul/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/flate2-1.0.34/src/mem.rs:69:20
   |
69 |     Partial = ffi::MZ_PARTIAL_FLUSH as isize,
   |                    ^^^^^^^^^^^^^^^^ not found in `ffi`

error[E0425]: cannot find value `MZ_FULL_FLUSH` in module `ffi`
  --> /home/paul/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/flate2-1.0.34/src/mem.rs:76:17
   |
76 |     Full = ffi::MZ_FULL_FLUSH as isize,
   |                 ^^^^^^^^^^^^^ not found in `ffi`

error[E0425]: cannot find value `MZ_FINISH` in module `ffi`
  --> /home/paul/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/flate2-1.0.34/src/mem.rs:82:19
   |
82 |     Finish = ffi::MZ_FINISH as isize,
   |                   ^^^^^^^^^ not found in `ffi`

error[E0425]: cannot find value `MZ_NO_FLUSH` in module `ffi`
  --> /home/paul/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/flate2-1.0.34/src/mem.rs:93:17
   |
93 |     None = ffi::MZ_NO_FLUSH as isize,
   |                 ^^^^^^^^^^^ not found in `ffi`

error[E0425]: cannot find value `MZ_SYNC_FLUSH` in module `ffi`
   --> /home/paul/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/flate2-1.0.34/src/mem.rs:102:17
    |
102 |     Sync = ffi::MZ_SYNC_FLUSH as isize,
    |                 ^^^^^^^^^^^^^ not found in `ffi`

error[E0425]: cannot find value `MZ_FINISH` in module `ffi`
   --> /home/paul/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/flate2-1.0.34/src/mem.rs:108:19
    |
108 |     Finish = ffi::MZ_FINISH as isize,
    |                   ^^^^^^^^^ not found in `ffi`

error[E0425]: cannot find value `MZ_DEFAULT_WINDOW_BITS` in module `ffi`
   --> /home/paul/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/flate2-1.0.34/src/mem.rs:197:59
    |
197 |             inner: Deflate::make(level, zlib_header, ffi::MZ_DEFAULT_WINDOW_BITS as u8),
    |                                                           ^^^^^^^^^^^^^^^^^^^^^^ not found in `ffi`

error[E0425]: cannot find value `MZ_DEFAULT_WINDOW_BITS` in module `ffi`
   --> /home/paul/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/flate2-1.0.34/src/mem.rs:367:52
    |
367 |             inner: Inflate::make(zlib_header, ffi::MZ_DEFAULT_WINDOW_BITS as u8),
    |                                                    ^^^^^^^^^^^^^^^^^^^^^^ not found in `ffi`

   Compiling syn v2.0.98
   Compiling cc v1.1.30
Some errors have detailed explanations: E0412, E0425, E0432.
For more information about an error, try `rustc --explain E0412`.
error: could not compile `flate2` (lib) due to 13 previous errors
warning: build failed, waiting for other jobs to finish...

ch3pjw avatar Feb 27 '25 10:02 ch3pjw

Hi. This requires moving Compresison into an optional feature (at the moment it's not).

I don't think I would be able to do it in the nearest future because of a trip, so feel free to file a PR. We also have #38 as a compression-related issue

blackbeam avatar Feb 27 '25 11:02 blackbeam

Just mentioning for completeness: Having dug a bit more I can see that running cargo check --no-default-features --features=flate2/zlib will at least allow the removal of the default derive feature.

I will have a look what's required to make compression optional and how easy it would be to integrate zstd.

ch3pjw avatar Feb 28 '25 09:02 ch3pjw