Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Serde 1.0.172 with derive trait fails compilation on stable-x86_64-unknown-linux-gnu toolchain #2516

@ShakenCodes

Description

@ShakenCodes

Serde 1.0.172 introduces a compilation failure issue when compiling on stable-x86_64-unknown-linux-gnu toolchain, but compiles successfully on stable-aarch64-apple-darwin toolchain. Same code compiles correctly on both toolchains when serde depencency set to 1.0.171.

Serde dependency in Cargo.toml is: serde = { version = "=1.0.172", default-features = false, features = ["derive"] }

Code failing is similar to:
#[derive(Clone, Copy, Debug, Eq, Deserialize, PartialEq, Serialize)]
#[serde(transparent)]
pub struct MyStruct...

This is then used in another struct that also derives Deserialize and Serialize, and that code fails compilation on the Linux system. (Note this fails on a local test machine, and on a GitHub Actions container.)

Compilation reports (3 times for Deserialize, on the same line; once for Serialize at the original declaration):
error[E0277]: the trait bound MyStruct: Deserialize<'_> is not satisfied
--> my_usage.rs:134:24
|
134 | pub system_status: MyStruct,
| ^^^^^^^^^^^^^^^^^ the trait Deserialize<'_> is not implemented for MyStruct

error[E0277]: the trait bound SystemStatusFlags: Serialize is not satisfied
--> my_struct.rs:129:48
|
129 | #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
| ^^^^^^^^^ the trait Serialize is not implemented for MyStruct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions