rust-transit / gtfs-structure

Read a GTFS file
MIT License
57 stars 32 forks source link

Build fails with musl rust 1.59.0-nightly-2021-12-03 #108

Closed naxxfish closed 2 years ago

naxxfish commented 2 years ago

When compiling with clux/muslrust the following occurs:

#9 93.40 error[E0277]: cannot multiply `&()` by `u32`
#9 93.40   --> src/serde_helpers.rs:48:14
#9 93.40    |
#9 93.40 48 |     Ok(hours * 3600u32 + minutes * 60u32 + seconds)
#9 93.40    |              ^ no implementation for `&() * u32`
#9 93.40    |
#9 93.40    = help: the trait `Mul<u32>` is not implemented for `&()`
#9 93.40 
#9 93.40 error[E0277]: cannot multiply `&()` by `u32`
#9 93.40   --> src/serde_helpers.rs:48:34
#9 93.40    |
#9 93.40 48 |     Ok(hours * 3600u32 + minutes * 60u32 + seconds)
#9 93.40    |                                  ^ no implementation for `&() * u32`
#9 93.40    |
#9 93.40    = help: the trait `Mul<u32>` is not implemented for `&()`
#9 93.40 
#9 93.41 error[E0277]: the trait bound `(): FromStr` is not satisfied
#9 93.41     --> src/serde_helpers.rs:45:23
#9 93.41      |
#9 93.41 45   |     let hours = &v[0].parse()?;
#9 93.41      |                       ^^^^^ the trait `FromStr` is not implemented for `()`
#9 93.41      |
#9 93.41 note: required by a bound in `core::str::<impl str>::parse`
#9 93.41 
#9 93.41 error[E0277]: the trait bound `(): FromStr` is not satisfied
#9 93.41     --> src/serde_helpers.rs:46:25
#9 93.41      |
#9 93.41 46   |     let minutes = &v[1].parse()?;
#9 93.41      |                         ^^^^^ the trait `FromStr` is not implemented for `()`
#9 93.41      |
#9 93.41 note: required by a bound in `core::str::<impl str>::parse`
#9 93.41 
#9 93.41 error[E0277]: the trait bound `(): FromStr` is not satisfied
#9 93.41     --> src/serde_helpers.rs:47:25
#9 93.41      |
#9 93.41 47   |     let seconds = &v[2].parse()?;
#9 93.41      |                         ^^^^^ the trait `FromStr` is not implemented for `()`
#9 93.41      |
#9 93.41 note: required by a bound in `core::str::<impl str>::parse`
#9 93.41 
#9 93.65 For more information about this error, try `rustc --explain E0277`.
#9 93.66 error: could not compile `gtfs-structures` due to 5 previous errors
#9 93.66 warning: build failed, waiting for other jobs to finish...
#9 107.5 error: build failed

Reproduce: Create Dockerfile with following contents:

FROM clux/muslrust:1.59.0-nightly-2021-12-03 as rustbuilder

RUN apt-get update && apt-get -y install musl-tools libssl-dev && rm -rf /var/lib/apt/lists/*

ADD . .

RUN rustup target add x86_64-unknown-linux-musl
RUN cargo build --target x86_64-unknown-linux-musl --release --target-dir /target/

Then build:

docker build .
Tristramg commented 2 years ago

Thank you for this bug report. It also fails on my setup (not musl) when using nightly.

I will investigate that

Tristramg commented 2 years ago

Out of curiositiy, in what context are you using gtfs-structures? Maybe we can be of some specific help?