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

master fails to compile with default-features=false #529

Closed
ritchie46 opened this issue Jul 7, 2021 · 6 comments · Fixed by #532 or #533
Closed

master fails to compile with default-features=false #529

ritchie46 opened this issue Jul 7, 2021 · 6 comments · Fixed by #532 or #533
Assignees
Labels

Comments

@ritchie46
Copy link
Contributor

ritchie46 commented Jul 7, 2021

Describe the bug
Creating a new project with this Cargo.toml fails to compile:

[package]
name = "foo"
version = "0.1.0"
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
arrow = {git = "https://github.com/apache/arrow-rs", rev = "80a57be3215ed7210971a501b10664cadfd59bea", default-features=false}

Output:

error[E0432]: unresolved import `rand::prelude::StdRng`
  --> /home/ritchie46/.cargo/git/checkouts/arrow-rs-3b86e19e889d5acc/80a57be/arrow/src/util/bench_util.rs:27:5
   |
27 |     prelude::StdRng,
   |     ^^^^^^^^^^^^^^^ no `StdRng` in `prelude`

error[E0432]: unresolved import `rand::rngs::StdRng`
  --> /home/ritchie46/.cargo/git/checkouts/arrow-rs-3b86e19e889d5acc/80a57be/arrow/src/util/test_util.rs:20:12
   |
20 | use rand::{rngs::StdRng, Rng, SeedableRng};
   |            ^^^^^^^^^^^^ no `StdRng` in `rngs`

error[E0308]: mismatched types
   --> /home/ritchie46/.cargo/git/checkouts/arrow-rs-3b86e19e889d5acc/80a57be/arrow/src/util/bench_util.rs:102:35
    |
94  | pub fn create_string_array<Offset: StringOffsetSizeTrait>(
    |                            ------ this type parameter
...
102 |             if rng.gen::<f32>() < null_density {
    |                                   ^^^^^^^^^^^^ expected type parameter `Offset`, found `f32`
    |
    = note: expected type parameter `Offset`
                         found type `f32`

error[E0308]: mismatched types
   --> /home/ritchie46/.cargo/git/checkouts/arrow-rs-3b86e19e889d5acc/80a57be/arrow/src/util/bench_util.rs:123:35
    |
114 | pub fn create_binary_array<Offset: BinaryOffsetSizeTrait>(
    |                            ------ this type parameter
...
123 |             if rng.gen::<f32>() < null_density {
    |                                   ^^^^^^^^^^^^ expected type parameter `Offset`, found `f32`
    |
    = note: expected type parameter `Offset`
                         found type `f32`

error: aborting due to 4 previous errors

Some errors have detailed explanations: E0308, E0432.
For more information about an error, try `rustc --explain E0308`.
error: could not compile `arrow`

This is introduced in 80a57be / #488

There are quite often feature tag related bugs that could be prevented if we'd run cargo hack in CI.

Would you be willing to accept a PR that adds those checks? @alamb @jorgecarleitao @Dandandan @jhorstmann @nevi-me

@ritchie46 ritchie46 added the bug label Jul 7, 2021
@alamb alamb changed the title master fails to compile master fails to compile with default-features=false Jul 7, 2021
@alamb
Copy link
Contributor

alamb commented Jul 7, 2021

For anyone finding this ticket, a workaround is to add the following to your Cargo dependencies:

# ensure we get the std version of rand so arrow builds without default features
rand = { version = "0.8" }

@alamb
Copy link
Contributor

alamb commented Jul 7, 2021

@ritchie46 I am not sure about cargo-hack -- would the idea be to check every combination of arguments?

Note we supposedly already have a CI check for --no-default-features here:
https://github.com/apache/arrow-rs/blob/master/.github/workflows/rust.yml#L116

But clearly that did not catch this regression

@ritchie46
Copy link
Contributor Author

@ritchie46 I am not sure about cargo-hack -- would the idea be to check every combination of arguments?

Indeed. Running cargo hack check --each-feature --no-dev-deps would run a cargo check on all possible feature combinations.

@joshuataylor
Copy link

joshuataylor commented Jul 9, 2021

I'm also getting this when using:

arrow = { git = "https://github.com/apache/arrow-rs" }

and also from a local path.

Adding rand does fix this.

@alamb
Copy link
Contributor

alamb commented Jul 9, 2021

I am starting to work on this one

@alamb
Copy link
Contributor

alamb commented Jul 12, 2021

github got a little excited and closed this prior to the fix actually being merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants