Skip to content

#[diagnostic] attribute name space is experimental #128317

Closed as not planned
Closed as not planned
@wthrajat

Description

@wthrajat

On compiling the latest version of serde, we get the following error:

$ cargo +nightly build

   Compiling serde v1.0.204
error[E0658]: `#[diagnostic]` attribute name space is experimental
   --> /home/rajat/.cargo/registry/src/index.crates.io-6f17d22bba15001f/serde-1.0.204/src/de/mod.rs:537:5
    |
537 |     diagnostic::on_unimplemented(
    |     ^^^^^^^^^^
    |
    = note: see issue #111996 <https://github.com/rust-lang/rust/issues/111996> for more information
    = help: add `#![feature(diagnostic_namespace)]` to the crate attributes to enable
    = note: this compiler was built on 2024-02-18; consider upgrading it if it is out of date

error[E0658]: `#[diagnostic]` attribute name space is experimental
   --> /home/rajat/.cargo/registry/src/index.crates.io-6f17d22bba15001f/serde-1.0.204/src/ser/mod.rs:220:5
    |
220 |     diagnostic::on_unimplemented(
    |     ^^^^^^^^^^
    |
    = note: see issue #111996 <https://github.com/rust-lang/rust/issues/111996> for more information
    = help: add `#![feature(diagnostic_namespace)]` to the crate attributes to enable
    = note: this compiler was built on 2024-02-18; consider upgrading it if it is out of date

For more information about this error, try `rustc --explain E0658`.
The following warnings were emitted during compilation:

warning: [email protected]: cargo:rustc-check-cfg requires -Zcheck-cfg flag
warning: [email protected]: cargo:rustc-check-cfg requires -Zcheck-cfg flag
warning: [email protected]: cargo:rustc-check-cfg requires -Zcheck-cfg flag
warning: [email protected]: cargo:rustc-check-cfg requires -Zcheck-cfg flag
warning: [email protected]: cargo:rustc-check-cfg requires -Zcheck-cfg flag
warning: [email protected]: cargo:rustc-check-cfg requires -Zcheck-cfg flag
warning: [email protected]: cargo:rustc-check-cfg requires -Zcheck-cfg flag
warning: [email protected]: cargo:rustc-check-cfg requires -Zcheck-cfg flag
warning: [email protected]: cargo:rustc-check-cfg requires -Zcheck-cfg flag
warning: [email protected]: cargo:rustc-check-cfg requires -Zcheck-cfg flag
warning: [email protected]: cargo:rustc-check-cfg requires -Zcheck-cfg flag
warning: [email protected]: cargo:rustc-check-cfg requires -Zcheck-cfg flag

error: could not compile `serde` (lib) due to 2 previous errors

Reason being the not(no_diagnostic_namespace) part:

/// [Implementing `Serialize`]: https://serde.rs/impl-serialize.html
/// [`LinkedHashMap<K, V>`]: https://docs.rs/linked-hash-map/*/linked_hash_map/struct.LinkedHashMap.html
/// [`linked-hash-map`]: https://crates.io/crates/linked-hash-map
/// [`serde_derive`]: https://crates.io/crates/serde_derive
/// [derive section of the manual]: https://serde.rs/derive.html
#[cfg_attr(
    not(no_diagnostic_namespace),
    diagnostic::on_unimplemented(
        note = "for local types consider adding `#[derive(serde::Serialize)]` to your `{Self}` type",
        note = "for types from other crates check whether the crate offers a `serde` feature flag",
    )
)]

The tracking issue #111996 has been closed.
Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-discussionCategory: Discussion or questions that doesn't represent real issues.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions