Skip to content

Bug: swss build failure on latest sonic-swss-common #24661

Description

@yanmarkman

Is it platform specific

generic

Importance or Severity

Critical

Description of the bug

AMD64 branch "master" build failed on incorrect variable cast compare/set in file
swss-common/src/types/consumerstatetable.rs "rustic"
Refer log below

Steps to Reproduce

Build ARCH=amd64 (other ARCHes just not tested)

Actual Behavior and Expected Behavior

Build passed without failure

Relevant log output

[ FAIL LOG START ] [ target/debs/bookworm/swss_1.0.0_amd64.deb ]
..........................................................
   Compiling tracing-error v0.2.1
error[E0600]: cannot apply unary operator `-` to type `u32`
  --> /var/ymarkman/.cargo/git/checkouts/sonic-swss-common-f127700b9bf1a3a6/d6ccff7/crates/swss-common/src/types/consumerstatetable.rs:41:22
   |
41 |             if fd == -1 {
   |                      ^^ cannot apply unary operator `-`
   |
   = note: unsigned values cannot be negated
help: you may have meant the maximum value of `u32`
   |
41 -             if fd == -1 {
41 +             if fd == u32::MAX {
   |

error[E0308]: mismatched types
  --> /var/ymarkman/.cargo/git/checkouts/sonic-swss-common-f127700b9bf1a3a6/d6ccff7/crates/swss-common/src/types/consumerstatetable.rs:44:45
   |
44 |             let fd = BorrowedFd::borrow_raw(fd);
   |                      ---------------------- ^^ expected `i32`, found `u32`
   |                      |
   |                      arguments to this function are incorrect
   |
note: associated function defined here
  --> /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/std/src/os/fd/owned.rs:73:25
help: you can convert a `u32` to an `i32` and panic if the converted value doesn't fit
   |
44 |             let fd = BorrowedFd::borrow_raw(fd.try_into().unwrap());
   |                                               ++++++++++++++++++++

   Compiling color-eyre v0.6.5
error[E0600]: cannot apply unary operator `-` to type `u32`
  --> /var/ymarkman/.cargo/git/checkouts/sonic-swss-common-f127700b9bf1a3a6/d6ccff7/crates/swss-common/src/types/subscriberstatetable.rs:54:22
   |
54 |             if fd == -1 {
   |                      ^^ cannot apply unary operator `-`
   |
   = note: unsigned values cannot be negated
help: you may have meant the maximum value of `u32`
   |
54 -             if fd == -1 {
54 +             if fd == u32::MAX {
   |

error[E0308]: mismatched types
  --> /var/ymarkman/.cargo/git/checkouts/sonic-swss-common-f127700b9bf1a3a6/d6ccff7/crates/swss-common/src/types/subscriberstatetable.rs:57:45
   |
57 |             let fd = BorrowedFd::borrow_raw(fd);
   |                      ---------------------- ^^ expected `i32`, found `u32`
   |                      |
   |                      arguments to this function are incorrect
   |
note: associated function defined here
  --> /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/std/src/os/fd/owned.rs:73:25
help: you can convert a `u32` to an `i32` and panic if the converted value doesn't fit
   |
57 |             let fd = BorrowedFd::borrow_raw(fd.try_into().unwrap());
   |                                               ++++++++++++++++++++

error[E0600]: cannot apply unary operator `-` to type `u32`
  --> /var/ymarkman/.cargo/git/checkouts/sonic-swss-common-f127700b9bf1a3a6/d6ccff7/crates/swss-common/src/types/zmqconsumerstatetable.rs:52:22
   |
52 |             if fd == -1 {
   |                      ^^ cannot apply unary operator `-`
   |
   = note: unsigned values cannot be negated
help: you may have meant the maximum value of `u32`
   |
52 -             if fd == -1 {
52 +             if fd == u32::MAX {
   |

error[E0308]: mismatched types
  --> /var/ymarkman/.cargo/git/checkouts/sonic-swss-common-f127700b9bf1a3a6/d6ccff7/crates/swss-common/src/types/zmqconsumerstatetable.rs:55:45
   |
55 |             let fd = BorrowedFd::borrow_raw(fd);
   |                      ---------------------- ^^ expected `i32`, found `u32`
   |                      |
   |                      arguments to this function are incorrect
   |
note: associated function defined here
  --> /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/std/src/os/fd/owned.rs:73:25
help: you can convert a `u32` to an `i32` and panic if the converted value doesn't fit
   |
55 |             let fd = BorrowedFd::borrow_raw(fd.try_into().unwrap());
   |                                               ++++++++++++++++++++

Some errors have detailed explanations: E0308, E0600.
For more information about an error, try `rustc --explain E0308`.

Output of show version, show techsupport

Attach files (if any)

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions