Skip to content

manager: fix build on 32-bit architectures - #185

Merged
Toqozz merged 1 commit into
Toqozz:masterfrom
classabbyamp:32bit-fix
Oct 12, 2026
Merged

Toqozz merged 1 commit into
Toqozz:masterfrom
classabbyamp:32bit-fix

Conversation

@classabbyamp

Copy link
Copy Markdown
Contributor

without this cast, build fails with this error on 32-bit platforms, because XScreenSaverInfo.idle has the type c_ulong, which is u32 on 32-bit platforms and u64 on 64-bit platforms:

   Compiling wired v0.10.7 (/builddir/wired-notify-0.10.7)
error[E0308]: mismatched types
   --> src/manager.rs:210:48
    |
210 |                         if info_idle / 1000 >= threshold {
    |                                                ^^^^^^^^^ expected `u32`, found `u64`

error[E0277]: can't compare `u32` with `u64`
   --> src/manager.rs:210:45
    |
210 |                         if info_idle / 1000 >= threshold {
    |                                             ^^ no implementation for `u32 < u64` and `u32 > u64`
    |
    = help: the trait `PartialOrd<u64>` is not implemented for `u32`
help: `u32` implements trait `PartialOrd<Rhs>`
   --> /rustc/88d9e12ae178fab0fb5cc050a94da85685d449ea/library/core/src/cmp.rs:1997:12
    |
    = note: `PartialOrd`
   ::: /rustc/88d9e12ae178fab0fb5cc050a94da85685d449ea/library/core/src/cmp.rs:2080:4
    |
    = note: in this macro invocation
    |
   ::: /host/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/glib-0.15.5/src/types.rs:429:1
    |
429 | impl PartialOrd<ULong> for libc::c_ulong {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `PartialOrd<ULong>`
    = note: this error originates in the macro `ord_impl` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0308]: mismatched types
   --> src/manager.rs:217:47
    |
217 |                         self.last_idle_time = info_idle;
    |                         -------------------   ^^^^^^^^^ expected `u64`, found `u32`
    |                         |
    |                         expected due to the type of this binding

Some errors have detailed explanations: E0277, E0308.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `wired` (bin "wired") due to 3 previous errors

without this cast, build fails with this error on 32-bit platforms,
because `XScreenSaverInfo.idle` has the type `c_ulong`, which is `u32`
on 32-bit platforms and `u64` on 64-bit platforms:

```
   Compiling wired v0.10.7 (/builddir/wired-notify-0.10.7)
error[E0308]: mismatched types
   --> src/manager.rs:210:48
    |
210 |                         if info_idle / 1000 >= threshold {
    |                                                ^^^^^^^^^ expected `u32`, found `u64`

error[E0277]: can't compare `u32` with `u64`
   --> src/manager.rs:210:45
    |
210 |                         if info_idle / 1000 >= threshold {
    |                                             ^^ no implementation for `u32 < u64` and `u32 > u64`
    |
    = help: the trait `PartialOrd<u64>` is not implemented for `u32`
help: `u32` implements trait `PartialOrd<Rhs>`
   --> /rustc/88d9e12ae178fab0fb5cc050a94da85685d449ea/library/core/src/cmp.rs:1997:12
    |
    = note: `PartialOrd`
   ::: /rustc/88d9e12ae178fab0fb5cc050a94da85685d449ea/library/core/src/cmp.rs:2080:4
    |
    = note: in this macro invocation
    |
   ::: /host/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/glib-0.15.5/src/types.rs:429:1
    |
429 | impl PartialOrd<ULong> for libc::c_ulong {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `PartialOrd<ULong>`
    = note: this error originates in the macro `ord_impl` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0308]: mismatched types
   --> src/manager.rs:217:47
    |
217 |                         self.last_idle_time = info_idle;
    |                         -------------------   ^^^^^^^^^ expected `u64`, found `u32`
    |                         |
    |                         expected due to the type of this binding

Some errors have detailed explanations: E0277, E0308.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `wired` (bin "wired") due to 3 previous errors
```
@Toqozz
Toqozz merged commit 9a6b367 into Toqozz:master Oct 12, 2026
@Toqozz

Toqozz commented Oct 12, 2026

Copy link
Copy Markdown
Owner

Thank you!

@classabbyamp
classabbyamp deleted the 32bit-fix branch October 12, 2026 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants