Skip to content

building: incompatible types error in compute/cast/utf8_to.rs #14134

@fdncred

Description

@fdncred

Checks

  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of Polars.

Reproducible example

Just building the crate, these lines produce the error.

    let buffers = if uses_buffer {
        Arc::from([arr.values().clone()])
    } else {
        Arc::from([])
    };

Log output

error[E0308]: `if` and `else` have incompatible types
   --> C:\Users\dschroeder\.cargo\registry\src\index.crates.io-6f17d22bba15001f\polars-arrow-0.37.0\src\compute\cast\utf8_to.rs:101:9
    |
98  |       let buffers = if uses_buffer {
    |  ___________________-
99  | |         Arc::from([arr.values().clone()])
    | |         --------------------------------- expected because of this
100 | |     } else {
101 | |         Arc::from([])
    | |         ^^^^^^^^^^^^^ expected an array with a fixed size of 1 element, found one with 0 elements
102 | |     };
    | |_____- `if` and `else` have incompatible types
    |
    = note: expected struct `Arc<[buffer::immutable::Buffer<u8>; 1]>`
               found struct `Arc<[_; 0]>`

Issue description

I'm trying to update nushell to the latest polars 0.37.0 crates and cannot build because of this error.

Expected behavior

clean build without warnings or errors.

Installed versions

polars-io = { version = "0.37", features = ["avro"], optional = true }
polars-arrow = { version = "0.37", optional = true }
polars-ops = { version = "0.37", optional = true }
polars-plan = { version = "0.37", optional = true }
polars-utils = { version = "0.37", optional = true }

[dependencies.polars]
features = [
"arg_where",
"checked_arithmetic",
"concat_str",
"cross_join",
"csv",
"cum_agg",
"default",
"dtype-categorical",
"dtype-datetime",
"dtype-struct",
"dtype-i8",
"dtype-i16",
"dtype-u8",
"dtype-u16",
"dynamic_group_by",
"ipc",
"is_in",
"json",
"lazy",
"object",
"parquet",
"random",
"rolling_window",
"rows",
"serde",
"serde-lazy",
"strings",
"to_dummies",
]
optional = true
version = "0.37"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds triageAwaiting prioritization by a maintainerrustRelated to Rust Polars

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions