terminusdb-labs / swipl-rs

26 stars 7 forks source link

Fails to build with swipl v8.2 #43

Open matko opened 1 year ago

matko commented 1 year ago

swipl 8.2 apparently has slightly different types, leading to build failures in stream:

$ swivm use v8.2.0
Now using SWI-Prolog v8.2.0
$ cargo build --all-features
...
error[E0308]: mismatched types
  --> swipl/src/stream.rs:78:26
   |
78 |     if (*stream).flags & fli::SIO_OUTPUT == 0 {
   |                          ^^^^^^^^^^^^^^^ expected `i32`, found `u32`

error[E0277]: no implementation for `i32 & u32`
  --> swipl/src/stream.rs:78:24
   |
78 |     if (*stream).flags & fli::SIO_OUTPUT == 0 {
   |                        ^ no implementation for `i32 & u32`
   |
   = help: the trait `BitAnd<u32>` is not implemented for `i32`
   = help: the following other types implement trait `BitAnd<Rhs>`:
             <&'a i128 as BitAnd<i128>>
             <&'a i16 as BitAnd<i16>>
             <&'a i32 as BitAnd<i32>>
             <&'a i64 as BitAnd<i64>>
             <&'a i8 as BitAnd<i8>>
             <&'a isize as BitAnd<isize>>
             <&'a u128 as BitAnd<u128>>
             <&'a u16 as BitAnd<u16>>
           and 40 others

error[E0308]: mismatched types
   --> swipl/src/stream.rs:220:26
    |
220 |     if (*stream).flags & fli::SIO_INPUT == 0 {
    |                          ^^^^^^^^^^^^^^ expected `i32`, found `u32`

error[E0277]: no implementation for `i32 & u32`
   --> swipl/src/stream.rs:220:24
    |
220 |     if (*stream).flags & fli::SIO_INPUT == 0 {
    |                        ^ no implementation for `i32 & u32`
    |
    = help: the trait `BitAnd<u32>` is not implemented for `i32`
    = help: the following other types implement trait `BitAnd<Rhs>`:
              <&'a i128 as BitAnd<i128>>
              <&'a i16 as BitAnd<i16>>
              <&'a i32 as BitAnd<i32>>
              <&'a i64 as BitAnd<i64>>
              <&'a i8 as BitAnd<i8>>
              <&'a isize as BitAnd<isize>>
              <&'a u128 as BitAnd<u128>>
              <&'a u16 as BitAnd<u16>>
            and 40 others

Some errors have detailed explanations: E0277, E0308.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `swipl` due to 4 previous errors